I want to use ScrollTo ( https://reactjsexample.com/scroll-to-a-position-in-react/ )but I need an onClick in order to do so. Howether I want to place it inside a Text , so I can only use onPress. While I could create a View, It would not have the same visual effect (the little hand when you hover over the text) . Does anyone know how to use ScrollTo with onPress or how to have the hand with onClick?
CodePudding user response:
To have the hand over the input you can use css styles, it's very simple to do, just place this in your StyleSheet:
cursor: pointer;
In order to use ScrollTo you just have to follow the tutorial that you linked. If you want to do it for react-native then you won't be able to have the hand icon but to scroll you would use the reanimated library and do something like this: https://docs.swmansion.com/react-native-reanimated/docs/api/nativeMethods/scrollTo/