Library not Compatible with React Native 0.65.1 - Keyboard.removeListener is not a function
See original GitHub issueHi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch react-native-gifted-chat@0.16.3
for the project I’m working on.
Solving this issue: https://github.com/FaridSafi/react-native-gifted-chat/issues/2090 and https://github.com/FaridSafi/react-native-gifted-chat/issues/2094
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-gifted-chat/lib/MessageContainer.js b/node_modules/react-native-gifted-chat/lib/MessageContainer.js
index 193772a..637fdc9 100644
--- a/node_modules/react-native-gifted-chat/lib/MessageContainer.js
+++ b/node_modules/react-native-gifted-chat/lib/MessageContainer.js
@@ -63,10 +63,10 @@ export default class MessageContainer extends React.PureComponent {
};
this.detachKeyboardListeners = () => {
const { invertibleScrollViewProps: invertibleProps } = this.props;
- Keyboard.removeListener('keyboardWillShow', invertibleProps.onKeyboardWillShow);
- Keyboard.removeListener('keyboardDidShow', invertibleProps.onKeyboardDidShow);
- Keyboard.removeListener('keyboardWillHide', invertibleProps.onKeyboardWillHide);
- Keyboard.removeListener('keyboardDidHide', invertibleProps.onKeyboardDidHide);
+ Keyboard.addListener('keyboardWillShow', invertibleProps.onKeyboardWillShow).remove();
+ Keyboard.addListener('keyboardDidShow', invertibleProps.onKeyboardDidShow).remove();
+ Keyboard.addListener('keyboardWillHide', invertibleProps.onKeyboardWillHide).remove();
+ Keyboard.addListener('keyboardDidHide', invertibleProps.onKeyboardDidHide).remove();
};
this.renderTypingIndicator = () => {
if (Platform.OS === 'web') {
This issue body was partially generated by patch-package.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:8
Top Results From Across the Web
react native - _reactNative.Keyboard.removeListener is not ...
Now I started to get this exception while trying to navigate between screens: _reactNative.Keyboard.removeListener is not a function. enter ...
Read more >Keyboard
The Keyboard module allows you to listen for native events and react to them, as well as make changes to the keyboard, like...
Read more >react-native-gifted-messenger
react -native-gifted-chat library is not compatible with React Native 0.65.1 ... Upgrade react native project to 0.65.1 to reproduce the following error:.
Read more >react-native-cli | Yarn - Package Manager
React Native is distributed as two npm packages, react-native-cli and react-native . ... Fixed regression: @jest/create-cache-key-function dependency was ...
Read more >[Solved]-_reactNative.Keyboard.removeListener is not a ...
Coding example for the question _reactNative.Keyboard.removeListener is not a function-React Native.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That looks like it’ll cause memory leaks. As the events are being added in the function above. So effectively the initial ones are never removed.
Here’s the patch I went with
Sorry, but this issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. BTW Thank you for your contributions 😀 !!!