Skip to content

Commit

Permalink
Merge pull request #51509 from QichenZhu/fix/48677
Browse files Browse the repository at this point in the history
Fix KeyboardAvoidingView not aware of the keyboard closing after it is unmounted
  • Loading branch information
mjasikowski authored Nov 12, 2024
2 parents be4d7f5 + bb451f5 commit 1c6d9ea
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions patches/react-native+0.75.2+020+keyboard-avoiding-view.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
index e26d677..597be5a 100644
--- a/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
+++ b/node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js
@@ -175,6 +175,13 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
}

componentDidMount(): void {
+ // Fix KeyboardAvoidingView not aware of the keyboard closing after it is unmounted.
+ // Remove this patch after the upstream fix https://github.com/facebook/react-native/commit/08bd8ac47da60121225e7b281bbf566e2c5a291e is released.
+ if (!Keyboard.isVisible()) {
+ this._keyboardEvent = null;
+ this._setBottom(0);
+ }
+
if (Platform.OS === 'ios') {
this._subscriptions = [
Keyboard.addListener('keyboardWillChangeFrame', this._onKeyboardChange),

0 comments on commit 1c6d9ea

Please sign in to comment.