Reputation: 1703
I have had a play with react native creating ios apps but have not tried android yet. With android you also get 'android wear' for watches etc, will react native work creating apps for those devices?
Upvotes: 18
Views: 22456
Reputation: 5942
Github Project: https://github.com/fabOnReact/react-native-wear-connectivity
yarn add react-native-wear-connectivity
npx react-native@latest init YourMobileAppName
<!-- this file is located at android/app/src/main/AndroidManifest.xml -->
<uses-feature android:name="android.hardware.type.watch" />
yarn start --port=8082
yarn android
, open the react native dev menu and change the bundle location to your-ip:8082
(for ex. 192.168.18.2:8082
).You can now build the app with yarn android
. JS fast-refresh and the other metro functionalities work without problem.
import { sendMessage } from 'react-native-wear-connectivity';
sendMessage({ text: 'Hello watch!' });
import { watchEvents } from 'react-native-wear-connectivity';
const unsubscribe = watchEvents.on('message', (message) => {
console.log('received message from watch', message);
});
Upvotes: 1
Reputation: 158
React Native does not run on Android Wear at the current time, so you would have to do that code native.
Upvotes: 12