React Native how to make an action when a user first puts their finger on a screen and then (without lifting it) goes over a pressable which activates

124 views Asked by At

I am building a React Native app and I am trying to make it so that when a user can slide their finger from a place not on the pressable to the pressable without lifting their finger and when the finger is over the pressable an action happens. How can I do that?

1

There are 1 answers

1
RubenSmn On

You can use the onHoverIn prop on the Pressable see the React Native Pressable docs

<Pressable onHoverIn={() => console.log("entered me")}>
  <Text>Enter me</Text>
</Pressable>

See here a Snack Expo preview