mergeAnimateProp worklet makes it easy to build custom components on top of
Say you want to build a
PressableScale component, which changes to
scale: 0.96 when it's pressed.
You might start by making it like this:
However, this entirely overrides the
animate prop you pass to
mergeAnimateProp comes in. Pass it the interaction state,
animate prop, and any overrides you want.
And in your component:
Then, you can use it like so:
You can also use
mergeAnimateProp in children components, with hooks like
interactionrequired: the current interaction state, given to you by the
overrides will always supercede any values in