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#
API#
The 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:
Arguments#
- factoryis a worklet that receives the interaction state as the first argument, and returns props that should be animated.
- idis a unique string to identify the parent- MotiPressablecomponent whose interaction state you're trying to access.
- depsis a dependency array, just like- useMemo
Returns#
Animated props, to be passed a Reanimated or Moti component's animatedProps prop.
Web#
animatedProps 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.