useMotiPressableAnimatedProps()
If you've used useAnimatedProps
from react-native-reanimated
before, then this will look familiar. It serves the same purpose, with the added feature of using the hovered
and pressed
states.
#
Usage#
APIThe following usages are valid:
If there's a unique MotiPressable component with an id
prop as the parent, then pass id
as the first argument:
#
Argumentsfactory
is a worklet that receives the interaction state as the first argument, and returns props that should be animated.id
is a unique string to identify the parentMotiPressable
component whose interaction state you're trying to access.deps
is a dependency array, just likeuseMemo
#
ReturnsAnimated props, to be passed a Reanimated or Moti component's animatedProps
prop.
#
WebanimatedProps
cannot be used with animate
on the same prop on Web.
If you need to do both, please split your usage into two components; one that receives the animate
prop, and another that receives animateProps
. This is a limitation in Reanimated 2.