Expo is a platform for rapidly and easily developing React Native apps, and they have added experimental support for Bluetooth! Here's a step-by-step guide to setting up and building a functioning Bluetooth app for iOS.
Add dependencies: expo add react-native-ble-plx @config-plugins/react-native-ble-plx expo-dev-client
Add @config-plugins/react-native-ble-plx
to a plugins
array in your app.json
:
{
"expo": {
"name": "react-native-bluetooth-example",
"plugins":[
"@config-plugins/react-native-ble-plx"
],
...
}
Setup the core code from https://github.com/t3db0t/react-native-bluetooth-example
[App.js](<https://github.com/t3db0t/react-native-bluetooth-example/blob/main/App.js>)
Test on physical device (BLE doesn't exist on simulators)
expo run:ios -d
or expo run:android -d
expo run
it will prompt you for a bundle identifier.expo run
converts your project from a "managed" expo workflow to a "bare" workflow.Open the app in Expo Go
If necessary: Setup XCode and provisioning