Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an equivalent of :hover in react-native-web?

I'm trying to make a react-native app using expo, since expo and metro bundler are compatible with react-native-web, I get my web view and Android/IOS with almost the same code. How can I do something like the equivalent of css :hover in there? Since there's no css and styles are done in Javascript objects like this and later converted to html css elements? Is there a built-in functionality for this or do I need to use a library?

const styles = StyleSheet.create({

  element: {
    backgroundColor: "#fff",
    margin: 20,
  }
})

like image 801
Navid Nami Avatar asked Jan 30 '26 17:01

Navid Nami


1 Answers

react-native-web supports hover based events in a Pressable via the onHoverIn and onHoverOut props. You can find an example in their docs: https://necolas.github.io/react-native-web/docs/pressable/

like image 174
Kipnoedels Avatar answered Feb 01 '26 10:02

Kipnoedels



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!