react-native-onboarding-swiper
react-native-onboarding-swiper copied to clipboard
Replace 'skip' button with 'previous' button
Please answer me, ty
Please translate your question from Russian into English: https://www.deepl.com/translator
Is it possible to add a "prev" button?
Not 100% sure, but you may try to set onSkip
prop to a function to go the previous page. Something like:
goPev = () => {
this.flatList.scrollToIndex({
animated: true,
index:
I18nManager.isRTL && Platform.OS == 'ios'
? this.state.currentPage + 1
: this.state.currentPage - 1,
});
};
Otherwise, fork the repo change the skip handling there.
did anyone find the solution to replace skip into prev btn?
You can use
SkipButtonComponent={Skip}
where Skip is your react component.
then define Skip as
const Skip = ({ isLight, skipLabel, ...props }) => ( <TextButton {...props} textSize='font16' textColor='primary' textWeight='regular' onPress={handleOnPrev} style={{ marginLeft: 16, paddingHorizontal: 16 }}> Prev </TextButton> );
my snippet is a custom component but you should get an idea!
and finally you have to attach a state to
showSkip={showSkipState}
this state is controlled via the "pageIndexCallback"! when pageIndexCallback return 1 set showSkipState to false! else true.