necolas / react-native-web

Cross-platform React UI packages
https://necolas.github.io/react-native-web
MIT License
21.63k stars 1.79k forks source link

Export useHover hook #2168

Closed elliotdickison closed 1 year ago

elliotdickison commented 2 years ago

Is your feature request related to a problem? Please describe.

I'd like to add hover effects to non-Pressable items (specifically we've got a swipeable carousel and we'd like to show arrows on hover on desktop where horizontal scrolling is less intuitive).

Describe a solution you'd like

Exporting the existing useHover hook would be perfect.

Describe alternatives you've considered

Copying the source of the hook, building our own alternative, or jerry-rigging some CSS.

Additional context

That's about it!

necolas commented 1 year ago

While I agree that it would be useful, the current design of useHover is "legacy", and React Native can't currently expose features like this. But we're working on ways to make RN more web-like, where abstractions like useHover could one day be developed in user space and work across both web and native.