mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
introduce UpdateMode::unstable_Immediate (#52604)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52604 changelog: [internal] For Fabric View Culling to work correctly, content offset changes must be applied synchronously to avoid UI flicker. The flicker happens because content offset update happens asynchronously and the OS paints scroll position update before React Native has a chance to adjust view hierarchy for the new scroll position. Reviewed By: lenaic Differential Revision: D78334322 fbshipit-source-id: dc1f1b3f9db9f9547e5a588dc184fcf21cca2727
This commit is contained in:
1 parent
a9ece0c302
commit
9967908e89
28 files changed
+228
-73
No files matched your search
+4
-1
@@ -610,7 +610,10 @@ static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCu
|
||||
auto newData = oldData;
|
||||
newData.contentOffset = contentOffset;
|
||||
return std::make_shared<const ScrollViewShadowNode::ConcreteState::Data>(newData);
|
||||
});
|
||||
},
|
||||
ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges()
|
||||
? EventQueue::UpdateMode::unstable_Immediate
|
||||
: EventQueue::UpdateMode::Asynchronous);
|
||||
}
|
||||
|
||||
- (void)prepareForRecycle
|
||||
|
||||
+7
-1
@@ -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<<d78523bf7df6a47a898691ff0fb3cb31>>
|
||||
* @generated SignedSource<<9c5b3d6c75738162b6fde47b009d4e9e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -162,6 +162,12 @@ public object ReactNativeFeatureFlags {
|
||||
@JvmStatic
|
||||
public fun enableIOSViewClipToPaddingBox(): Boolean = accessor.enableIOSViewClipToPaddingBox()
|
||||
|
||||
/**
|
||||
* Dispatches state updates for content offset changes synchronously on the main thread.
|
||||
*/
|
||||
@JvmStatic
|
||||
public fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean = accessor.enableImmediateUpdateModeForContentOffsetChanges()
|
||||
|
||||
/**
|
||||
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
|
||||
*/
|
||||
|
||||
+11
-1
@@ -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<<11cd0aab6fc53dc3ce33a778653362f3>>
|
||||
* @generated SignedSource<<c150db56ad8e6680b4caf721d44bb71e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -42,6 +42,7 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
|
||||
@@ -278,6 +279,15 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
|
||||
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
|
||||
if (cached == null) {
|
||||
cached = ReactNativeFeatureFlagsCxxInterop.enableImmediateUpdateModeForContentOffsetChanges()
|
||||
enableImmediateUpdateModeForContentOffsetChangesCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
|
||||
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-1
@@ -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<<6632afc2a97459fdd9bfda57161ae017>>
|
||||
* @generated SignedSource<<76620030b48d203be3b6e5af0b5878e0>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -72,6 +72,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableIOSViewClipToPaddingBox(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
|
||||
@DoNotStrip @JvmStatic public external fun enableLayoutAnimationsOnAndroid(): Boolean
|
||||
|
||||
+3
-1
@@ -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<<480d4cfb08521a003d9ce178bba885fc>>
|
||||
* @generated SignedSource<<93678c8e9dfc46623c3f5863f3120f5a>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -67,6 +67,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
|
||||
|
||||
override fun enableIOSViewClipToPaddingBox(): Boolean = false
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean = false
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean = false
|
||||
|
||||
override fun enableLayoutAnimationsOnAndroid(): Boolean = false
|
||||
|
||||
+12
-1
@@ -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<<977c111cdd608b0b05d56c450d5b647f>>
|
||||
* @generated SignedSource<<97ceb9172696ba8f5a449397ef0bb66e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -46,6 +46,7 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
|
||||
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
|
||||
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
|
||||
private var enableImmediateUpdateModeForContentOffsetChangesCache: Boolean? = null
|
||||
private var enableInteropViewManagerClassLookUpOptimizationIOSCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnAndroidCache: Boolean? = null
|
||||
private var enableLayoutAnimationsOnIOSCache: Boolean? = null
|
||||
@@ -304,6 +305,16 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean {
|
||||
var cached = enableImmediateUpdateModeForContentOffsetChangesCache
|
||||
if (cached == null) {
|
||||
cached = currentProvider.enableImmediateUpdateModeForContentOffsetChanges()
|
||||
accessedFeatureFlags.add("enableImmediateUpdateModeForContentOffsetChanges")
|
||||
enableImmediateUpdateModeForContentOffsetChangesCache = cached
|
||||
}
|
||||
return cached
|
||||
}
|
||||
|
||||
override fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean {
|
||||
var cached = enableInteropViewManagerClassLookUpOptimizationIOSCache
|
||||
if (cached == null) {
|
||||
|
||||
+3
-1
@@ -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<<3f639a112ed905db892edd7001a59406>>
|
||||
* @generated SignedSource<<6f70c3e858384d57098bf82cbd9cf837>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -67,6 +67,8 @@ public interface ReactNativeFeatureFlagsProvider {
|
||||
|
||||
@DoNotStrip public fun enableIOSViewClipToPaddingBox(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableImmediateUpdateModeForContentOffsetChanges(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableInteropViewManagerClassLookUpOptimizationIOS(): Boolean
|
||||
|
||||
@DoNotStrip public fun enableLayoutAnimationsOnAndroid(): Boolean
|
||||
|
||||
+15
-1
@@ -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<<89bdd3d1323ca1dc1c57d3da6c830984>>
|
||||
* @generated SignedSource<<1125d68204066d96780bf6bedea13a29>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -171,6 +171,12 @@ class ReactNativeFeatureFlagsJavaProvider
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableImmediateUpdateModeForContentOffsetChanges");
|
||||
return method(javaProvider_);
|
||||
}
|
||||
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
|
||||
static const auto method =
|
||||
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableInteropViewManagerClassLookUpOptimizationIOS");
|
||||
@@ -507,6 +513,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox(
|
||||
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges();
|
||||
}
|
||||
|
||||
bool JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
|
||||
return ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
@@ -789,6 +800,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
|
||||
makeNativeMethod(
|
||||
"enableIOSViewClipToPaddingBox",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableIOSViewClipToPaddingBox),
|
||||
makeNativeMethod(
|
||||
"enableImmediateUpdateModeForContentOffsetChanges",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableImmediateUpdateModeForContentOffsetChanges),
|
||||
makeNativeMethod(
|
||||
"enableInteropViewManagerClassLookUpOptimizationIOS",
|
||||
JReactNativeFeatureFlagsCxxInterop::enableInteropViewManagerClassLookUpOptimizationIOS),
|
||||
|
||||
+4
-1
@@ -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<<af658845524d8ef361907bc048d137b9>>
|
||||
* @generated SignedSource<<896c391f9708539a44bb87ea7899de6e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -96,6 +96,9 @@ class JReactNativeFeatureFlagsCxxInterop
|
||||
static bool enableIOSViewClipToPaddingBox(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableImmediateUpdateModeForContentOffsetChanges(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
static bool enableInteropViewManagerClassLookUpOptimizationIOS(
|
||||
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
|
||||
|
||||
|
||||
@@ -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<<887d9f40f6f5a8a237bd4e117c6d6ad1>>
|
||||
* @generated SignedSource<<59cf526e52fe18ce86c588df2db5cf10>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -114,6 +114,10 @@ bool ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox() {
|
||||
return getAccessor().enableIOSViewClipToPaddingBox();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges() {
|
||||
return getAccessor().enableImmediateUpdateModeForContentOffsetChanges();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS() {
|
||||
return getAccessor().enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
}
|
||||
|
||||
@@ -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<<328b45ca68417a7acb71989cf18bd05e>>
|
||||
* @generated SignedSource<<32a1fb22d04a63618f5f763615c26c2d>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -149,6 +149,11 @@ class ReactNativeFeatureFlags {
|
||||
*/
|
||||
RN_EXPORT static bool enableIOSViewClipToPaddingBox();
|
||||
|
||||
/**
|
||||
* Dispatches state updates for content offset changes synchronously on the main thread.
|
||||
*/
|
||||
RN_EXPORT static bool enableImmediateUpdateModeForContentOffsetChanges();
|
||||
|
||||
/**
|
||||
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
|
||||
*/
|
||||
|
||||
+56
-38
@@ -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<<7c5b0e8b37dd2c2714eb8ce25899d6ab>>
|
||||
* @generated SignedSource<<03902fdb354e0b400703064f5db60e18>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -425,6 +425,24 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() {
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::enableImmediateUpdateModeForContentOffsetChanges() {
|
||||
auto flagValue = enableImmediateUpdateModeForContentOffsetChanges_.load();
|
||||
|
||||
if (!flagValue.has_value()) {
|
||||
// This block is not exclusive but it is not necessary.
|
||||
// If multiple threads try to initialize the feature flag, we would only
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(22, "enableImmediateUpdateModeForContentOffsetChanges");
|
||||
|
||||
flagValue = currentProvider_->enableImmediateUpdateModeForContentOffsetChanges();
|
||||
enableImmediateUpdateModeForContentOffsetChanges_ = flagValue;
|
||||
}
|
||||
|
||||
return flagValue.value();
|
||||
}
|
||||
|
||||
bool ReactNativeFeatureFlagsAccessor::enableInteropViewManagerClassLookUpOptimizationIOS() {
|
||||
auto flagValue = enableInteropViewManagerClassLookUpOptimizationIOS_.load();
|
||||
|
||||
@@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::enableInteropViewManagerClassLookUpOptimiz
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(22, "enableInteropViewManagerClassLookUpOptimizationIOS");
|
||||
markFlagAsAccessed(23, "enableInteropViewManagerClassLookUpOptimizationIOS");
|
||||
|
||||
flagValue = currentProvider_->enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
enableInteropViewManagerClassLookUpOptimizationIOS_ = flagValue;
|
||||
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(23, "enableLayoutAnimationsOnAndroid");
|
||||
markFlagAsAccessed(24, "enableLayoutAnimationsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->enableLayoutAnimationsOnAndroid();
|
||||
enableLayoutAnimationsOnAndroid_ = flagValue;
|
||||
@@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(24, "enableLayoutAnimationsOnIOS");
|
||||
markFlagAsAccessed(25, "enableLayoutAnimationsOnIOS");
|
||||
|
||||
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
|
||||
enableLayoutAnimationsOnIOS_ = flagValue;
|
||||
@@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMainQueueCoordinatorOnIOS() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(25, "enableMainQueueCoordinatorOnIOS");
|
||||
markFlagAsAccessed(26, "enableMainQueueCoordinatorOnIOS");
|
||||
|
||||
flagValue = currentProvider_->enableMainQueueCoordinatorOnIOS();
|
||||
enableMainQueueCoordinatorOnIOS_ = flagValue;
|
||||
@@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::enableModuleArgumentNSNullConversionIOS()
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(26, "enableModuleArgumentNSNullConversionIOS");
|
||||
markFlagAsAccessed(27, "enableModuleArgumentNSNullConversionIOS");
|
||||
|
||||
flagValue = currentProvider_->enableModuleArgumentNSNullConversionIOS();
|
||||
enableModuleArgumentNSNullConversionIOS_ = flagValue;
|
||||
@@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNativeCSSParsing() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(27, "enableNativeCSSParsing");
|
||||
markFlagAsAccessed(28, "enableNativeCSSParsing");
|
||||
|
||||
flagValue = currentProvider_->enableNativeCSSParsing();
|
||||
enableNativeCSSParsing_ = flagValue;
|
||||
@@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNetworkEventReporting() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(28, "enableNetworkEventReporting");
|
||||
markFlagAsAccessed(29, "enableNetworkEventReporting");
|
||||
|
||||
flagValue = currentProvider_->enableNetworkEventReporting();
|
||||
enableNetworkEventReporting_ = flagValue;
|
||||
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::enableNewBackgroundAndBorderDrawables() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(29, "enableNewBackgroundAndBorderDrawables");
|
||||
markFlagAsAccessed(30, "enableNewBackgroundAndBorderDrawables");
|
||||
|
||||
flagValue = currentProvider_->enableNewBackgroundAndBorderDrawables();
|
||||
enableNewBackgroundAndBorderDrawables_ = flagValue;
|
||||
@@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePreparedTextLayout() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(30, "enablePreparedTextLayout");
|
||||
markFlagAsAccessed(31, "enablePreparedTextLayout");
|
||||
|
||||
flagValue = currentProvider_->enablePreparedTextLayout();
|
||||
enablePreparedTextLayout_ = flagValue;
|
||||
@@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(31, "enablePropsUpdateReconciliationAndroid");
|
||||
markFlagAsAccessed(32, "enablePropsUpdateReconciliationAndroid");
|
||||
|
||||
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
|
||||
enablePropsUpdateReconciliationAndroid_ = flagValue;
|
||||
@@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::enableResourceTimingAPI() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(32, "enableResourceTimingAPI");
|
||||
markFlagAsAccessed(33, "enableResourceTimingAPI");
|
||||
|
||||
flagValue = currentProvider_->enableResourceTimingAPI();
|
||||
enableResourceTimingAPI_ = flagValue;
|
||||
@@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewCulling() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(33, "enableViewCulling");
|
||||
markFlagAsAccessed(34, "enableViewCulling");
|
||||
|
||||
flagValue = currentProvider_->enableViewCulling();
|
||||
enableViewCulling_ = flagValue;
|
||||
@@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(34, "enableViewRecycling");
|
||||
markFlagAsAccessed(35, "enableViewRecycling");
|
||||
|
||||
flagValue = currentProvider_->enableViewRecycling();
|
||||
enableViewRecycling_ = flagValue;
|
||||
@@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForText() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(35, "enableViewRecyclingForText");
|
||||
markFlagAsAccessed(36, "enableViewRecyclingForText");
|
||||
|
||||
flagValue = currentProvider_->enableViewRecyclingForText();
|
||||
enableViewRecyclingForText_ = flagValue;
|
||||
@@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecyclingForView() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(36, "enableViewRecyclingForView");
|
||||
markFlagAsAccessed(37, "enableViewRecyclingForView");
|
||||
|
||||
flagValue = currentProvider_->enableViewRecyclingForView();
|
||||
enableViewRecyclingForView_ = flagValue;
|
||||
@@ -704,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewDebugFeatures() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(37, "enableVirtualViewDebugFeatures");
|
||||
markFlagAsAccessed(38, "enableVirtualViewDebugFeatures");
|
||||
|
||||
flagValue = currentProvider_->enableVirtualViewDebugFeatures();
|
||||
enableVirtualViewDebugFeatures_ = flagValue;
|
||||
@@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewRenderState() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(38, "enableVirtualViewRenderState");
|
||||
markFlagAsAccessed(39, "enableVirtualViewRenderState");
|
||||
|
||||
flagValue = currentProvider_->enableVirtualViewRenderState();
|
||||
enableVirtualViewRenderState_ = flagValue;
|
||||
@@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::enableVirtualViewWindowFocusDetection() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(39, "enableVirtualViewWindowFocusDetection");
|
||||
markFlagAsAccessed(40, "enableVirtualViewWindowFocusDetection");
|
||||
|
||||
flagValue = currentProvider_->enableVirtualViewWindowFocusDetection();
|
||||
enableVirtualViewWindowFocusDetection_ = flagValue;
|
||||
@@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(40, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
|
||||
markFlagAsAccessed(41, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
|
||||
|
||||
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
|
||||
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
|
||||
@@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(41, "fuseboxEnabledRelease");
|
||||
markFlagAsAccessed(42, "fuseboxEnabledRelease");
|
||||
|
||||
flagValue = currentProvider_->fuseboxEnabledRelease();
|
||||
fuseboxEnabledRelease_ = flagValue;
|
||||
@@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxNetworkInspectionEnabled() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(42, "fuseboxNetworkInspectionEnabled");
|
||||
markFlagAsAccessed(43, "fuseboxNetworkInspectionEnabled");
|
||||
|
||||
flagValue = currentProvider_->fuseboxNetworkInspectionEnabled();
|
||||
fuseboxNetworkInspectionEnabled_ = flagValue;
|
||||
@@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::hideOffscreenVirtualViewsOnIOS() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(43, "hideOffscreenVirtualViewsOnIOS");
|
||||
markFlagAsAccessed(44, "hideOffscreenVirtualViewsOnIOS");
|
||||
|
||||
flagValue = currentProvider_->hideOffscreenVirtualViewsOnIOS();
|
||||
hideOffscreenVirtualViewsOnIOS_ = flagValue;
|
||||
@@ -830,7 +848,7 @@ double ReactNativeFeatureFlagsAccessor::preparedTextCacheSize() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(44, "preparedTextCacheSize");
|
||||
markFlagAsAccessed(45, "preparedTextCacheSize");
|
||||
|
||||
flagValue = currentProvider_->preparedTextCacheSize();
|
||||
preparedTextCacheSize_ = flagValue;
|
||||
@@ -848,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::releaseImageDataWhenConsumed() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(45, "releaseImageDataWhenConsumed");
|
||||
markFlagAsAccessed(46, "releaseImageDataWhenConsumed");
|
||||
|
||||
flagValue = currentProvider_->releaseImageDataWhenConsumed();
|
||||
releaseImageDataWhenConsumed_ = flagValue;
|
||||
@@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(46, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
markFlagAsAccessed(47, "traceTurboModulePromiseRejectionsOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
|
||||
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
|
||||
@@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::updateRuntimeShadowNodeReferencesOnCommit(
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(47, "updateRuntimeShadowNodeReferencesOnCommit");
|
||||
markFlagAsAccessed(48, "updateRuntimeShadowNodeReferencesOnCommit");
|
||||
|
||||
flagValue = currentProvider_->updateRuntimeShadowNodeReferencesOnCommit();
|
||||
updateRuntimeShadowNodeReferencesOnCommit_ = flagValue;
|
||||
@@ -902,7 +920,7 @@ bool ReactNativeFeatureFlagsAccessor::useAlwaysAvailableJSErrorHandling() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(48, "useAlwaysAvailableJSErrorHandling");
|
||||
markFlagAsAccessed(49, "useAlwaysAvailableJSErrorHandling");
|
||||
|
||||
flagValue = currentProvider_->useAlwaysAvailableJSErrorHandling();
|
||||
useAlwaysAvailableJSErrorHandling_ = flagValue;
|
||||
@@ -920,7 +938,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(49, "useFabricInterop");
|
||||
markFlagAsAccessed(50, "useFabricInterop");
|
||||
|
||||
flagValue = currentProvider_->useFabricInterop();
|
||||
useFabricInterop_ = flagValue;
|
||||
@@ -938,7 +956,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeEqualsInNativeReadableArrayAndroi
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(50, "useNativeEqualsInNativeReadableArrayAndroid");
|
||||
markFlagAsAccessed(51, "useNativeEqualsInNativeReadableArrayAndroid");
|
||||
|
||||
flagValue = currentProvider_->useNativeEqualsInNativeReadableArrayAndroid();
|
||||
useNativeEqualsInNativeReadableArrayAndroid_ = flagValue;
|
||||
@@ -956,7 +974,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeTransformHelperAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(51, "useNativeTransformHelperAndroid");
|
||||
markFlagAsAccessed(52, "useNativeTransformHelperAndroid");
|
||||
|
||||
flagValue = currentProvider_->useNativeTransformHelperAndroid();
|
||||
useNativeTransformHelperAndroid_ = flagValue;
|
||||
@@ -974,7 +992,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(52, "useNativeViewConfigsInBridgelessMode");
|
||||
markFlagAsAccessed(53, "useNativeViewConfigsInBridgelessMode");
|
||||
|
||||
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
|
||||
useNativeViewConfigsInBridgelessMode_ = flagValue;
|
||||
@@ -992,7 +1010,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(53, "useOptimizedEventBatchingOnAndroid");
|
||||
markFlagAsAccessed(54, "useOptimizedEventBatchingOnAndroid");
|
||||
|
||||
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
|
||||
useOptimizedEventBatchingOnAndroid_ = flagValue;
|
||||
@@ -1010,7 +1028,7 @@ bool ReactNativeFeatureFlagsAccessor::useRawPropsJsiValue() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(54, "useRawPropsJsiValue");
|
||||
markFlagAsAccessed(55, "useRawPropsJsiValue");
|
||||
|
||||
flagValue = currentProvider_->useRawPropsJsiValue();
|
||||
useRawPropsJsiValue_ = flagValue;
|
||||
@@ -1028,7 +1046,7 @@ bool ReactNativeFeatureFlagsAccessor::useShadowNodeStateOnClone() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(55, "useShadowNodeStateOnClone");
|
||||
markFlagAsAccessed(56, "useShadowNodeStateOnClone");
|
||||
|
||||
flagValue = currentProvider_->useShadowNodeStateOnClone();
|
||||
useShadowNodeStateOnClone_ = flagValue;
|
||||
@@ -1046,7 +1064,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(56, "useTurboModuleInterop");
|
||||
markFlagAsAccessed(57, "useTurboModuleInterop");
|
||||
|
||||
flagValue = currentProvider_->useTurboModuleInterop();
|
||||
useTurboModuleInterop_ = flagValue;
|
||||
@@ -1064,7 +1082,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModules() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(57, "useTurboModules");
|
||||
markFlagAsAccessed(58, "useTurboModules");
|
||||
|
||||
flagValue = currentProvider_->useTurboModules();
|
||||
useTurboModules_ = flagValue;
|
||||
@@ -1082,7 +1100,7 @@ double ReactNativeFeatureFlagsAccessor::virtualViewPrerenderRatio() {
|
||||
// be accessing the provider multiple times but the end state of this
|
||||
// instance and the returned flag value would be the same.
|
||||
|
||||
markFlagAsAccessed(58, "virtualViewPrerenderRatio");
|
||||
markFlagAsAccessed(59, "virtualViewPrerenderRatio");
|
||||
|
||||
flagValue = currentProvider_->virtualViewPrerenderRatio();
|
||||
virtualViewPrerenderRatio_ = flagValue;
|
||||
|
||||
+4
-2
@@ -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<<1b5ec51de5af04adcaf19a0118e2b7a7>>
|
||||
* @generated SignedSource<<35af0fe356d9a0b8697e038dd41e1f16>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -54,6 +54,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
bool enableFontScaleChangesUpdatingLayout();
|
||||
bool enableIOSTextBaselineOffsetPerLine();
|
||||
bool enableIOSViewClipToPaddingBox();
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges();
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
bool enableLayoutAnimationsOnAndroid();
|
||||
bool enableLayoutAnimationsOnIOS();
|
||||
@@ -102,7 +103,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
|
||||
bool wasOverridden_;
|
||||
|
||||
std::array<std::atomic<const char*>, 59> accessedFeatureFlags_;
|
||||
std::array<std::atomic<const char*>, 60> accessedFeatureFlags_;
|
||||
|
||||
std::atomic<std::optional<bool>> commonTestFlag_;
|
||||
std::atomic<std::optional<bool>> cxxNativeAnimatedEnabled_;
|
||||
@@ -126,6 +127,7 @@ class ReactNativeFeatureFlagsAccessor {
|
||||
std::atomic<std::optional<bool>> enableFontScaleChangesUpdatingLayout_;
|
||||
std::atomic<std::optional<bool>> enableIOSTextBaselineOffsetPerLine_;
|
||||
std::atomic<std::optional<bool>> enableIOSViewClipToPaddingBox_;
|
||||
std::atomic<std::optional<bool>> enableImmediateUpdateModeForContentOffsetChanges_;
|
||||
std::atomic<std::optional<bool>> enableInteropViewManagerClassLookUpOptimizationIOS_;
|
||||
std::atomic<std::optional<bool>> enableLayoutAnimationsOnAndroid_;
|
||||
std::atomic<std::optional<bool>> enableLayoutAnimationsOnIOS_;
|
||||
|
||||
+5
-1
@@ -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<<3f31feb5c82de06491aa9a2b3e2ab03e>>
|
||||
* @generated SignedSource<<4e6c53c15a651daf5d138f13e4708495>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -115,6 +115,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
|
||||
return false;
|
||||
}
|
||||
|
||||
+10
-1
@@ -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<<a08d98159097b0f7a3ebccd38187c29c>>
|
||||
* @generated SignedSource<<fc0d81a19008e9cc2914734e9d94df85>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -243,6 +243,15 @@ class ReactNativeFeatureFlagsDynamicProvider : public ReactNativeFeatureFlagsDef
|
||||
return ReactNativeFeatureFlagsDefaults::enableIOSViewClipToPaddingBox();
|
||||
}
|
||||
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges() override {
|
||||
auto value = values_["enableImmediateUpdateModeForContentOffsetChanges"];
|
||||
if (!value.isNull()) {
|
||||
return value.getBool();
|
||||
}
|
||||
|
||||
return ReactNativeFeatureFlagsDefaults::enableImmediateUpdateModeForContentOffsetChanges();
|
||||
}
|
||||
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS() override {
|
||||
auto value = values_["enableInteropViewManagerClassLookUpOptimizationIOS"];
|
||||
if (!value.isNull()) {
|
||||
|
||||
+2
-1
@@ -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<<3ee5bdc44cf54abd4c76597f7de417c9>>
|
||||
* @generated SignedSource<<1bdf16952ef9e1939fae892cc2c5b7a0>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -47,6 +47,7 @@ class ReactNativeFeatureFlagsProvider {
|
||||
virtual bool enableFontScaleChangesUpdatingLayout() = 0;
|
||||
virtual bool enableIOSTextBaselineOffsetPerLine() = 0;
|
||||
virtual bool enableIOSViewClipToPaddingBox() = 0;
|
||||
virtual bool enableImmediateUpdateModeForContentOffsetChanges() = 0;
|
||||
virtual bool enableInteropViewManagerClassLookUpOptimizationIOS() = 0;
|
||||
virtual bool enableLayoutAnimationsOnAndroid() = 0;
|
||||
virtual bool enableLayoutAnimationsOnIOS() = 0;
|
||||
|
||||
+6
-1
@@ -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<<0896187b18aead5e4b2fc1a1fb173939>>
|
||||
* @generated SignedSource<<e5204d6bd93886d7819cd90cf73a972e>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -154,6 +154,11 @@ bool NativeReactNativeFeatureFlags::enableIOSViewClipToPaddingBox(
|
||||
return ReactNativeFeatureFlags::enableIOSViewClipToPaddingBox();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::enableImmediateUpdateModeForContentOffsetChanges();
|
||||
}
|
||||
|
||||
bool NativeReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS(
|
||||
jsi::Runtime& /*runtime*/) {
|
||||
return ReactNativeFeatureFlags::enableInteropViewManagerClassLookUpOptimizationIOS();
|
||||
|
||||
+3
-1
@@ -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<<59c3f1ef86f7f7dc31e8e13c9b24539d>>
|
||||
* @generated SignedSource<<0bc841cb23fd9241e7fd534f13d5dcdb>>
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -80,6 +80,8 @@ class NativeReactNativeFeatureFlags
|
||||
|
||||
bool enableIOSViewClipToPaddingBox(jsi::Runtime& runtime);
|
||||
|
||||
bool enableImmediateUpdateModeForContentOffsetChanges(jsi::Runtime& runtime);
|
||||
|
||||
bool enableInteropViewManagerClassLookUpOptimizationIOS(jsi::Runtime& runtime);
|
||||
|
||||
bool enableLayoutAnimationsOnAndroid(jsi::Runtime& runtime);
|
||||
|
||||
@@ -74,10 +74,15 @@ class ConcreteState : public State {
|
||||
* function for cases where a new value of data does not depend on an old
|
||||
* value.
|
||||
*/
|
||||
void updateState(Data&& newData) const {
|
||||
updateState([data{std::move(newData)}](const Data& oldData) -> SharedData {
|
||||
return std::make_shared<const Data>(data);
|
||||
});
|
||||
void updateState(
|
||||
Data&& newData,
|
||||
EventQueue::UpdateMode updateMode =
|
||||
EventQueue::UpdateMode::Asynchronous) const {
|
||||
updateState(
|
||||
[data{std::move(newData)}](const Data& /*oldData*/) -> SharedData {
|
||||
return std::make_shared<const Data>(data);
|
||||
},
|
||||
updateMode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -89,7 +94,9 @@ class ConcreteState : public State {
|
||||
* return `nullptr`.
|
||||
*/
|
||||
void updateState(
|
||||
std::function<StateData::Shared(const Data& oldData)> callback) const {
|
||||
std::function<StateData::Shared(const Data& oldData)> callback,
|
||||
EventQueue::UpdateMode updateMode =
|
||||
EventQueue::UpdateMode::Asynchronous) const {
|
||||
auto family = family_.lock();
|
||||
|
||||
if (!family) {
|
||||
@@ -104,7 +111,7 @@ class ConcreteState : public State {
|
||||
return callback(*static_cast<const Data*>(oldData.get()));
|
||||
}};
|
||||
|
||||
family->dispatchRawState(std::move(stateUpdate));
|
||||
family->dispatchRawState(std::move(stateUpdate), updateMode);
|
||||
}
|
||||
|
||||
#if defined(RN_SERIALIZABLE_STATE)
|
||||
|
||||
@@ -41,8 +41,10 @@ void EventDispatcher::experimental_flushSync() const {
|
||||
eventQueue_.experimental_flushSync();
|
||||
}
|
||||
|
||||
void EventDispatcher::dispatchStateUpdate(StateUpdate&& stateUpdate) const {
|
||||
eventQueue_.enqueueStateUpdate(std::move(stateUpdate));
|
||||
void EventDispatcher::dispatchStateUpdate(
|
||||
StateUpdate&& stateUpdate,
|
||||
EventQueue::UpdateMode updateMode) const {
|
||||
eventQueue_.enqueueStateUpdate(std::move(stateUpdate), updateMode);
|
||||
}
|
||||
|
||||
void EventDispatcher::dispatchUniqueEvent(RawEvent&& rawEvent) const {
|
||||
|
||||
@@ -56,7 +56,9 @@ class EventDispatcher {
|
||||
/*
|
||||
* Dispatches a state update with given priority.
|
||||
*/
|
||||
void dispatchStateUpdate(StateUpdate&& stateUpdate) const;
|
||||
void dispatchStateUpdate(
|
||||
StateUpdate&& stateUpdate,
|
||||
EventQueue::UpdateMode updateMode) const;
|
||||
|
||||
#pragma mark - Event listeners
|
||||
/*
|
||||
|
||||
@@ -61,7 +61,9 @@ void EventQueue::enqueueUniqueEvent(RawEvent&& rawEvent) const {
|
||||
enqueueEvent(std::move(rawEvent));
|
||||
}
|
||||
|
||||
void EventQueue::enqueueStateUpdate(StateUpdate&& stateUpdate) const {
|
||||
void EventQueue::enqueueStateUpdate(
|
||||
StateUpdate&& stateUpdate,
|
||||
UpdateMode updateMode) const {
|
||||
{
|
||||
std::scoped_lock lock(queueMutex_);
|
||||
if (!stateUpdateQueue_.empty()) {
|
||||
@@ -73,7 +75,11 @@ void EventQueue::enqueueStateUpdate(StateUpdate&& stateUpdate) const {
|
||||
stateUpdateQueue_.push_back(std::move(stateUpdate));
|
||||
}
|
||||
|
||||
onEnqueue();
|
||||
if (updateMode == UpdateMode::unstable_Immediate) {
|
||||
flushStateUpdates();
|
||||
} else {
|
||||
onEnqueue();
|
||||
}
|
||||
}
|
||||
|
||||
void EventQueue::onEnqueue() const {
|
||||
|
||||
@@ -25,6 +25,18 @@ namespace facebook::react {
|
||||
*/
|
||||
class EventQueue {
|
||||
public:
|
||||
/* The update mode is used to inform how to apply changes. */
|
||||
enum class UpdateMode {
|
||||
/** Apply the update off the main thread. */
|
||||
Asynchronous,
|
||||
/**
|
||||
* Apply the update on the main thread.
|
||||
* The immediate update mode will **immediately** block the executing thread
|
||||
* applying updates.
|
||||
*/
|
||||
unstable_Immediate,
|
||||
};
|
||||
|
||||
EventQueue(
|
||||
EventQueueProcessor eventProcessor,
|
||||
std::unique_ptr<EventBeat> eventBeat);
|
||||
@@ -46,7 +58,9 @@ class EventQueue {
|
||||
* Enqueues and (probably later) dispatch a given state update.
|
||||
* Can be called on any thread.
|
||||
*/
|
||||
void enqueueStateUpdate(StateUpdate&& stateUpdate) const;
|
||||
void enqueueStateUpdate(
|
||||
StateUpdate&& stateUpdate,
|
||||
UpdateMode updateMode = UpdateMode::Asynchronous) const;
|
||||
|
||||
/*
|
||||
* Experimental API exposed to support EventEmitter::experimental_flushSync.
|
||||
|
||||
@@ -173,13 +173,15 @@ std::shared_ptr<const State> ShadowNodeFamily::getMostRecentStateIfObsolete(
|
||||
return mostRecentState_;
|
||||
}
|
||||
|
||||
void ShadowNodeFamily::dispatchRawState(StateUpdate&& stateUpdate) const {
|
||||
void ShadowNodeFamily::dispatchRawState(
|
||||
StateUpdate&& stateUpdate,
|
||||
EventQueue::UpdateMode updateMode) const {
|
||||
auto eventDispatcher = eventDispatcher_.lock();
|
||||
if (!eventDispatcher) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventDispatcher->dispatchStateUpdate(std::move(stateUpdate));
|
||||
eventDispatcher->dispatchStateUpdate(std::move(stateUpdate), updateMode);
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -108,7 +108,9 @@ class ShadowNodeFamily final : public jsi::NativeState {
|
||||
/*
|
||||
* Dispatches a state update with given priority.
|
||||
*/
|
||||
void dispatchRawState(StateUpdate&& stateUpdate) const;
|
||||
void dispatchRawState(
|
||||
StateUpdate&& stateUpdate,
|
||||
EventQueue::UpdateMode updateMode) const;
|
||||
|
||||
/*
|
||||
* Holds currently applied native props. `nullptr` if setNativeProps API is
|
||||
|
||||
@@ -281,6 +281,17 @@ const definitions: FeatureFlagDefinitions = {
|
||||
},
|
||||
ossReleaseStage: 'none',
|
||||
},
|
||||
enableImmediateUpdateModeForContentOffsetChanges: {
|
||||
defaultValue: false,
|
||||
metadata: {
|
||||
dateAdded: '2025-07-15',
|
||||
description:
|
||||
'Dispatches state updates for content offset changes synchronously on the main thread.',
|
||||
expectedReleaseValue: true,
|
||||
purpose: 'experimentation',
|
||||
},
|
||||
ossReleaseStage: 'none',
|
||||
},
|
||||
enableInteropViewManagerClassLookUpOptimizationIOS: {
|
||||
defaultValue: false,
|
||||
metadata: {
|
||||
|
||||
@@ -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<<b9c8d94d7d92f41abddad172b14c9a30>>
|
||||
* @generated SignedSource<<0fc75c05c5860a59c20f1985fdae9cb9>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
@@ -73,6 +73,7 @@ export type ReactNativeFeatureFlags = $ReadOnly<{
|
||||
enableFontScaleChangesUpdatingLayout: Getter<boolean>,
|
||||
enableIOSTextBaselineOffsetPerLine: Getter<boolean>,
|
||||
enableIOSViewClipToPaddingBox: Getter<boolean>,
|
||||
enableImmediateUpdateModeForContentOffsetChanges: Getter<boolean>,
|
||||
enableInteropViewManagerClassLookUpOptimizationIOS: Getter<boolean>,
|
||||
enableLayoutAnimationsOnAndroid: Getter<boolean>,
|
||||
enableLayoutAnimationsOnIOS: Getter<boolean>,
|
||||
@@ -284,6 +285,10 @@ export const enableIOSTextBaselineOffsetPerLine: Getter<boolean> = createNativeF
|
||||
* iOS Views will clip to their padding box vs border box
|
||||
*/
|
||||
export const enableIOSViewClipToPaddingBox: Getter<boolean> = createNativeFlagGetter('enableIOSViewClipToPaddingBox', false);
|
||||
/**
|
||||
* Dispatches state updates for content offset changes synchronously on the main thread.
|
||||
*/
|
||||
export const enableImmediateUpdateModeForContentOffsetChanges: Getter<boolean> = createNativeFlagGetter('enableImmediateUpdateModeForContentOffsetChanges', false);
|
||||
/**
|
||||
* This is to fix the issue with interop view manager where component descriptor lookup is causing ViewManager to preload.
|
||||
*/
|
||||
|
||||
+2
-1
@@ -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<<779bd1a6aec90a69f26c7b3bb9e036f1>>
|
||||
* @generated SignedSource<<4a04d09b919b7857e00a8ddabd290a37>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
@@ -47,6 +47,7 @@ export interface Spec extends TurboModule {
|
||||
+enableFontScaleChangesUpdatingLayout?: () => boolean;
|
||||
+enableIOSTextBaselineOffsetPerLine?: () => boolean;
|
||||
+enableIOSViewClipToPaddingBox?: () => boolean;
|
||||
+enableImmediateUpdateModeForContentOffsetChanges?: () => boolean;
|
||||
+enableInteropViewManagerClassLookUpOptimizationIOS?: () => boolean;
|
||||
+enableLayoutAnimationsOnAndroid?: () => boolean;
|
||||
+enableLayoutAnimationsOnIOS?: () => boolean;
|
||||
|
||||
Reference in new issue
Block a user