From eff2413a40655e2ccde82109a060d54eed3cc7d6 Mon Sep 17 00:00:00 2001 From: Jason Zheng Date: Thu, 22 Oct 2026 19:28:48 -0700 Subject: [PATCH] Add TextInput example in ScrollViewExample (#58756) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58756 Add a new RNTester example in ScrollViewExample for using the component with TextInputs. This reproduces the issue where TextInputs on Android absorb scroll gestures when textAlign is set to "center" or "right". For TextInputs inside a ScrollView, starting a scroll gesture on the TextInput would not scroll the ScrollView. As this is a common use case, the example acts as a reference to show intended behavior and prevent future regressions. Changelog: [Internal] Reviewed By: cortinico Differential Revision: D122199421 fbshipit-source-id: 2e7df91887fd24f85e2d26633400ef4c168d14b1 --- .../examples/ScrollView/ScrollViewExample.js | 144 +++++++++++++++++- 1 file changed, 143 insertions(+), 1 deletion(-) diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js index ef937f99089..2d95829394f 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js @@ -470,6 +470,22 @@ const examples: Array = [ return ; }, }, + { + title: ' TextInputs\n', + description: + 'Vertical scroll gestures on a TextInput should scroll the ScrollView unless the input can also scroll vertically.', + render(): React.Node { + return ; + }, + }, + { + title: ' TextInputs (horizontal = true)\n', + description: + 'Horizontal scroll gestures on a TextInput should scroll the ScrollView unless the input can also scroll horizontally.', + render(): React.Node { + return ; + }, + }, ]; if (Platform.OS === 'ios') { @@ -611,6 +627,131 @@ const ScrollsChildToFocusExample = () => { ); }; +const VerticalScrollTextInputs = () => { + const _verticalScrollView = + useRef>(null); + const [verticalScrolled, setVerticalScrolled] = useState(false); + + return ( + + + scrolled = {verticalScrolled ? 'true' : 'false'} + + { + setVerticalScrolled(event.nativeEvent.contentOffset.y > 0); + }}> + + + + + + + +