SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

0 0 0 C++

Add `scrollsChildToFocus` prop to ScrollView to control automatic scrolling when a child receives focus (#55143)

Summary:
This PR adds a new Android-specific boolean property `scrollsChildToFocus` to the ScrollView component.

When a focusable element inside a ScrollView receives focus (e.g., a TextInput is tapped), Android's default behavior is to automatically scroll the ScrollView to bring that element into view. While this is often desirable, there are cases where developers need more control over scroll behavior - for example, when implementing custom scroll-to-focus animations, when using virtualized lists that manage their own scroll positions, or when focus changes should not disturb the current scroll position.

Setting `scrollsChildToFocus={false}` disables this automatic scrolling behavior, giving developers full control over scroll positioning when focus changes.

**Related issues:**
- https://github.com/facebook/react-native/issues/33419
- https://github.com/LegendApp/legend-list/issues/377

## Changelog:

[ANDROID] [ADDED] - Add `scrollsChildToFocus` prop to ScrollView to control automatic scrolling when a child receives focus

Pull Request resolved: https://github.com/facebook/react-native/pull/55143

Test Plan:
1. Run the RN Tester app on Android
2. Navigate to ScrollView examples
3. Find the new "scrollsChildToFocus" example in the Android-specific section
4. With `scrollsChildToFocus: true` (default):
   - Tap on a TextInput that is partially visible
   - Observe that the ScrollView automatically scrolls to bring the TextInput into view
5. Toggle `scrollsChildToFocus` to `false`:
   - Tap on a TextInput that is partially visible
   - Observe that the ScrollView does NOT automatically scroll - the focus changes but scroll position remains unchanged

This property affects both vertical (`<ScrollView />`) and horizontal (`<ScrollView horizontal={true} />`) scroll views.

Reviewed By: javache

Differential Revision: D90831796

Pulled By: philIip

fbshipit-source-id: 31193b45127bbac4b984452e2b56211a46616c8b
J
Johan Kasperi committed
d9ee4bb0aa55a71fd2328a8b9dfdca56a4a1e75a
Parent: 3f56ac0
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 1/17/2026, 9:28:32 PM