React-native-firebase: [馃悰] Invariant Violation: Native module cannot be null. - RNFBNativeEventEmitter

Created on 17 Sep 2020  路  7Comments  路  Source: invertase/react-native-firebase


Issue



I had tried to use the migration from v5 to latest release and it works fine. But my current concern is the jest --coverage test, which failing on my end.

react-native
"react": "16.9.0",
"react-native": "0.61.5",
package.json>dependencies:
"@react-native-firebase/analytics": "^7.6.2",
"@react-native-firebase/app": "^8.4.2",
"@react-native-firebase/crashlytics": "^8.4.4",
screenshot

Screen Shot 2020-09-17 at 11 17 32 AM


Project Files






Javascript

Click To Expand

#### `package.json`:

# N/A
#### `firebase.json` for react-native-firebase v6:
# N/A
### iOS
Click To Expand

#### `ios/Podfile`: - [x ] I'm not using Pods - [] I'm using Pods and my Podfile looks like: - [x] Autolink in Podfile.lock on installation `pod install`

Installing Firebase (6.30.0)
Installing FirebaseAnalytics (6.7.2)
Installing FirebaseCore (6.10.0)
Installing FirebaseCoreDiagnostics (1.5.0)
Installing FirebaseCrashlytics (4.4.0)
Installing FirebaseInstallations (1.7.0)
Installing RNFBApp (8.4.2)
Installing RNFBAnalytics (7.6.2)
Installing RNFBCrashlytics (8.4.4)
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `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:**

 OUTPUT GOES HERE
- **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `e.g. 5.4.3` - **`Firebase` module(s) you're using that has the issue:** - `e.g. Instance ID` - **Are you using `TypeScript`?** - `Y/N` & `VERSION`




Needs Triage Bug

All 7 comments

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

Hey @mechazod any lucks on this one? I am getting the exact same issue and the reference on #4081 doesn't work for me.

@kevinlin505 What solution I did was installing the new version of Firebase v6+ via yarn, then I removed some conflicting libraries and back again after successful install. Also removed all old firebase v5.

Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.

As mentioned by @mikehardy

4081

mocking NativeEventEmitter worked for me,

jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')

You may also like this, it's slowly grown more full-featured and it is what we use internally when we jest test the module itself

https://github.com/invertase/react-native-firebase/blob/master/jest.setup.ts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonaseck2 picture jonaseck2  路  3Comments

escobar5 picture escobar5  路  3Comments

ODelibalta picture ODelibalta  路  3Comments

Draccan picture Draccan  路  3Comments

joecaraccio picture joecaraccio  路  3Comments