The official Airship React Native module for iOS and Android.
Install the package:
npm install @ua/react-native-airship --save
or
yarn add @ua/react-native-airship
Apps using Expo can use the airship-expo-plugin to configure the project. You will need to use expo prebuild (custom dev client) or eas build since this package contains native code.
First, install the plugin and the main package:
expo install airship-expo-plugin
yarn add @ua/react-native-airship
Then, add the plugin to your app.json:
"plugins": [
[
"airship-expo-plugin",
{
"android": {
"icon": "./path/to/ic_notification.png"
},
"ios": {
"mode": "development"
}
}
]
]
Known Issues
launchMode to launcher in your app.json for expo-dev-client. See issue #550 for more details."plugins": [
[
"expo-dev-client",
{
"ios": { "launchMode": "launcher" },
"android": { "launchMode": "launcher" }
}
]
]
Initialize Airship in your App.tsx:
import { useEffect } from 'react';
import Airship from '@ua/react-native-airship';
export default function App() {
useEffect(() => {
const takeOff = async () => {
try {
await Airship.takeOff({
default: {
appKey: "YOUR_APP_KEY",
appSecret: "YOUR_APP_SECRET"
},
});
await Airship.push.enableUserNotifications();
} catch (error) {
console.error("Failed to take off:", error);
}
};
takeOff();
}, []);
// ... your app code
}
For a more detailed setup guide, please see the full Getting Started Documentation.
For the current Support Status of each module major, EOL dates, and the full lifecycle policy, see the Airship SDK Support Policy.