# React Native macOS Example A native macOS host for `@mentra/bluetooth-sdk`, using the existing Expo Modules bridge and SDK React hooks. This is not the iOS example running on Apple silicon via TestFlight. ## Requirements - macOS 14+, Xcode, CocoaPods, Node 20.19.4+ and Bun 1.4. - React Native macOS 0.83.0 with React Native 0.83.6, React 19.2.0 and Expo SDK 55, the same React Native and Expo versions as the phone examples. - A Bluetooth-capable Mac for real device testing. Microsoft's Expo Modules integration is experimental. Keep `react-native-macos` on the release line matching the `react-native` version. Expo SDK 55's `expo-modules-core` redeclares `UIApplication` on macOS, which React Native macOS 0.83 already declares; `examples/patches` backports the upstream `expo-modules-core` fix until an SDK 55 release includes it. ## Run From the MentraOS root: ```bash cd examples bun install cd bluetooth/react-native-macos/macos pod install cd .. bun run macos ``` In MentraOS, this example builds against the SDK source. It is a member of the `examples/` Bun workspace ([`examples/package.json`](../../package.json)), which links `@mentra/*` (`workspace:*`) to the SDK source in `mobile/modules` and `cloud-v2/packages` and keeps one Expo / React Native version for all the examples. Install from `examples/`; installing also runs the linked packages' `prepare` scripts, which build them. Metro, TypeScript, and CocoaPods all resolve the SDK from that source folder. `metro.config.js` watches `examples/node_modules`, `mobile/modules` and `cloud-v2/packages` so Metro can serve those files. To run Metro separately: ```bash bun run start --port 8091 ``` ```bash RCT_METRO_PORT=8091 bun run macos --no-packager ``` `bun run typecheck` checks the sample with React Native macOS host types. Podfile.lock is not committed. Do not run `expo prebuild` here. The checked-in Mac host is generated by `react-native-macos`, with Expo Modules autolinking added to the Podfile. Expo's phone config plugin does not generate a native Mac target. ## Sample Scope - Scan for Mentra Live, select a device, connect and disconnect. - Request a photo at a webhook URL and display the returned `photoUrl`. - Check OTA availability and display status events. The sample does not start an update or duplicate the full phone OTA presentation. - Read state with `useMentraBluetooth()` and listen to native SDK events. The checked-in Info.plist and entitlements provide Bluetooth, microphone and local-network usage descriptions plus sandbox networking. Microphone recording still requires explicit permission from the host app. Native macOS has no `AVAudioSession`, iOS background modes, or ANCS notification relay. Select the system audio output and join glasses hotspot Wi-Fi through macOS. `otaLocalNetwork` remains Android-only. This example does not claim that the entire Mentra Engine or every Expo package supports macOS. For native Swift integration, see [`../macos`](../macos/README.md). ## Pull Request CI The `React Native macOS example` job in MentraOS's `Example App Builds` workflow installs the `examples/` workspace, type checks the sample against the SDK source, installs CocoaPods, and builds the native app in Release mode. It also verifies that the resulting app contains `main.jsbundle`; no running Metro server is needed. It does not upload a Mac app or use release signing keys.