react-native-3dcube-navigation icon indicating copy to clipboard operation
react-native-3dcube-navigation copied to clipboard

Trigger transition onPress?

Open mmckinley8 opened this issue 2 years ago • 2 comments

Is there a way to trigger the transition when the screen is press, similar to Instagram stories

mmckinley8 avatar May 05 '22 16:05 mmckinley8

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

zehfernandes avatar May 12 '22 08:05 zehfernandes

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> );
}

rahillakhani avatar Aug 24 '22 09:08 rahillakhani