Update ANIMATED.md
This commit is contained in:
parent
6863876763
commit
bcdf30fa9d
@ -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 (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user