You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 55e061e
Browse filesBrowse the repository at this point in the historyBrowse files
Dispatch paired momentum scroll events for animated programmatic scrolls
Summary:
On iOS, an animated `scrollTo`/`scrollToEnd` dispatched `onMomentumScrollEnd` without a preceding `onMomentumScrollBegin`, and a non-animated one dispatched a lone `onMomentumScrollEnd`. Android dispatches a begin/end pair for animated programmatic scrolls and nothing for non-animated ones.
An earlier attempt dispatched `onMomentumScrollBegin` after starting the animation. When UIKit finished the animation synchronously, or never reported its end, the begin event arrived after its end event or was never matched. `ScrollView` treats a begin newer than the last end as "still animating" and captures every touch, so its children stopped responding.
Behind the `fixProgrammaticScrollMomentumEventsIOS` feature flag (off by default, on for the OSS canary release level), track an in-flight animated programmatic scroll and guarantee ordering and pairing:
- Dispatch `onMomentumScrollBegin` before calling `setContentOffset:animated:`.
- Dispatch `onMomentumScrollEnd` when the animation ends, when UIKit applies the offset without animating (no window, or offset applied immediately), when a drag interrupts the animation, when the view leaves the window, or from a fallback one second later if UIKit never reports the end.
- Non-animated scrolls, and animated `zoomToRect`, dispatch neither event.
With the flag off, behavior is unchanged.
Changelog:
[iOS][Added] - `fixProgrammaticScrollMomentumEventsIOS` feature flag: `onMomentumScrollBegin` and `onMomentumScrollEnd` fire as a pair for animated `scrollTo`/`scrollToEnd`, and neither fires for non-animated scrolls
Reviewed By: andrewdacenko
Differential Revision: D131264148
Pull Request resolved: #60162
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
* Dispatches `onMomentumScrollBegin` and `onMomentumScrollEnd` as an ordered pair for animated programmatic scrolls on iOS, and neither for non-animated programmatic scrolls.
* Grows lines of text with `lineHeight` to fit taller inline views instead of letting them overflow, keeps lines after an inline view at `lineHeight` on Android, and aligns inline views with the text baseline on iOS.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt
+12-1Lines changed: 12 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
Copy file name to clipboardExpand all lines: packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
0 commit comments