Provide functional example how to use custom buttons
ludgerey opened this issue · 4 comments
There is an example how to use custom buttons, but as far as I can tell this example is not functional.
Current examle: https://github.com/Jacse/react-native-app-intro-slider/blob/master/examples/examples/CustomPagination/index.tsx
I don't know how to get those button to work.
In what way is it not functional? Do the buttons now show up at all, are they not clickable or?
Sorry. I pasted the wrong example!
I am talking about this: https://github.com/Jacse/react-native-app-intro-slider/blob/master/examples/examples/CustomButtons/index.tsx
The buttons have no click handler and apparently there is no other magic that make them work. So the buttons seem to do nothing when pressing on them.
Functional component:
const slider = useRef();
return(
<AppIntroSlider
renderItem={renderItem}
data={slides}
onDone={onDone}
showNextButton={true}
ref={(ref) => (slider.current = ref)} // the ref
/>
);
onPress={() => slider.current.goToSlide(1, true)}
and if you want to go to the next route without having to hardcode the index:
onPress={() =>
refSlider.current.goToSlide(refSlider.current.state.activeIndex + 1)
}