Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<6b457b1b41a17fa2065720edc82939e3>>
* @generated SignedSource<<34a4beae0933f13de477fdf344bb2c8a>>
*/

/**
Expand Down Expand Up @@ -294,6 +294,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableLayoutAnimationsOnIOS(): Boolean = accessor.enableLayoutAnimationsOnIOS()

/**
* When enabled, UIManager.getConstants() in bridgeless mode on Android returns only the view manager names. JS gets the constants of each view manager on first use.
*/
@JvmStatic
public fun enableLazyViewManagerConstantsAndroid(): Boolean = accessor.enableLazyViewManagerConstantsAndroid()

/**
* Enable NSNull conversion when handling module arguments on iOS
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<0fdae97a0b469d01bad69d0d05c79121>>
* @generated SignedSource<<83eea4dd516167329e06efcf51194e3c>>
*/

/**
Expand Down Expand Up @@ -64,6 +64,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
private var enableKeyEventsCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableLazyViewManagerConstantsAndroidCache: Boolean? = null
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
private var enableMutationObserverByDefaultCache: Boolean? = null
Expand Down Expand Up @@ -515,6 +516,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
return cached
}

override fun enableLazyViewManagerConstantsAndroid(): Boolean {
var cached = enableLazyViewManagerConstantsAndroidCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableLazyViewManagerConstantsAndroid()
enableLazyViewManagerConstantsAndroidCache = cached
}
return cached
}

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e7d0d9416b8e1fa2a9f6246050cc06b0>>
* @generated SignedSource<<c33234fb0e4ac72412cc27c6c99c5756>>
*/

/**
Expand Down Expand Up @@ -116,6 +116,8 @@ public object ReactNativeFeatureFlagsCxxInterop {

@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnIOS(): Boolean

@DoNotStrip @JvmStatic public external fun enableLazyViewManagerConstantsAndroid(): Boolean

@DoNotStrip @JvmStatic public external fun enableModuleArgumentNSNullConversionIOS(): Boolean

@DoNotStrip @JvmStatic public external fun enableMountingCoordinatorPullModelAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<92e293070f5407d0096ab7f3fd208d45>>
* @generated SignedSource<<4c80bc66f090ad8f55507910d93e2035>>
*/

/**
Expand Down Expand Up @@ -111,6 +111,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi

override fun enableLayoutAnimationsOnIOS(): Boolean = true

override fun enableLazyViewManagerConstantsAndroid(): Boolean = false

override fun enableModuleArgumentNSNullConversionIOS(): Boolean = false

override fun enableMountingCoordinatorPullModelAndroid(): Boolean = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<17a4a2a29b0480e06ed3e8ed71fd908f>>
* @generated SignedSource<<81cb1a9c3708f7ba054cdfa68619ab52>>
*/

/**
Expand Down Expand Up @@ -68,6 +68,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
private var enableKeyEventsCache: Boolean? = null
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
private var enableLazyViewManagerConstantsAndroidCache: Boolean? = null
private var enableModuleArgumentNSNullConversionIOSCache: Boolean? = null
private var enableMountingCoordinatorPullModelAndroidCache: Boolean? = null
private var enableMutationObserverByDefaultCache: Boolean? = null
Expand Down Expand Up @@ -563,6 +564,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
return cached
}

override fun enableLazyViewManagerConstantsAndroid(): Boolean {
var cached = enableLazyViewManagerConstantsAndroidCache
if (cached == null) {
cached = currentProvider.enableLazyViewManagerConstantsAndroid()
accessedFeatureFlags.add("enableLazyViewManagerConstantsAndroid")
enableLazyViewManagerConstantsAndroidCache = cached
}
return cached
}

override fun enableModuleArgumentNSNullConversionIOS(): Boolean {
var cached = enableModuleArgumentNSNullConversionIOSCache
if (cached == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<3c3e22fe0cffa5498750e91ad05df9a8>>
* @generated SignedSource<<8a0dcd5fddadda04dfb4b161e9cdf86a>>
*/

/**
Expand Down Expand Up @@ -111,6 +111,8 @@ public interface ReactNativeFeatureFlagsProvider {

@DoNotStrip public fun enableLayoutAnimationsOnIOS(): Boolean

@DoNotStrip public fun enableLazyViewManagerConstantsAndroid(): Boolean

@DoNotStrip public fun enableModuleArgumentNSNullConversionIOS(): Boolean

@DoNotStrip public fun enableMountingCoordinatorPullModelAndroid(): Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,6 @@ internal class ReactInstance(
UIConstantsProviderBinding.install(
// Use unbuffered RuntimeExecutor to install binding
unbufferedRuntimeExecutor,
// Here we are construncting the return value for UManager.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.
{ Arguments.makeNativeMap(UIManagerModuleConstantsHelper.defaultExportableEventTypes) },
ConstantsForViewManagerProvider { viewManagerName: String ->
val viewManager =
Expand All @@ -237,16 +231,27 @@ internal class ReactInstance(
getConstantsForViewManager(viewManager, customDirectEvents)
},
{
val viewManagers: List<ViewManager<*, *>> =
ArrayList(viewManagerResolver.eagerViewManagerMap.values)
val constants = createConstants(viewManagers, customDirectEvents)

val lazyViewManagers = viewManagerResolver.lazyViewManagerNames
if (!lazyViewManagers.isEmpty()) {
constants["ViewManagerNames"] = ArrayList(lazyViewManagers)
constants["LazyViewManagersEnabled"] = true
if (ReactNativeFeatureFlags.enableLazyViewManagerConstantsAndroid()) {
// Names only: each view config is built on first use.
Arguments.makeNativeMap(createConstants(viewManagerResolver))
} else {
// Here we are construncting the return value for UManager.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.
val viewManagers: List<ViewManager<*, *>> =
ArrayList(viewManagerResolver.eagerViewManagerMap.values)
val constants = createConstants(viewManagers, customDirectEvents)

val lazyViewManagers = viewManagerResolver.lazyViewManagerNames
if (!lazyViewManagers.isEmpty()) {
constants["ViewManagerNames"] = ArrayList(lazyViewManagers)
constants["LazyViewManagersEnabled"] = true
}
Arguments.makeNativeMap(constants)
}
Arguments.makeNativeMap(constants)
},
)
}
Expand Down Expand Up @@ -584,6 +589,19 @@ internal class ReactInstance(
SoLoader.loadLibrary("rninstance")
}

private fun createConstants(viewManagerResolver: ViewManagerResolver): Map<String, Any> {
ReactMarker.logMarker(ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_START)
SystraceMessage.beginSection(Systrace.TRACE_TAG_REACT, "CreateUIManagerConstants")
.arg("Lazy", true)
.flush()
try {
return UIManagerModuleConstantsHelper.createConstants(viewManagerResolver)
} finally {
Systrace.endSection(Systrace.TRACE_TAG_REACT)
ReactMarker.logMarker(ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_CONSTANTS_END)
}
}

private fun createConstants(
viewManagers: List<ViewManager<in Nothing, in Nothing>>,
customDirectEvents: MutableMap<String, Any>?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<f9c238d577cf696d9baed365741d3d5a>>
* @generated SignedSource<<6053c059e59bf5c869e232f375331a34>>
*/

/**
Expand Down Expand Up @@ -303,6 +303,12 @@ class ReactNativeFeatureFlagsJavaProvider
return method(javaProvider_);
}

bool enableLazyViewManagerConstantsAndroid() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableLazyViewManagerConstantsAndroid");
return method(javaProvider_);
}

bool enableModuleArgumentNSNullConversionIOS() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableModuleArgumentNSNullConversionIOS");
Expand Down Expand Up @@ -851,6 +857,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS(
return ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS();
}

bool JReactNativeFeatureFlagsCxxInterop::enableLazyViewManagerConstantsAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableLazyViewManagerConstantsAndroid();
}

bool JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS();
Expand Down Expand Up @@ -1284,6 +1295,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableLayoutAnimationsOnIOS",
JReactNativeFeatureFlagsCxxInterop::enableLayoutAnimationsOnIOS),
makeNativeMethod(
"enableLazyViewManagerConstantsAndroid",
JReactNativeFeatureFlagsCxxInterop::enableLazyViewManagerConstantsAndroid),
makeNativeMethod(
"enableModuleArgumentNSNullConversionIOS",
JReactNativeFeatureFlagsCxxInterop::enableModuleArgumentNSNullConversionIOS),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<8d25ec35055628073cf8cd61f8cc838e>>
* @generated SignedSource<<5ccb6e1392e43f84eaedddb7bb244240>>
*/

/**
Expand Down Expand Up @@ -162,6 +162,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableLayoutAnimationsOnIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableLazyViewManagerConstantsAndroid(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

static bool enableModuleArgumentNSNullConversionIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<e9243c6d351c49208f0cdac358527d43>>
* @generated SignedSource<<e8a2096cee73a029293468260dfc51eb>>
*/

/**
Expand Down Expand Up @@ -202,6 +202,10 @@ bool ReactNativeFeatureFlags::enableLayoutAnimationsOnIOS() {
return getAccessor().enableLayoutAnimationsOnIOS();
}

bool ReactNativeFeatureFlags::enableLazyViewManagerConstantsAndroid() {
return getAccessor().enableLazyViewManagerConstantsAndroid();
}

bool ReactNativeFeatureFlags::enableModuleArgumentNSNullConversionIOS() {
return getAccessor().enableModuleArgumentNSNullConversionIOS();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<dc12cb4c1ebd82d842a8e7698fc6c746>>
* @generated SignedSource<<226f8736887b225621437a435ca9fe33>>
*/

/**
Expand Down Expand Up @@ -261,6 +261,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableLayoutAnimationsOnIOS();

/**
* When enabled, UIManager.getConstants() in bridgeless mode on Android returns only the view manager names. JS gets the constants of each view manager on first use.
*/
RN_EXPORT static bool enableLazyViewManagerConstantsAndroid();

/**
* Enable NSNull conversion when handling module arguments on iOS
*/
Expand Down
Loading
Loading