-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
🔥[🐛] [SOLVED v11.1.2] react-native 0.64 compatibility (was database TypeError: _SharedEventEmitter.default.once is not a function) #5027
Comments
Very strange - but it worked before (in react-native < 0.64?)
For now it's clear react-native-firebase is not compatible with react-native 0.64. |
Note that a successful fix must also make sure types are in harmony with firebase-js-sdk where possible as mentioned by @brandonpearcy |
For anyone following along, this also affects auth APIs and probably many others, I'm working on this now, but I mention this so that people don't mistakenly think it is database specific, it is a forward-porting need across the entire react-native-firebase package
|
Got lucky-ish, turns out it was just those two (database and auth) that were using the API removed in the react-native 0.64 breaking changes. Not so bad: c2de179 I posted a PR that I'm 99% handles the forward-port of the library correctly, and if anyone could test it you can just pull the patch-package zip that we make for all PRs from the artifacts list on the Github Actions run: https://github.com/invertase/react-native-firebase/pull/5042/checks?check_run_id=2126589516 It may take another day or so to get the test app fully working with react-native 0.64 and I don't want to merge the forward port without either a) hearing confirmation that it is working for people or So feedback will be welcome and might speed things up so everyone can start using hermes ;-) Cheers |
@mikehardy It worked for us! 🚀🔥 🥳 🙌 Huge thanks for tackling this so quickly. We all really appreciate it! |
Great to hear, thank you. CI actually passed on iOS and Android with the non-Hermes engines so this may be ready for release - using those patches at least should be fine and patch-package is great of course, it'll let you know when it's time to evict them. Hermes should be fine if you intend to use it but that's a new thing so be sure to test if so. Cheers |
Okay, the javascript code is working now, I still need to investigate the types though, here's our standard (firebase-js-sdk): I don't want to use Object (that's the Record<string, any> bit we have), but you are correct that there should be a union of type possibilities here. I'll patch that up. |
This does not change the underlying implementation which should still be correct with the updated types, it only copies in the type definitions from firebase-js-sdk so we stay in sync with them Related #5027 - the type-related part of that issue
I just posted a fix to the types file to close this out fully, v11.1.2 here should be released today, I'll just wait for CI to settle down first then hit the publish button. Patches will show up here https://github.com/invertase/react-native-firebase/pull/5046/checks?check_run_id=2133507792 and I think will include the react-native 0.64 forward port plus the type fix, as the patches are generated from "latest published" version and the types PR is based on the RN64 work |
This does not change the underlying implementation which should still be correct with the updated types, it only copies in the type definitions from firebase-js-sdk so we stay in sync with them Related #5027 - the type-related part of that issue
@mikehardy This is not fixed please check! |
@mikehardy i have raised the new ticket for this ! |
Issue
After updating react-native from 0.63.4 to 0.64.0, calls to realtime database's
Reference.on
throw a run-time TypeError:It appears that commenting out the
cancelCallbackOrContext
parameter prevents the TypeError from being thrown, so there's something strange going on there. Looking at the TS type definition foron
, it looks like the type forcancelCallbackOrContext
doesn't match what I would expect. I would have expected it to be(e: Error) => void | Record<string, any>
instead ofRecord<string, any>
Example min repro code:
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:11.1.0
Firebase
module(s) you're using that has the issue:database
TypeScript
?N
& ``React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: