Install with React Native CLI
Install and link the OnboardingYak package in a bare React Native app.
Requirements#
Use React Native 0.73 or later, with a working iOS and/or Android native project. The SDK relies on React Native autolinking and the required peer dependencies.
Install packages#
npm install @onboarding-yak/react-native @react-native-async-storage/async-storage react-native-safe-area-contextOr use your package manager’s equivalent. For iOS, install pods if your project setup does not do this automatically:
npx pod-installThen rebuild the native app. Autolinking requires a native rebuild; a Metro refresh cannot load new native code.
Render the onboarding#
Add <Onboarding /> to the route or screen that should show the first-run flow. Pass the app-specific values from Studio and a local fallback flow.
import { Onboarding } from '@onboarding-yak/react-native';
import { fallbackFlow } from './fallback-flow';
export function OnboardingScreen() {
return (
<Onboarding
flowId="YOUR_APP_ID"
apiKey="oy_pub_YOUR_PUBLISHABLE_KEY"
baseUrl="https://onboardingyak.com"
fallbackFlow={fallbackFlow}
onComplete={(answers, { variables }) => {
// Continue into your app and save any answers you need.
}}
/>
);
}Run and verify#
Start Metro and run the application on a simulator or physical device. Publish a flow for the app in Studio, then relaunch the app. The dashboard analytics should record a start and screen view.