this._nativeModule.addListener is not a function. (In 'this._nativeModule.addListener(eventType)', 'this._nativeModule.addListener' is undefined)
See original GitHub issueMobile Device Environment
- Device:Android
- OS: API28
Application Environment
- React Native version: v0.61.5
- RN Bluetooth Classic version: v0.10.9
Describe the bug
It was working perfectly. I deleted my node_modules folder, rebuilt it using yarn
and ran yarn android
and for some reason, I started getting this error whenever I tried to access the listener - whether it was add or remove
To Reproduce
useEffect(() => {
RNBluetoothClassic.addListener(
BTEvents.BLUETOOTH_CONNECTED,
device => onConnected(device),
)
return () => {
RNBluetoothClassic.removeAllListeners(BTEvents.BLUETOOTH_CONNECTED)
}
}, [])
Expected behavior To add and remove listeners without this error
Screenshots
Additional context Tried re-installing, changing versions and searching the web, nothing seems to solve the issue - any help would be appreciated
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)
Top Results From Across the Web
this._nativeModule.addListener is not a function (iOS, RN v0 ...
I'm encountering this issue when upgrading to v0.27.2 (iOS) I think I have the same issue as this: fbsamples/f8app#62.
Read more >this._nativeModule.addListener is undefined - Stack Overflow
addListener is not a function ... this._nativeModule.addListener is undefined. I tried everything and also rm -rf node_modules then nom ...
Read more >Upgrading to 0.30.0 Unhandled JS Exception - React Native
Upgrading to 0.30.0 Unhandled JS Exception: this._nativeModule.addListener is not a function. (In this._nativeModule.addListener ). Nicolas Charpentier.
Read more >ScalablyTyped/community - Gitter
@oyvindberg I've just noticed that SlinkyTyped is not published to bintray. ... _nativeModule = nativeModule; } } addListener( eventType: string, ...
Read more >Updates - Expo Documentation
Updates.addListener(listener) ... Adds a callback to be invoked when updates-related events occur (such as upon the initial app load) due to auto-update settings ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
the
this._nativeModule
looks like it’s being set. Sadly it looks like non of the@ReactMethod
methods are being added from the Androidpublic interface RCTEventEmitter
. If they’ve changed something within Android that stops the Interface@ReactMethod
from being pulled into the bridged module, then this is going to have to be completely re-written sadly.This shouldn’t be an issue any more in the current version, I’ve removed and reworked the Android native code so that the
EventEmitter
logic is all within theModule
. I’m not a big fan of it, but Facebook seems to not give a shit with regards to the issue that was opened there.So we’ll leave it as an internal fix.