diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index bd04e7d61fc52f..9746c80ddc78fb 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -1545,10 +1545,9 @@ class ScrollView extends React.Component { // 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. + // keyboard. const softKeyboardMayBeOpen = - this._keyboardMetrics != null || Platform.OS === 'android'; + this._keyboardMetrics != null || this._keyboardEventsAreUnreliable(); return hasFocusedTextInput && softKeyboardMayBeOpen; }; @@ -1562,6 +1561,12 @@ class ScrollView extends React.Component { return this._keyboardMetrics != null && this._keyboardMetrics.height === 0; }; + _keyboardEventsAreUnreliable: () => boolean = () => { + // Android versions prior to API 30 rely on observing layout changes when + // `android:windowSoftInputMode` is set to `adjustResize` or `adjustPan`. + return Platform.OS === 'android' && Platform.Version < 30; + }; + /** * Invoke this from an `onTouchEnd` event. *