Skip to content

SearchBar Keyboard.removeListener #3213

@roffelund

Description

@roffelund

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-elements@3.4.2 for the project I'm working on.

Keyboard.removeListener is Deprecated and caused a crash in Android for us. Keyboard.removeAllListeners resolves the issue.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js b/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js
index 1bfd2b4..3ecd35c 100644
--- a/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js
+++ b/node_modules/react-native-elements/dist/searchbar/SearchBar-android.js
@@ -85,7 +85,7 @@ class SearchBar extends Component {
         Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
     }
     componentWillUnmount() {
-        Keyboard.removeListener('keyboardDidHide', this._keyboardDidHide);
+        Keyboard.removeAllListeners('keyboardDidHide');
     }
     render() {
         var _a;

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions