A lightweight and flexible onboarding flow for React Native powered by Reanimated.
Built around a headless core:
- horizontal paging
- animated background interpolation
- onboarding state & hooks
- safe area support
- fully custom UI support
Optional helper components are included for rapid setup.
- Horizontal onboarding pager
- Reanimated-powered scroll tracking
- Background color interpolation between slides
- Headless architecture
- Compound API
- Safe area support
- Shared onboarding context
- Per-slide progress hooks
- Optional helper UI components
- TypeScript support
- Expo compatible
- React Native New Architecture compatible
npm install @ahmat-2000/react-native-onboarding
Install peer dependencies:
npm install react-native-reanimated react-native-safe-area-context react-native-worklets| Package | Version |
|---|---|
| react | >= 19 |
| react-native | >= 0.83 |
| react-native-reanimated | >= 4 |
| react-native-safe-area-context | >= 5 |
| react-native-worklets | >= 0.7 |
Add the Reanimated plugin inside your Babel config.
module.exports = {
presets: ["babel-preset-expo"],
plugins: ["react-native-reanimated/plugin"],
};Wrap your app with:
import { SafeAreaProvider } from "react-native-safe-area-context";
export default function App() {
return (
<SafeAreaProvider>
<Root />
</SafeAreaProvider>
);
}import { Text, View } from "react-native";
import { Onboarding } from "@ahmat-2000/react-native-onboarding";
export default function App() {
return (
<Onboarding onDone={() => console.log("done")}>
<Onboarding.Slide backgroundColor="#dbeafe">
<View style={{ flex: 1, justifyContent: "center" }}>
<Text>Welcome</Text>
</View>
</Onboarding.Slide>
<Onboarding.Slide backgroundColor="#fce7f3">
<View style={{ flex: 1, justifyContent: "center" }}>
<Text>Features</Text>
</View>
</Onboarding.Slide>
<Onboarding.Bottom>
<Onboarding.SkipButton />
<Onboarding.Dots />
<Onboarding.NextButton />
</Onboarding.Bottom>
</Onboarding>
);
}This library separates:
- onboarding behavior
- onboarding UI
The core handles:
- paging
- navigation
- scroll state
- progress interpolation
- slide state
Helpers are optional.
You can build a completely custom onboarding experience using hooks and React Native primitives.
core/
├── OnboardingRoot.tsx
├── Slide.tsx
├── context.ts
├── hooks.ts
└── types.ts- horizontal pager
- onboarding state
- animated scroll handling
- context provider
- background interpolation
- navigation methods
- slide container
- per-slide context
- slide progress integration
- useOnboarding()
- useSlide()
- useSlideProgress()
helper/
├── Bottom.tsx
├── Dots.tsx
├── NextButton.tsx
└── SkipButton.tsxHelpers are intentionally lightweight and replaceable.
They exist for convenience, not to impose a design system.
<Onboarding>
<Onboarding.Slide />
<Onboarding.Bottom>
<Onboarding.SkipButton />
<Onboarding.Dots />
<Onboarding.NextButton />
</Onboarding.Bottom>
</Onboarding>You are not required to use helpers.
import {
OnboardingRoot,
Slide,
useOnboarding,
} from "@ahmat-2000/react-native-onboarding";
function Footer() {
const { index, count, goNext, isLast, onDone } =
useOnboarding();
return (
<View>
<Text>
{index + 1} / {count}
</Text>
<Button
title={isLast ? "Done" : "Next"}
onPress={() => {
if (isLast) {
onDone();
} else {
goNext();
}
}}
/>
</View>
);
}
export default function App() {
return (
<OnboardingRoot onDone={() => {}}>
<Slide backgroundColor="#dbeafe">
<View />
</Slide>
<Slide backgroundColor="#fce7f3">
<View />
</Slide>
<Footer />
</OnboardingRoot>
);
}Access onboarding state and navigation.
const {
index,
count,
isFirst,
isLast,
goNext,
goPrev,
goTo,
} = useOnboarding();Access current slide metadata.
const { index } = useSlide();Returns a Reanimated derived value normalized between:
-1 → previous
0 → centered
+1 → nextPerfect for:
- parallax
- opacity
- scale
- translate animations
| Prop | Type | Description |
|---|---|---|
| onDone | () => void | Called when onboarding completes |
| onSkip | () => void | Optional skip callback |
| style | ViewStyle | Root style |
| contentContainerStyle | ViewStyle | Root container style |
| scrollViewProps | ScrollViewProps | Additional scroll props |
| testID | string | Test identifier |
| Prop | Type |
|---|---|
| backgroundColor | string |
| animated | boolean |
| style | ViewStyle |
TypeScript definitions are bundled with the package.
No additional typings required.
Compatible with:
- Expo
- Expo Router
- Expo Dev Client
- React Native CLI
- Headless first
- UI optional
- Minimal API surface
- Strong TypeScript support
- Predictable behavior
- Easy customization
- Production-ready defaults
Issues and PRs are welcome.
GitHub:
MIT © Ahmat Mahamat