Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to RN 0.65.1 causes tabs to fail with _reactNative.Keyboard.removeListener is not a function #3801

Open
mrozanski opened this issue Sep 30, 2021 · 0 comments

Comments

@mrozanski
Copy link

Version

Tell us which versions you are using:

  • react-native-router-flux v4.2.0
  • react v17.0.2
  • react-native v0.65.1
  • react-navigation/tabs v2.11.1

Expected behaviour

Using Tabs works

Actual behaviour

Using tabs generates a runtime fatal error when certain scenes are opened

Steps to reproduce

  1. Setup a rect-native project using the indicated versions
  2. Use Tabs
  3. Attempting to open certain scenes causes a fatal with the following error mesage:
ERROR  TypeError: _reactNative.Keyboard.removeListener is not a function. (In '_reactNative.Keyboard.removeListener('keyboardDidShow', this._handleKeyboardShow)', '_reactNative.Keyboard.removeListener' is undefined)

This error is located at:
    in NavigationContainer (at Router.js:97)
    in App (at Router.js:122)
    ...

I can't pinpoint what specifically makes some scenes to trigger this error while others don't but the reason is pretty obvious:

From RN v0.65.0 changelog:
https://github.com/react-native-community/releases/blob/master/CHANGELOG.md#v0650

Keyboard no longer inherits from NativeEventEmitter, so it no longer implements removeAllListeners, and removeSubscription. (1049835b50 by @yungsters)

https://github.com/react-navigation/tabs is using Keyboard.removeListener in at least 10 different places.

I know it is a problem with the tabs package but the fact that the current stable version of react-native-router-flux depends on it makes this a problem for users of react-native-router-flux
I don't see any solution other than patching react-navigation/tabs, but their repo has been archived, so I'm hesitant about going that route just for a temporary fix that will never make it to their mainline.

If anyone has run into this and has any suggested workaround or working patch, I'd really appreciate knowing what you did.

Another issue from a different project with similar observed behavior: facebook/react-native#32217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant