Invariant Violation: `new NativeEventEmitter()` requires a non-null argument
After I add this modal I started to get the error Invariant Violation: new NativeEventEmitter() requires a non-null argument

info Fetching system and libraries information... System: OS: macOS 12.5 CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz Memory: 1.75 GB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm Watchman: 2022.12.26.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
@Etaliya it's really hard to understand what's going on, since you are not providing any type of information about your system nor repro steps.
Can you run npx react-native info and paste the content in a comment there?
Also, can you add clear, reproducible steps so that a person not using your project can verify the error?
Which platform are you targeting? From the error, it looks like that the NativeEventEmitter has been initialized with null.
If we crawl the stacktrace, the referred file is PushNotificationIOS.js.
Here, it specify that it will return null as NativeEventEmitter parameter only if the platform is not iOS.
Could you provide a repro for this error?
@kelset I just integrate this dependency and set module-resolver in babel.config.js file and the run project and got this error.
var path = require('path');
module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: [ ['@babel/plugin-proposal-decorators', {legacy: true}], [ 'module-resolver', { root: ['.'], resolvePath(sourcePath, currentFile) { if ( sourcePath === 'react-native' && !( ( currentFile.includes('node_modules/react-native/') || // macos/linux paths currentFile.includes('node_modules\react-native\') ) // windows path ) && !( currentFile.includes('resolver/react-native/') || currentFile.includes('resolver\react-native\') ) ) { return path.resolve(__dirname, 'resolver/react-native'); } return undefined; }, }, ], ], };
Can you run npx react-native info and paste the content in a comment there?
Also, why would you manually add this dependency in your project?
@kelset info Fetching system and libraries information... System: OS: macOS 12.5 CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz Memory: 1.75 GB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm Watchman: 2022.12.26.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.17 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.6 => 0.70.6 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found
why did you manually add react-native-deprecated-modules in your project? what is the use case?
Hey @Etaliya how did you solve it? please help