react-native-3dcube-navigation
react-native-3dcube-navigation copied to clipboard
Trigger transition onPress?
Is there a way to trigger the transition when the screen is press, similar to Instagram stories
Yes! You can add onPress event and use the this.cube.scrollTo(index)
function to go to next and prev views.
https://github.com/zehfernandes/react-native-3dcube-navigation/blob/badbcfb5fe880dc963a55e26d35307f2149cb210/examples/components/CubeHorizontal.js#L25
If its a functional component
function xyz () { const pageNum =2, shouldAnimate = true; let cube = useRef(); . . . . function somFunction = () { . . . cube.current.scrollTo(pageNum, shouldAnimate); . . . }
return (
<CubeNavigationHorizontal key={0} ref={(view) => {
cube.current = view;
}}>
.
.
.
.
.
</CubeNavigationHorizontal>
);
}