Update ANIMATED.md

This commit is contained in:
Marc Rousavy 2021-02-23 09:43:47 +01:00 committed by GitHub
parent 6863876763
commit bcdf30fa9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,24 +30,24 @@ import Reanimated, {
useAnimatedProps, useAnimatedProps,
useSharedValue, useSharedValue,
withSpring, withSpring,
} from "react-native-reanimated"; } from "react-native-reanimated"
const ReanimatedCamera = Reanimated.createAnimatedComponent(Camera); const ReanimatedCamera = Reanimated.createAnimatedComponent(Camera)
Reanimated.addWhitelistedNativeProps({ Reanimated.addWhitelistedNativeProps({
zoom: true, zoom: true,
}); })
export const App = () => { export function App() {
const zoom = useSharedValue(0); const zoom = useSharedValue(0)
const onRandomZoomPress = useCallback(() => { const onRandomZoomPress = useCallback(() => {
zoom.value = withSpring(Math.random()); zoom.value = withSpring(Math.random())
}, []); }, [])
const animatedProps = useAnimatedProps<Partial<CameraProps>>( const animatedProps = useAnimatedProps<Partial<CameraProps>>(
() => ({ zoom: zoom.value }), () => ({ zoom: zoom.value }),
[zoom] [zoom]
); )
return ( return (
<> <>