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

Time:10-11

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

CodePudding user response:

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/

  • Related