hello guys,
I'm making a React Native app to control an ESP32 device using the react-native-ble-plx library. I have cloned and modified the BLESampleExpo example project, and I added a welcome screen when the user opens the application after that I can click on "get started", to go to the project screen: Welcome Screen.
the app works fine on the welcome page. However, when I go to the other screen, I get the following error: The Error Message From Expo.
Render Error: Cannot read property 'createClient' of null
I have tried commenting out parts of the code to know from where the issue, and I think the problem is coming from this line of code:
const bleManager = useMemo(() => new BleManager(), []);
Can anyone please help me solve this error?
I have found a lot of Stack Overflow questions about the same problem, but none of them have solved it. Is the react-native-ble-plx library still working? If not, what other library should I use?
I got the same error, and fixed it after following the config plugin react-native-ble-plx installation guide from this blog and running the development server instead of Expo Go.
To summarize:
app.config.js or app.json file: ...
"plugins": [
[
"@config-plugins/react-native-ble-plx",
{
"isBackgroundEnabled": true,
"modes": [
"peripheral",
"central"
],
"bluetoothAlwaysPermission": "Allow $(PRODUCT_NAME) to connect to bluetooth devices"
}
]
],
...
expo prebuildnpx eas build --profile developmentyarn start --dev-client, and the development server should pop up on your phone, select and run itIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With