From 610cf6d7c332a64786fdb218b725c60be665fb42 Mon Sep 17 00:00:00 2001 From: Jason Zheng Date: Wed, 7 Oct 2026 23:24:22 -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 --- .../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 ef937f99089c..2d95829394f3 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); + }}> + + + + + + + +