In the rare case that you want more customization over pressable state, you can use
useInterpolateMotiPressable. As the name implies, it lets you interpolate based on the current interaction state of a parent
If you're passing a unique
id prop to your pressable, you can also isolate this hook to that pressable.
Say the parent pressable has
id="menu", and you want to isolate this hook to the
Then, in the
useInterpolateMotiPressable returns an
Animated.DerivedValue. You can also type it with a generic:
Just like any derived value, you can read the value it returns with
useMemo, you can also pass in a dependency array as the last argument:
The following usages are valid:
If there's a unique MotiPressable component with an
id prop as the parent:
factoryis a worklet that receives the interaction state as the first argument, and can return whatever it wants.
idis a unique string to identify the parent
MotiPressablecomponent whose interaction state you're trying to access.
depsis a dependency array, just like
A derived value, which you can use in Reanimated worklets.