Expo config plugin for react-native-bare-kit. Handles all native scaffolding so you can use Bare Kit in a managed Expo workflow.
npm install expo-bare-kit react-native-bare-kit
Add the plugin to your app.json (or app.config.js):
{
"expo": {
"plugins": [
[
"expo-bare-kit",
{
"ios": {
"notifications": {
"worklet": "push.bundle"
}
},
"android": {
"notifications": {
"worklet": "push.bundle",
"googleServices": "google-services.json"
}
}
}
]
]
}
}
Then run prebuild:
npx expo prebuild
Enable by setting ios.notifications to an object. Omit or set to null to skip.
[
"expo-bare-kit",
{
"ios": {
"notifications": {
"worklet": "push.bundle",
"targetName": "NotificationServiceExtension"
}
}
}
]
| Option | Type | Default | Description |
|---|---|---|---|
worklet | string | required | Path to the push notification worklet bundle |
targetName | string | 'NotificationServiceExtension' | Name of the Xcode extension target |
Enable by setting android.notifications to an object. Omit or set to null to skip.
[
"expo-bare-kit",
{
"android": {
"notifications": {
"worklet": "push.bundle",
"googleServices": "google-services.json",
"channelId": "default",
"channelName": "Notifications"
}
}
}
]
| Option | Type | Default | Description |
|---|---|---|---|
worklet | string | required | Path to the push notification worklet bundle |
googleServices | string | required | Path to google-services.json from Firebase |
channelId | string | 'default' | Android notification channel ID |
channelName | string | 'Notifications' | Display name for the notification channel |
The worklet is a JavaScript file that runs in a Bare runtime when a push notification arrives. It must be bundled with bare-pack before use:
npx bare-pack --preset <ios|android> --out push.bundle push.js
Example push.js:
// BareKit is a global provided by the Bare runtime
BareKit.on('push', (payload, reply) => {
const { data } = JSON.parse(payload)
reply(
null,
JSON.stringify({
title: data.title || 'Notification',
body: data.body || 'New message received'
})
)
})
The worklet receives the push payload as a JSON string and must reply with a JSON string containing title and body.
This package re-exports everything from react-native-bare-kit:
import { Worklet } from 'expo-bare-kit'
Apache-2.0