Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ado/templates/apple-node-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Task Group: Brew install node version
#
steps:
- script: 'brew uninstall [email protected] && rm -rf /usr/local/etc/openssl && rm -rf /usr/local/etc/[email protected]'
displayName: Fix Homebrew

- script: 'brew bundle'
displayName: 'brew bundle'

Expand Down
32 changes: 28 additions & 4 deletions Libraries/Components/ScrollResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const ScrollResponderMixin = {

if (
this.props.keyboardShouldPersistTaps === 'handled' &&
currentlyFocusedInput != null &&
this.scrollResponderKeyboardIsDismissible() &&
e.target !== currentlyFocusedInput
) {
return true;
Expand Down Expand Up @@ -224,7 +224,6 @@ const ScrollResponderMixin = {
// and a new touch starts with a non-textinput target (in which case the
// first tap should be sent to the scroll view and dismiss the keyboard,
// then the second tap goes to the actual interior view)
const currentlyFocusedTextInput = TextInputState.currentlyFocusedInput();
const {keyboardShouldPersistTaps} = this.props;
const keyboardNeverPersistTaps =
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
Expand All @@ -241,7 +240,7 @@ const ScrollResponderMixin = {

if (
keyboardNeverPersistTaps &&
currentlyFocusedTextInput != null &&
this.scrollResponderKeyboardIsDismissible() &&
e.target != null &&
!TextInputState.isTextInput(e.target)
) {
Expand All @@ -251,6 +250,31 @@ const ScrollResponderMixin = {
return false;
},

/**
* Do we consider there to be a dismissible soft-keyboard open?
*/
scrollResponderKeyboardIsDismissible: function(): boolean {
const currentlyFocusedInput = TextInputState.currentlyFocusedInput();

// We cannot dismiss the keyboard without an input to blur, even if a soft
// keyboard is open (e.g. when keyboard is open due to a native component
// not participating in TextInputState). It's also possible that the
// currently focused input isn't a TextInput (such as by calling ref.focus
// on a non-TextInput).
const hasFocusedTextInput =
currentlyFocusedInput != null &&
TextInputState.isTextInput(currentlyFocusedInput);

// Even if an input is focused, we may not have a keyboard to dismiss. E.g
// when using a physical keyboard. Ensure we have an event for an opened
// keyboard, except on Android where setting windowSoftInputMode to
// adjustNone leads to missing keyboard events.
const softKeyboardMayBeOpen =
this.keyboardWillOpenTo != null || Platform.OS === 'android';

return hasFocusedTextInput && softKeyboardMayBeOpen;
},

/**
* Invoke this from an `onResponderReject` event.
*
Expand Down Expand Up @@ -325,7 +349,7 @@ const ScrollResponderMixin = {
if (
this.props.keyboardShouldPersistTaps !== true &&
this.props.keyboardShouldPersistTaps !== 'always' &&
currentlyFocusedTextInput != null &&
this.scrollResponderKeyboardIsDismissible() &&
e.target !== currentlyFocusedTextInput &&
!this.state.observedScrollSinceBecomingResponder &&
!this.state.becameResponderWhileAnimating
Expand Down
Loading