File size: 1,059 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
import { StyleSheet } from 'react-native'
import { createHost, AnimatedObject } from '@react-spring/animated'
import {
is,
Globals,
createStringInterpolator,
colors,
} from '@react-spring/shared'
import { primitives } from './primitives'
import { WithAnimated } from './animated'
import { AnimatedStyle } from './AnimatedStyle'
Globals.assign({
batchedUpdates: require('react-native').unstable_batchedUpdates,
createStringInterpolator,
colors,
})
const host = createHost(primitives, {
applyAnimatedValues(instance, props) {
if (is.und(props.children) && instance.setNativeProps) {
instance.setNativeProps(props)
return true
}
return false
},
createAnimatedStyle(styles) {
styles = StyleSheet.flatten(styles)
if (is.obj(styles.shadowOffset)) {
styles.shadowOffset = new AnimatedObject(styles.shadowOffset)
}
return new AnimatedStyle(styles)
},
})
export const animated = host.animated as WithAnimated
export { animated as a }
export * from './animated'
export * from '@react-spring/core'
|