UNPKG

react-native-reanimatable

Version:

Wrapper for Reanimated with an easy declarative API.

24 lines (18 loc) 429 B
import Animated from 'react-native-reanimated'; import * as objectPath from '../utils/objectPath'; export default function createDelegate(eventType, path) { const value = new Animated.Value(0); const eventMap = objectPath.map( ['nativeEvent'].concat(path), value, ); const event = Animated.event([eventMap]); function reset() { value.setValue(0); } return { event, value, reset, }; }