How to use custom components in Onboarding
mainFor complete control over the UI, you can replace default elements with custom components.
introPanel: Pass a function that receivesonPressStart.steps: Pass acomponentfunction that receivesonNext,onBack, andisLast.background: Pass a function that returns aReactNodeto render behind the content.skipButton: Pass a function that receivesonPressto customize the close/skip button.
<Onboarding
introPanel={({ onPressStart }) => (
<CustomWelcomeScreen onStart={onPressStart} />
)}
background={() => (
<Image
source={require('./assets/background.png')}
style={StyleSheet.absoluteFillObject}
/>
)}
skipButton={({ onPress }) => (
<TouchableOpacity onPress={onPress}>
<Text>✕</Text>
</TouchableOpacity>
)}
steps={[
{
component: ({ onNext, onBack, isLast }) => (
<CustomStepComponent
onNext={onNext}
onBack={onBack}
isLast={isLast}
/>
),
image: require('./assets/step1.png'),
position: 'top',
},
]}
/>