Upgrading from v2.x
ModalOptions.shouldAnimateOut has been dropped
ModalOptions.shouldAnimateOut has been droppedModalOptions.animateOut has a new mandatory callback argument
ModalOptions.animateOut has a new mandatory callback argumentimport { Animated } from 'react-native'
import type { ModalOptions } from 'react-native-modalfy'
const animate = (
animatedValue: Animated.Value,
toValue: number,
callback?: () => void,
) => {
Animated.spring(animatedValue, {
toValue,
damping: 10,
mass: 0.35,
stiffness: 100,
overshootClamping: true,
restSpeedThreshold: 0.001,
restDisplacementThreshold: 0.001,
useNativeDriver: true,
}).start(({ finished }) => {
if (finished) callback?.()
})
}
const defaultOptions: ModalOptions = {
animationIn: animate,
animationOut: animate,
transitionOptions: (animatedValue) => ({
opacity: animatedValue.interpolate({
inputRange: [0, 1, 2],
outputRange: [0, 1, 0.9],
}),
}),
}
// ...Last updated