From ce5eee0fa0104dffecc294c249dd546aef70490a Mon Sep 17 00:00:00 2001 From: Jason Zheng Date: Tue, 29 Sep 2026 23:43:07 -0700 Subject: [PATCH] Add TextInput example in ScrollViewExample Summary: 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] 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); + }}> + + + + + + + +