Communicate with your Apple Watch apps over the React Native bridge.
Note: This library does not allow you to write your Apple Watch apps in React Native but rather allows your RN iOS app to communicate with a watch app written in Obj-C/Swift.
http://mtford.co.uk/react-native-watch-connectivity/
npm install react-native-watch-connectivity
# or
yarn add react-native-watch-connectivitycd ios && pod install- React Native 0.76+
- iOS 13.4+
import {
sendMessage,
useReachability,
usePaired,
useInstalled,
} from 'react-native-watch-connectivity';
function App() {
const reachable = useReachability();
const paired = usePaired();
const installed = useInstalled();
const onPress = () => {
sendMessage({ text: 'Hello from React Native!' }, (reply) => {
console.log('Watch replied:', reply);
});
};
return (
// ...
);
}git clone https://github.com/mtford90/react-native-watch-connectivity.git
cd react-native-watch-connectivity/example
yarn install
cd ios && pod install && cd ..
yarn iosTo run the watch app, open example/ios/WatchConnectivityExample.xcworkspace in Xcode.
This library has been successfully used in Expo apps (Bare Workflow with EAS Build).