From c66527d9d9da0e332fa4428356e132ebb711f390 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Mon, 9 Sep 2024 11:37:40 -0700 Subject: [PATCH] ship granular state updates on iOS (#46403) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/46403 changelog: [internal] ship granular state updates on iOS. Reviewed By: rubennorte Differential Revision: D62374462 --- .../ComponentViews/ScrollView/RCTScrollViewComponentView.mm | 4 +--- packages/react-native/React/Fabric/RCTSurfacePresenter.mm | 4 ---- .../react-native/ReactCommon/react/utils/CoreFeatures.cpp | 1 - packages/react-native/ReactCommon/react/utils/CoreFeatures.h | 4 ---- 4 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 837741d938d1..9447552490a5 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -620,9 +620,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView }); } } else { - if (!_isUserTriggeredScrolling || CoreFeatures::enableGranularScrollViewStateUpdatesIOS) { - [self _updateStateWithContentOffset]; - } + [self _updateStateWithContentOffset]; NSTimeInterval now = CACurrentMediaTime(); if ((_lastScrollEventDispatchTime == 0) || (now - _lastScrollEventDispatchTime > _scrollEventThrottle)) { diff --git a/packages/react-native/React/Fabric/RCTSurfacePresenter.mm b/packages/react-native/React/Fabric/RCTSurfacePresenter.mm index 5d6f02e91430..5d24d70de628 100644 --- a/packages/react-native/React/Fabric/RCTSurfacePresenter.mm +++ b/packages/react-native/React/Fabric/RCTSurfacePresenter.mm @@ -233,10 +233,6 @@ - (RCTScheduler *)_createScheduler CoreFeatures::enablePropIteratorSetter = true; } - if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_granular_scroll_view_state_updates_ios")) { - CoreFeatures::enableGranularScrollViewStateUpdatesIOS = true; - } - auto componentRegistryFactory = [factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)]( const EventDispatcher::Weak &eventDispatcher, const ContextContainer::Shared &contextContainer) { diff --git a/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp b/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp index d1a236bc5e78..9d4ae217536f 100644 --- a/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp +++ b/packages/react-native/ReactCommon/react/utils/CoreFeatures.cpp @@ -10,7 +10,6 @@ namespace facebook::react { bool CoreFeatures::enablePropIteratorSetter = false; -bool CoreFeatures::enableGranularScrollViewStateUpdatesIOS = false; bool CoreFeatures::excludeYogaFromRawProps = false; } // namespace facebook::react diff --git a/packages/react-native/ReactCommon/react/utils/CoreFeatures.h b/packages/react-native/ReactCommon/react/utils/CoreFeatures.h index b053003bda30..526e5dc707ec 100644 --- a/packages/react-native/ReactCommon/react/utils/CoreFeatures.h +++ b/packages/react-native/ReactCommon/react/utils/CoreFeatures.h @@ -19,10 +19,6 @@ class CoreFeatures { // Specifies whether the iterator-style prop parsing is enabled. static bool enablePropIteratorSetter; - // When enabled, RCTScrollViewComponentView will trigger ShadowTree state - // updates for all changes in scroll position. - static bool enableGranularScrollViewStateUpdatesIOS; - // When enabled, rawProps in Props will not include Yoga specific props. static bool excludeYogaFromRawProps; };