Embedding Bare as a separate thread in a mobile application is easy with Bare Kit. Using Bare Kit and React Native, you can run the same JavaScript as on desktop.
-
Install all the dependencies:
npm install -
Run your app using on iOS:
npm run iosor on Android:
npm run android -
Open the DevTools to see the console.
Pressjfrom the CLI.
import { Worklet } from 'react-native-bare-kit'
// ...
const worklet = new Worklet()
worklet.start('/app.js', `
const { IPC } = BareKit
IPC.setEncoding('utf8')
IPC.on('data', (data) => console.log(data))
IPC.write('Hello from Bare!')
`)
const { IPC } = worklet
IPC.setEncoding('utf8')
IPC.on('data', (data: string) => console.log(data))
IPC.write('Hello from React Native!')