Difference between Pressable and TouchableOpacity

Pressable was a new introduction to RN 0.63, prior to that,Touchable Opacity was the most common used Component to wrap a component or simliar components.

Both their basic functionalities are same, to make a text/image clickable and user interactive.

But with Pressable you get to access a lot new props like :

HitRect, which is such a cool feature, acc to docs :

Fingers are not the most precise instruments, and it is common for
users to accidentally activate the wrong element or miss the
activation area. To help, Pressable has an optional HitRect you can
use to define how far a touch can register away from the the wrapped
element. Presses can start anywhere within a HitRect.

This is clearly a better alternative to what we used for hitslop , here its more precise and you define the area.And it doesnt interfere with the child/other components Z-index too.

So basically you get all the feature of a button, touchableOpacity with cool new props. Do check out thier docs : rn-pressable

NOTE: Also as other comments in this thread suggests, Pressable still doesnt have an animation attached with the onPress Event

Hopeit helps.feel free for doubts

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)