I've recently started to work on react native, I'm trying to integrate react-native-bluetooth-classic to my project. https://kenjdavidson.com/react-native-bluetooth-classic/api-overview/
However, I'm stuck on this error:
"TypeError: null is not an object (evaluating 'this._nativeModule.isBluetoothEnabled')
This error is located at: in Untitled (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer"
I have installed the component with
yarn add react-native-bluetooth-classic --save and
npx pod-install
The linking seems fine.
I'm copying this example from the library https://github.com/kenjdavidson/react-native-bluetooth-classic-apps/blob/1cba89aaa1181998dbcab7a9549a88a9bb5071a1/BluetoothClassicExample/App.js#L57. However, is a class component and I would like use function component (so maybe it's that the problem)
Inside my useeffect
useEffect(() => {
let enabled = RNBluetoothClassic.isBluetoothEnabled();
My RNBluetoothClassic object is NULL and it gave me this error
TypeError: null is not an object (evaluating 'this._nativeModule.isBluetoothEnabled')
from my understanding it should have created it with the import
import RNBluetoothClassic, { BluetoothEventType } from 'react-native-bluetooth-classic';
So I think is a linkage problem or maybe I can't call a class component.
Someone has any idea? note at the moment I'm trying to test on android