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

Invariant Violation: new NativeEventEmitter() requires a non-null argument #294

Closed
riamon-v opened this issue Dec 13, 2023 · 6 comments · Fixed by #395
Closed

Invariant Violation: new NativeEventEmitter() requires a non-null argument #294

riamon-v opened this issue Dec 13, 2023 · 6 comments · Fixed by #395
Assignees
Labels
🍎 iOS iOS specific

Comments

@riamon-v
Copy link

riamon-v commented Dec 13, 2023

Describe the bug
I just installed the package in my React Native project and wrapped my whole app into the KeyboardProvider provided.
The app can't seem to run afterwards.

The app is a bare React Native workflow implementing expo-modules-core

Here is a snippet of my package.json, maybe there is a conflict ?

"dependencies": {
    "@apollo/client": "^3.7.3",
    "@hookform/resolvers": "^2.8.8",
    "@notifee/react-native": "^7.8.0",
    "@react-native-async-storage/async-storage": "^1.17.7",
    "@react-native-clipboard/clipboard": "^1.11.1",
    "@react-native-community/blur": "^4.3.0",
    "@react-native-community/checkbox": "^0.5.9",
    "@react-native-community/datetimepicker": "^7.0.1",
    "@react-native-community/geolocation": "^3.0.1",
    "@react-native-community/netinfo": "^9.3.6",
    "@react-native-firebase/app": "^16.4.6",
    "@react-native-firebase/auth": "^16.4.6",
    "@react-native-firebase/crashlytics": "^16.4.6",
    "@react-native-firebase/messaging": "^16.4.6",
    "@react-native-firebase/perf": "^16.5.0",
    "@react-native-masked-view/masked-view": "^0.3.0",
    "@react-navigation/bottom-tabs": "^6.5.3",
    "@react-navigation/elements": "^1.3.18",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/stack": "^6.3.11",
    "@testing-library/dom": "^9.0.0",
    "@types/react": "^18",
    "@types/react-native-snap-carousel": "^3.8.5",
    "base-64": "^1.0.0",
    "creditcardutils": "^1.0.0",
    "date-fns": "^2.29.2",
    "deprecated-react-native-prop-types": "^4.0.0",
    "expo": "^48.0.0",
    "expo-barcode-scanner": "~12.3.2",
    "fetch-mock": "^9.11.0",
    "firebase": "^9.14.0",
    "geofire-common": "^6.0.0",
    "google-libphonenumber": "^3.2.32",
    "graphql": "^16.5.0",
    "i18n-js": "^4.2.2",
    "jwt-decode": "^3.1.2",
    "patch-package": "^6.4.7",
    "piano-analytics-js": "^6.6.0",
    "postinstall-postinstall": "^2.1.0",
    "prettier": "^2.8.4",
    "qrcode.react": "^3.1.0",
    "react": "18.2.0",
    "react-dom": "^18.2.0",
    "react-hook-form": "7.44.3",
    "react-idcheckio": "file:./React-Native-SmartSDK/react-idcheckio",
    "react-native": "0.71.7",
    "react-native-actionsheet": "^2.4.2",
    "react-native-adjust": "^4.33.0",
    "react-native-antelop": "file:./bridge-reactNative-2.5.0-1701947021524.tgz",
    "react-native-awesome-slider": "^2.4.4",
    "react-native-biometrics": "^3.0.1",
    "react-native-blob-util": "^0.17.3",
    "react-native-bootsplash": "^4.3.2",
    "react-native-camera": "^4.2.1",
    "react-native-code-push": "8.0.2",
    "react-native-confirmation-code-field": "^7.3.0",
    "react-native-device-info": "^10.0.2",
    "react-native-document-picker": "^8.1.4",
    "react-native-dotenv": "^3.4.2",
    "react-native-encrypted-storage": "^4.0.2",
    "react-native-exit-app": "^1.1.0",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "^2.13.0",
    "react-native-google-places-autocomplete": "^2.4.1",
    "react-native-haptic-feedback": "^2.0.3",
    "react-native-image-crop-picker": "^0.40.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keyboard-controller": "^1.9.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-map-clustering": "^3.4.2",
    "react-native-map-link": "^2.10.2",
    "react-native-maps": "^1.3.2",
    "react-native-marketingcloudsdk": "^8.0.0",
    "react-native-modal-datetime-picker": "^15.0.0",
    "react-native-pdf": "6.7.0",
    "react-native-progress": "^5.0.0",
    "react-native-qrcode-svg": "^6.1.1",
    "react-native-reanimated": "*",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-safe-area-context": "^4.3.1",
    "react-native-screen-brightness": "^2.0.0-alpha",
    "react-native-screens": "^3.19.0",
    "react-native-screenshot-prevent": "1.1.9",
    "react-native-select-dropdown": "3.3.3",
    "react-native-skeleton-placeholder": "^5.2.4",
    "react-native-svg": "^13.9.0",
    "react-native-tracking-transparency": "^0.1.2",
    "react-native-uuid": "^2.0.1",
    "react-native-vector-icons": "^9.0.0",
    "react-native-walkthrough-tooltip": "^1.4.0",
    "react-native-webview": "^12.0.2",
    "supercluster": "^7.1.4",
    "victory-native": "^36.6.8",
    "yup": "0.32.11"
  },

My App.tsx, is just a simple component with the wrapper inside, nothing fancy

Here is the error:

Screenshot 2023-12-13 at 18 19 10
@kirillzyusko
Copy link
Owner

kirillzyusko commented Dec 13, 2023

Hi @riamon-v 👋

Did you re-install pods and re-assemble app? Also similar problem was reported in #108 and #46

Maybe also worth to re-run metro and reset cache, i. e. yarn start -- --reset-cache

@kirillzyusko kirillzyusko added the 🍎 iOS iOS specific label Dec 13, 2023
@riamon-v
Copy link
Author

Hi @riamon-v 👋

Did you re-install pods and re-assemble app? Also similar problem was reported in #108 and #46

Maybe also worth to re-run metro and reset cache, i. e. yarn start -- --reset-cache

Yes I did, I deintegrated pods, reinstalled them, even deleted all derived data because, why not and I am always running the app with reset-cache flag hence why I gave the package.json because I thought a package could interfer in some sort but can't find what, could it be expo ?

@kirillzyusko
Copy link
Owner

@riamon-v I highly doubt it could be because of the expo. I mean - a lot of people were using this library with expo and didn't complain that this package had some kind of conflicts 🤷‍♂️

Would it be possible for you to use binary search (keep App.tsx with "Hello world" and remove half of your modules in package.json, if it becomes working - then restore half of removed modules, if keeps not working - then remove half of remaining modules, etc.).

I think it would be the only one way to check where is the conflict. If you figure out where is the conflict and can provide a minimal reproduction example, then for sure I will try to figure out what is going wrong and how to fix it 👀

What do you think about it?

@kirillzyusko
Copy link
Owner

@riamon-v by the way - does it happen only on iOS? Is Podile.lock gets changed when you re-install pods?

@riamon-v
Copy link
Author

@riamon-v by the way - does it happen only on iOS? Is Podile.lock gets changed when you re-install pods?

Haven't tested on Android yet, and yes my Podile.lock changes when reinstalling.

I will try to find out if there is any package that can interfere as suggested

@arekkubaczkowski
Copy link

@riamon-v have you found any solution by chance?

@kirillzyusko kirillzyusko linked a pull request Mar 20, 2024 that will close this issue
2 tasks
kirillzyusko added a commit that referenced this issue Mar 20, 2024
## 📜 Description

Avoid deep worletization of `react-native` package.

## 💡 Motivation and Context

It looks like in specific project setup babel plugin may try to
serialize entire `react-native` package (see
#393
for more context).

To avoid that in this PR I'm extracting `Platform.OS` into separate `OS`
variable, so that babel plugin will capture only value of `OS` (and not
entire `Platform` object).

Closes
#393
and
#294

## 📢 Changelog

### JS

- extract `Platform.OS` into separate `OS` variable

## 🤔 How Has This Been Tested?

Tested in the project where this error occurs.

## 📝 Checklist

- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍎 iOS iOS specific
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants