Skip to content

Commit 93e7a7a

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Prevent ScrollView From Stealing Responder Capture When Using Physical Keyboard (#29798)
Summary: Fixes microsoft/react-native-windows#5867 ScrollResponder has logic so that the first tap exiting out of a soft keyboard is captured instead of leaking to its children. This state is checked by testing if `TextInputState.currentlyFocusedInput()` is non-null. This also fires in cases a soft keyboard is not present (e.g. on Desktop where a physical keyboard is in use). This presents to users as clicks/taps not being registered when moving from a TextInput to something esle. Instead of checking TextInputState to see if the softKeyboard is open, check `this.keyboardWillOpenTo`, which is tied to keyboard open and close events. ## Changelog [General] [Fixed] - Prevent ScrollView From Stealing Responder Capture When Using Physical Keyboard Pull Request resolved: #29798 Test Plan: Validated that on react-native-windows, ScrollView will capture responder events when tapped and a soft-keyboard is open, but will not capture events when clicking from a TextView to a child of a ScrollView and no soft keyboard is open. Reviewed By: kacieb Differential Revision: D23426786 Pulled By: TheSavior fbshipit-source-id: 7138ef0bc4508aaec5531f455b022b105b5d858a
1 parent b231e3a commit 93e7a7a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Libraries/Components/ScrollResponder.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ const ScrollResponderMixin = {
223223
// and a new touch starts with a non-textinput target (in which case the
224224
// first tap should be sent to the scroll view and dismiss the keyboard,
225225
// then the second tap goes to the actual interior view)
226-
const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
227226
const {keyboardShouldPersistTaps} = this.props;
228227
const keyboardNeverPersistTaps =
229228
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
@@ -240,7 +239,7 @@ const ScrollResponderMixin = {
240239

241240
if (
242241
keyboardNeverPersistTaps &&
243-
currentlyFocusedTextInput != null &&
242+
this.keyboardWillOpenTo !== null &&
244243
e.target != null &&
245244
!TextInputState.isTextInput(e.target)
246245
) {

0 commit comments

Comments
 (0)