diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp index a8b8357417f..fd24de61066 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp @@ -28,6 +28,31 @@ using namespace facebook::jni; namespace facebook { namespace react { +static bool doesUseOverflowInset() { + static const auto reactFeatureFlagsJavaDescriptor = jni::findClassStatic( + FabricMountingManager::ReactFeatureFlagsJavaDescriptor); + static const auto doesUseOverflowInset = + reactFeatureFlagsJavaDescriptor->getStaticMethod( + "doesUseOverflowInset"); + return doesUseOverflowInset(reactFeatureFlagsJavaDescriptor); +} + +FabricMountingManager::FabricMountingManager( + std::shared_ptr &config, + global_ref &javaUIManager) + : javaUIManager_(javaUIManager), + enableEarlyEventEmitterUpdate_( + config->getBool("react_fabric:enable_early_event_emitter_update")), + disablePreallocateViews_( + config->getBool("react_fabric:disabled_view_preallocation_android")), + disableRevisionCheckForPreallocation_(config->getBool( + "react_fabric:disable_revision_check_for_preallocation")), + useOverflowInset_(doesUseOverflowInset()), + shouldRememberAllocatedViews_(config->getBool( + "react_native_new_architecture:remember_views_on_mount_android")), + useMapBufferForViewProps_(config->getBool( + "react_native_new_architecture:use_mapbuffer_for_viewprops")) {} + void FabricMountingManager::onSurfaceStart(SurfaceId surfaceId) { std::lock_guard lock(allocatedViewsMutex_); allocatedViewRegistry_.emplace(surfaceId, butter::set{}); @@ -926,31 +951,5 @@ void FabricMountingManager::onAllAnimationsComplete() { allAnimationsCompleteJNI(javaUIManager_); } -bool doesUseOverflowInset() { - static const auto reactFeatureFlagsJavaDescriptor = jni::findClassStatic( - FabricMountingManager::ReactFeatureFlagsJavaDescriptor); - static const auto doesUseOverflowInset = - reactFeatureFlagsJavaDescriptor->getStaticMethod( - "doesUseOverflowInset"); - return doesUseOverflowInset(reactFeatureFlagsJavaDescriptor); -} - -FabricMountingManager::FabricMountingManager( - std::shared_ptr &config, - global_ref &javaUIManager) - : javaUIManager_(javaUIManager) { - enableEarlyEventEmitterUpdate_ = - config->getBool("react_fabric:enable_early_event_emitter_update"); - disablePreallocateViews_ = - config->getBool("react_fabric:disabled_view_preallocation_android"); - disableRevisionCheckForPreallocation_ = - config->getBool("react_fabric:disable_revision_check_for_preallocation"); - useOverflowInset_ = doesUseOverflowInset(); - shouldRememberAllocatedViews_ = config->getBool( - "react_native_new_architecture:remember_views_on_mount_android"); - useMapBufferForViewProps_ = config->getBool( - "react_native_new_architecture:use_mapbuffer_for_viewprops"); -} - } // namespace react } // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h index 3fd1606a0bb..ebd95dd8094 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h @@ -23,7 +23,7 @@ namespace facebook { namespace react { -class FabricMountingManager { +class FabricMountingManager final { public: constexpr static auto UIManagerJavaDescriptor = "com/facebook/react/fabric/FabricUIManager"; @@ -61,8 +61,6 @@ class FabricMountingManager { void onAllAnimationsComplete(); - virtual ~FabricMountingManager() = default; - private: jni::global_ref javaUIManager_; @@ -71,12 +69,12 @@ class FabricMountingManager { butter::map> allocatedViewRegistry_{}; std::recursive_mutex allocatedViewsMutex_; - bool enableEarlyEventEmitterUpdate_{false}; - bool disablePreallocateViews_{false}; - bool disableRevisionCheckForPreallocation_{false}; - bool useOverflowInset_{false}; - bool shouldRememberAllocatedViews_{false}; - bool useMapBufferForViewProps_{false}; + bool const enableEarlyEventEmitterUpdate_{false}; + bool const disablePreallocateViews_{false}; + bool const disableRevisionCheckForPreallocation_{false}; + bool const useOverflowInset_{false}; + bool const shouldRememberAllocatedViews_{false}; + bool const useMapBufferForViewProps_{false}; jni::local_ref getProps( ShadowView const &oldShadowView,