diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 82b9bc73237e10..eb57ffe580b409 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -4851,19 +4851,20 @@ public abstract interface class com/facebook/react/uimanager/UIBlock { public abstract fun execute (Lcom/facebook/react/uimanager/NativeViewHierarchyManager;)V } -public class com/facebook/react/uimanager/UIConstantsProviderManager { - public fun (Lcom/facebook/react/bridge/RuntimeExecutor;Lcom/facebook/react/uimanager/UIConstantsProviderManager$DefaultEventTypesProvider;Lcom/facebook/react/uimanager/UIConstantsProviderManager$ConstantsForViewManagerProvider;Lcom/facebook/react/uimanager/UIConstantsProviderManager$ConstantsProvider;)V +public final class com/facebook/react/uimanager/UIConstantsProviderBinding { + public static final field INSTANCE Lcom/facebook/react/uimanager/UIConstantsProviderBinding; + public static final fun install (Lcom/facebook/react/bridge/RuntimeExecutor;Lcom/facebook/react/uimanager/UIConstantsProviderBinding$DefaultEventTypesProvider;Lcom/facebook/react/uimanager/UIConstantsProviderBinding$ConstantsForViewManagerProvider;Lcom/facebook/react/uimanager/UIConstantsProviderBinding$ConstantsProvider;)V } -public abstract interface class com/facebook/react/uimanager/UIConstantsProviderManager$ConstantsForViewManagerProvider { +public abstract interface class com/facebook/react/uimanager/UIConstantsProviderBinding$ConstantsForViewManagerProvider { public abstract fun getConstantsForViewManager (Ljava/lang/String;)Lcom/facebook/react/bridge/NativeMap; } -public abstract interface class com/facebook/react/uimanager/UIConstantsProviderManager$ConstantsProvider { +public abstract interface class com/facebook/react/uimanager/UIConstantsProviderBinding$ConstantsProvider { public abstract fun getConstants ()Lcom/facebook/react/bridge/NativeMap; } -public abstract interface class com/facebook/react/uimanager/UIConstantsProviderManager$DefaultEventTypesProvider { +public abstract interface class com/facebook/react/uimanager/UIConstantsProviderBinding$DefaultEventTypesProvider { public abstract fun getDefaultEventTypes ()Lcom/facebook/react/bridge/NativeMap; } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java index 9e195cc49ae044..3ab2063efefc9a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java @@ -55,7 +55,7 @@ import com.facebook.react.uimanager.ComponentNameResolverBinding; import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.IllegalViewOperationException; -import com.facebook.react.uimanager.UIConstantsProviderManager; +import com.facebook.react.uimanager.UIConstantsProviderBinding; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.UIManagerModuleConstantsHelper; import com.facebook.react.uimanager.ViewManager; @@ -97,8 +97,6 @@ final class ReactInstance { private JavaScriptContextHolder mJavaScriptContextHolder; - @DoNotStrip @Nullable private UIConstantsProviderManager mUIConstantsProviderManager; - static { loadLibraryIfNeeded(); } @@ -231,46 +229,43 @@ final class ReactInstance { if (ReactFeatureFlags.useNativeViewConfigsInBridgelessMode) { Map customDirectEvents = new HashMap<>(); - mUIConstantsProviderManager = - new UIConstantsProviderManager( - // Use unbuffered RuntimeExecutor to install binding - unbufferedRuntimeExecutor, - // Here we are construncting the return value for UIManager.getConstants call. - // The old architectre relied on the constatnts struct to contain: - // 1. Eagerly loaded view configs for all native components. - // 2. genericBubblingEventTypes. - // 3. genericDirectEventTypes. - // We want to match this beahavior. - () -> { - return (NativeMap) - Arguments.makeNativeMap( - UIManagerModuleConstantsHelper.getDefaultExportableEventTypes()); - }, - (String viewManagerName) -> { - ViewManager viewManager = mViewManagerResolver.getViewManager(viewManagerName); - if (viewManager == null) { - return null; - } - return (NativeMap) - UIManagerModule.getConstantsForViewManager(viewManager, customDirectEvents); - }, - () -> { - List viewManagers = - new ArrayList( - mViewManagerResolver.getEagerViewManagerMap().values()); - - Map constants = - UIManagerModule.createConstants(viewManagers, null, customDirectEvents); - - Collection lazyViewManagers = - mViewManagerResolver.getLazyViewManagerNames(); - if (lazyViewManagers.size() > 0) { - constants.put("ViewManagerNames", new ArrayList<>(lazyViewManagers)); - constants.put("LazyViewManagersEnabled", true); - } - - return Arguments.makeNativeMap(constants); - }); + UIConstantsProviderBinding.install( + // Use unbuffered RuntimeExecutor to install binding + unbufferedRuntimeExecutor, + // Here we are construncting the return value for UIManager.getConstants call. + // The old architectre relied on the constatnts struct to contain: + // 1. Eagerly loaded view configs for all native components. + // 2. genericBubblingEventTypes. + // 3. genericDirectEventTypes. + // We want to match this beahavior. + () -> { + return (NativeMap) + Arguments.makeNativeMap( + UIManagerModuleConstantsHelper.getDefaultExportableEventTypes()); + }, + (String viewManagerName) -> { + ViewManager viewManager = mViewManagerResolver.getViewManager(viewManagerName); + if (viewManager == null) { + return null; + } + return (NativeMap) + UIManagerModule.getConstantsForViewManager(viewManager, customDirectEvents); + }, + () -> { + List viewManagers = + new ArrayList<>(mViewManagerResolver.getEagerViewManagerMap().values()); + + Map constants = + UIManagerModule.createConstants(viewManagers, null, customDirectEvents); + + Collection lazyViewManagers = mViewManagerResolver.getLazyViewManagerNames(); + if (lazyViewManagers.size() > 0) { + constants.put("ViewManagerNames", new ArrayList<>(lazyViewManagers)); + constants.put("LazyViewManagersEnabled", true); + } + + return Arguments.makeNativeMap(constants); + }); } EventBeatManager eventBeatManager = new EventBeatManager(); @@ -430,7 +425,6 @@ public Collection getNativeModules() { mFabricUIManager.invalidate(); mJavaTimerManager.onInstanceDestroy(); mHybridData.resetNative(); - mUIConstantsProviderManager = null; mJavaScriptContextHolder.clear(); } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderBinding.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderBinding.kt new file mode 100644 index 00000000000000..9bc0bb2700f1bc --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderBinding.kt @@ -0,0 +1,47 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.uimanager + +import com.facebook.proguard.annotations.DoNotStripAny +import com.facebook.react.bridge.NativeMap +import com.facebook.react.bridge.RuntimeExecutor +import com.facebook.soloader.SoLoader +import kotlin.jvm.JvmStatic + +@DoNotStripAny +object UIConstantsProviderBinding { + init { + SoLoader.loadLibrary("uimanagerjni") + } + + @JvmStatic + external fun install( + runtimeExecutor: RuntimeExecutor, + defaultEventTypesProvider: DefaultEventTypesProvider, + viewManagerConstantsProvider: ConstantsForViewManagerProvider, + constantsProvider: ConstantsProvider + ) + + @DoNotStripAny + interface DefaultEventTypesProvider { + /* Returns UIManager's constants. */ + fun getDefaultEventTypes(): NativeMap + } + + @DoNotStripAny + interface ConstantsForViewManagerProvider { + /* Returns UIManager's constants. */ + fun getConstantsForViewManager(viewManagerName: String): NativeMap? + } + + @DoNotStripAny + interface ConstantsProvider { + /* Returns UIManager's constants. */ + fun getConstants(): NativeMap + } +} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderManager.java deleted file mode 100644 index 5fdf6e535e2012..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIConstantsProviderManager.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.uimanager; - -import com.facebook.infer.annotation.Nullsafe; -import com.facebook.jni.HybridData; -import com.facebook.proguard.annotations.DoNotStrip; -import com.facebook.proguard.annotations.DoNotStripAny; -import com.facebook.react.bridge.NativeMap; -import com.facebook.react.bridge.RuntimeExecutor; -import com.facebook.soloader.SoLoader; -import javax.annotation.Nullable; - -@Nullsafe(Nullsafe.Mode.LOCAL) -@DoNotStripAny -public class UIConstantsProviderManager { - - static { - staticInit(); - } - - @DoNotStrip - @SuppressWarnings("unused") - private final HybridData mHybridData; - - public UIConstantsProviderManager( - RuntimeExecutor runtimeExecutor, - DefaultEventTypesProvider defaultEventTypesProvider, - ConstantsForViewManagerProvider viewManagerConstantsProvider, - ConstantsProvider constantsProvider) { - mHybridData = - initHybrid( - runtimeExecutor, - defaultEventTypesProvider, - viewManagerConstantsProvider, - constantsProvider); - installJSIBindings(); - } - - private native HybridData initHybrid( - RuntimeExecutor runtimeExecutor, - DefaultEventTypesProvider defaultEventTypesProvider, - ConstantsForViewManagerProvider viewManagerConstantsProvider, - ConstantsProvider constantsProvider); - - private native void installJSIBindings(); - - private static void staticInit() { - SoLoader.loadLibrary("uimanagerjni"); - } - - @DoNotStripAny - public static interface DefaultEventTypesProvider { - /* Returns UIManager's constants. */ - NativeMap getDefaultEventTypes(); - } - - @DoNotStripAny - public static interface ConstantsForViewManagerProvider { - /* Returns UIManager's constants. */ - @Nullable - NativeMap getConstantsForViewManager(String viewManagerName); - } - - @DoNotStripAny - public static interface ConstantsProvider { - /* Returns UIManager's constants. */ - NativeMap getConstants(); - } -} diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/OnLoad.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/OnLoad.cpp index 620e8cff630311..d3aa6726dcbfc4 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/OnLoad.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/OnLoad.cpp @@ -8,11 +8,11 @@ #include #include "ComponentNameResolverBinding.h" -#include "UIConstantsProviderManager.h" +#include "UIConstantsProviderBinding.h" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { return facebook::jni::initialize(vm, [] { facebook::react::ComponentNameResolverBinding::registerNatives(); - facebook::react::UIConstantsProviderManager::registerNatives(); + facebook::react::UIConstantsProviderBinding::registerNatives(); }); } diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.cpp new file mode 100644 index 00000000000000..a0666eebede521 --- /dev/null +++ b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "UIConstantsProviderBinding.h" + +#include + +namespace facebook::react { + +using namespace facebook::jni; + +void UIConstantsProviderBinding::registerNatives() { + javaClassStatic()->registerNatives({ + makeNativeMethod("install", UIConstantsProviderBinding::install), + }); +} + +void UIConstantsProviderBinding::install( + jni::alias_ref /* unused */, + jni::alias_ref runtimeExecutor, + jni::alias_ref + defaultExportableEventTypesProvider, + jni::alias_ref + constantsForViewManagerProvider, + jni::alias_ref constantsProvider) { + auto executor = runtimeExecutor->cthis()->get(); + executor([defaultExportableEventTypesProvider = + make_global(defaultExportableEventTypesProvider), + constantsForViewManagerProvider = + make_global(constantsForViewManagerProvider), + constantsProvider = + make_global(constantsProvider)](jsi::Runtime& runtime) mutable { + LegacyUIManagerConstantsProviderBinding::install( + runtime, + "getDefaultEventTypes", + [provider = std::move(defaultExportableEventTypesProvider)]( + jsi::Runtime& runtime) { + return jsi::valueFromDynamic( + runtime, provider->getDefaultEventTypes()); + }); + + LegacyUIManagerConstantsProviderBinding::install( + runtime, + "getConstantsForViewManager", + [provider = std::move(constantsForViewManagerProvider)]( + jsi::Runtime& runtime, const std::string& viewManagerName) { + return jsi::valueFromDynamic( + runtime, provider->getConstantsForViewManager(viewManagerName)); + }); + + LegacyUIManagerConstantsProviderBinding::install( + runtime, + "getConstants", + [provider = std::move(constantsProvider)](jsi::Runtime& runtime) { + return jsi::valueFromDynamic(runtime, provider->getConstants()); + }); + }); +} + +} // namespace facebook::react diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.h b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.h similarity index 56% rename from packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.h rename to packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.h index eadc1fa987f8d0..a3f80b032461cd 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderBinding.h @@ -22,13 +22,12 @@ class DefaultEventTypesProvider static constexpr const char* kJavaDescriptor = "Lcom/facebook/react/uimanager/UIConstantsProviderManager$DefaultEventTypesProvider;"; - jsi::Value getDefaultEventTypes(jsi::Runtime& runtime) { + folly::dynamic getDefaultEventTypes() const { static auto method = javaClassStatic() ->getMethod()>( "getDefaultEventTypes"); - auto result = method(self()); - return jsi::valueFromDynamic(runtime, result->cthis()->consume()); + return method(self())->cthis()->consume(); } }; @@ -38,18 +37,17 @@ class ConstantsForViewManagerProvider static constexpr const char* kJavaDescriptor = "Lcom/facebook/react/uimanager/UIConstantsProviderManager$ConstantsForViewManagerProvider;"; - jsi::Value getConstantsForViewManager( - jsi::Runtime& runtime, - std::string viewManagerName) { + folly::dynamic getConstantsForViewManager( + const std::string& viewManagerName) const { static auto method = javaClassStatic() - ->getMethod(std::string)>( - "getConstantsForViewManager"); + ->getMethod( + const std::string&)>("getConstantsForViewManager"); auto result = method(self(), viewManagerName); if (result == nullptr) { - return jsi::Value::null(); + return nullptr; } - return jsi::valueFromDynamic(runtime, result->cthis()->consume()); + return result->cthis()->consume(); } }; @@ -58,24 +56,23 @@ class ConstantsProvider : public jni::JavaClass { static constexpr const char* kJavaDescriptor = "Lcom/facebook/react/uimanager/UIConstantsProviderManager$ConstantsProvider;"; - jsi::Value getConstants(jsi::Runtime& runtime) { + folly::dynamic getConstants() const { static auto method = javaClassStatic() ->getMethod()>( "getConstants"); - auto result = method(self()); - return jsi::valueFromDynamic(runtime, result->cthis()->consume()); + return method(self())->cthis()->consume(); } }; -class UIConstantsProviderManager - : public facebook::jni::HybridClass { +class UIConstantsProviderBinding + : public facebook::jni::JavaClass { public: static auto constexpr kJavaDescriptor = - "Lcom/facebook/react/uimanager/UIConstantsProviderManager;"; + "Lcom/facebook/react/uimanager/UIConstantsProviderBinding;"; - static facebook::jni::local_ref initHybrid( - facebook::jni::alias_ref /* unused */, + static void install( + facebook::jni::alias_ref /* unused */, facebook::jni::alias_ref runtimeExecutor, facebook::jni::alias_ref defaultExportableEventTypesProvider, @@ -85,27 +82,6 @@ class UIConstantsProviderManager constantsProvider); static void registerNatives(); - - private: - friend HybridBase; - RuntimeExecutor runtimeExecutor_; - - facebook::jni::global_ref - defaultExportableEventTypesProvider_; - facebook::jni::global_ref - constantsForViewManagerProvider_; - facebook::jni::global_ref constantsProvider_; - - void installJSIBindings(); - - explicit UIConstantsProviderManager( - RuntimeExecutor runtimeExecutor, - facebook::jni::alias_ref - defaultExportableEventTypesProvider, - facebook::jni::alias_ref - constantsForViewManagerProvider, - facebook::jni::alias_ref - constantsProvider); }; } // namespace facebook::react diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.cpp deleted file mode 100644 index 65b783669debb8..00000000000000 --- a/packages/react-native/ReactAndroid/src/main/jni/react/uimanager/UIConstantsProviderManager.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include - -#include -#include -#include -#include - -#include -#include "UIConstantsProviderManager.h" - -namespace facebook::react { - -using namespace facebook::jni; - -UIConstantsProviderManager::UIConstantsProviderManager( - RuntimeExecutor runtimeExecutor, - jni::alias_ref - defaultExportableEventTypesProvider, - jni::alias_ref - constantsForViewManagerProvider, - jni::alias_ref constantsProvider) - : runtimeExecutor_(runtimeExecutor), - defaultExportableEventTypesProvider_( - jni::make_global(defaultExportableEventTypesProvider)), - constantsForViewManagerProvider_( - jni::make_global(constantsForViewManagerProvider)), - constantsProvider_(jni::make_global(constantsProvider)) {} - -jni::local_ref -UIConstantsProviderManager::initHybrid( - jni::alias_ref /* unused */, - jni::alias_ref runtimeExecutor, - jni::alias_ref - defaultExportableEventTypesProvider, - jni::alias_ref - constantsForViewManagerProvider, - jni::alias_ref constantsProvider) { - return makeCxxInstance( - runtimeExecutor->cthis()->get(), - defaultExportableEventTypesProvider, - constantsForViewManagerProvider, - constantsProvider); -} - -void UIConstantsProviderManager::registerNatives() { - registerHybrid({ - makeNativeMethod("initHybrid", UIConstantsProviderManager::initHybrid), - makeNativeMethod( - "installJSIBindings", UIConstantsProviderManager::installJSIBindings), - }); -} - -void UIConstantsProviderManager::installJSIBindings() { - runtimeExecutor_([thizz = this](jsi::Runtime& runtime) { - auto jsiDefaultEventTypesProvider = [thizz, &runtime]() -> jsi::Value { - return thizz->defaultExportableEventTypesProvider_->getDefaultEventTypes( - runtime); - }; - - auto jsiConstantsForViewManagerProvider = - [thizz, &runtime](std::string viewManagerName) -> jsi::Value { - return thizz->constantsForViewManagerProvider_ - ->getConstantsForViewManager(runtime, viewManagerName); - }; - - auto jsiConstantsProvider = [thizz, &runtime]() -> jsi::Value { - return thizz->constantsProvider_->getConstants(runtime); - }; - - LegacyUIManagerConstantsProviderBinding::install( - runtime, - "getDefaultEventTypes", - std::move(jsiDefaultEventTypesProvider)); - - LegacyUIManagerConstantsProviderBinding::install( - runtime, - "getConstantsForViewManager", - std::move(jsiConstantsForViewManagerProvider)); - - LegacyUIManagerConstantsProviderBinding::install( - runtime, "getConstants", std::move(jsiConstantsProvider)); - }); -} - -} // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.cpp b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.cpp index ae10b3f32ff8e9..249ac80357850c 100644 --- a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.cpp +++ b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.cpp @@ -12,7 +12,7 @@ namespace facebook::react::LegacyUIManagerConstantsProviderBinding { void install( jsi::Runtime& runtime, const std::string& name, - std::function&& provider) { + std::function&& provider) { auto methodName = "RN$LegacyInterop_UIManager_" + name; auto hostFunction = [provider = std::move(provider)]( jsi::Runtime& runtime, @@ -22,7 +22,7 @@ void install( if (count != 0) { throw new jsi::JSError(runtime, "0 arguments expected."); } - return provider(); + return provider(runtime); }; auto jsiFunction = jsi::Function::createFromHostFunction( @@ -34,7 +34,7 @@ void install( void install( jsi::Runtime& runtime, const std::string& name, - std::function&& provider) { + std::function&& provider) { auto methodName = "RN$LegacyInterop_UIManager_" + name; auto hostFunction = [provider = std::move(provider)]( jsi::Runtime& runtime, @@ -49,7 +49,7 @@ void install( throw new jsi::JSError(runtime, "First argument must be string."); } - return provider(args[0].asString(runtime).utf8(runtime)); + return provider(runtime, args[0].asString(runtime).utf8(runtime)); }; auto jsiFunction = jsi::Function::createFromHostFunction( diff --git a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.h b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.h index eadf6f296aec4c..d7758a45bf22c5 100644 --- a/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.h +++ b/packages/react-native/ReactCommon/react/runtime/nativeviewconfig/LegacyUIManagerConstantsProviderBinding.h @@ -11,8 +11,6 @@ namespace facebook::react::LegacyUIManagerConstantsProviderBinding { -using ProviderType = std::function; - /* * Installs RN$LegacyInterop_UIManager_getConstants binding into JavaScript * runtime. It is supposed to be used as a substitute to UIManager.getConstants @@ -21,9 +19,9 @@ using ProviderType = std::function; void install( jsi::Runtime& runtime, const std::string& name, - std::function&& provider); + std::function&& provider); void install( jsi::Runtime& runtime, const std::string& name, - std::function&& provider); + std::function&& provider); } // namespace facebook::react::LegacyUIManagerConstantsProviderBinding diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.mm index 5d8bc5ce83f9af..77933fe9f8891b 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.mm @@ -38,7 +38,6 @@ void installLegacyUIManagerConstantsProviderBinding(jsi::Runtime &runtime) { - auto constantsProvider = [&runtime]() -> jsi::Value { return getConstants(runtime); }; - LegacyUIManagerConstantsProviderBinding::install(runtime, "getConstants", std::move(constantsProvider)); + LegacyUIManagerConstantsProviderBinding::install(runtime, "getConstants", getConstants); } } // namespace facebook::react