Skip to content

Commit

Permalink
Fix KeyboardAvoidingView not aware of the keyboard closing after it i…
Browse files Browse the repository at this point in the history
…s unmounted
  • Loading branch information
QichenZhu committed Oct 25, 2024
1 parent 44c9260 commit 968c348
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions patches/react-native+0.75.2+018+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 968c348

Please sign in to comment.