I've been using TouchableOpacity
for ease of use in my react native project, but I'm interested in trying the new Pressable
component instead - given how flexible its API is.
However, while the new Pressable
API gives me the ability to change things like style
props based on a pressed
state easily, there is no smooth/animated transition like there is with the opacity in TouchableOpacity
! Instead, the transition happens instantly when pressed/unpressed.
What is the best way to use Pressable
but also make a nice, smooth transition between the pressed/unpressed style changes? I assume I'll have to use the Animated
API in some way? Does anyone have an example of this?