mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add flag to do granular state updates in scroll views in iOS (#37461)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37461 This adds a feature flag to dispatch state updates for scroll position in every scroll position update in iOS, as opposed to only at the beginning, end and other specific moments. This is necessary to implement features like `IntersectionObserver`, but we want to test the performance impact of this change before rolling it out completely. Changelog: [internal] Reviewed By: javache Differential Revision: D45916675 fbshipit-source-id: 00a2b1c5ea03e45141bb2d81e4e5fb8c198de1ff
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0abd065b15
commit
f30716323a
+1
-1
@@ -437,7 +437,7 @@ static void RCTSendScrollEventForNativeAnimations_DEPRECATED(UIScrollView *scrol
|
||||
|
||||
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
|
||||
{
|
||||
if (!_isUserTriggeredScrolling) {
|
||||
if (!_isUserTriggeredScrolling || CoreFeatures::enableGranularScrollViewStateUpdatesIOS) {
|
||||
[self _updateStateWithContentOffset];
|
||||
}
|
||||
|
||||
|
||||
@@ -276,6 +276,10 @@ static BackgroundExecutor RCTGetBackgroundExecutor()
|
||||
CoreFeatures::disableTransactionCommit = true;
|
||||
}
|
||||
|
||||
if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_granular_scroll_view_state_updates_ios")) {
|
||||
CoreFeatures::enableGranularScrollViewStateUpdatesIOS = true;
|
||||
}
|
||||
|
||||
auto componentRegistryFactory =
|
||||
[factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)](
|
||||
EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) {
|
||||
|
||||
@@ -16,5 +16,6 @@ bool CoreFeatures::useNativeState = false;
|
||||
bool CoreFeatures::cacheLastTextMeasurement = false;
|
||||
bool CoreFeatures::cancelImageDownloadsOnRecycle = false;
|
||||
bool CoreFeatures::disableTransactionCommit = false;
|
||||
bool CoreFeatures::enableGranularScrollViewStateUpdatesIOS = false;
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -48,6 +48,10 @@ class CoreFeatures {
|
||||
// [CATransaction end] This feature flag disables it to measure its impact in
|
||||
// production.
|
||||
static bool disableTransactionCommit;
|
||||
|
||||
// When enabled, RCTScrollViewComponentView will trigger ShadowTree state
|
||||
// updates for all changes in scroll position.
|
||||
static bool enableGranularScrollViewStateUpdatesIOS;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
Reference in New Issue
Block a user