From 0a06ebf5549e0e98af38f5ff8674208f59a5acab Mon Sep 17 00:00:00 2001 From: D N <4661784+retyui@users.noreply.github.com> Date: Thu, 28 Nov 2024 19:59:51 +0100 Subject: [PATCH] chore: Update animated example --- .../react-native-web-examples/pages/animated/index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-native-web-examples/pages/animated/index.js b/packages/react-native-web-examples/pages/animated/index.js index f83c7a060..9d8e42927 100644 --- a/packages/react-native-web-examples/pages/animated/index.js +++ b/packages/react-native-web-examples/pages/animated/index.js @@ -1,19 +1,19 @@ -import React, { useRef } from 'react'; -import { Animated, Pressable, StyleSheet, Text, View } from 'react-native'; +import React from 'react'; +import { Animated, Pressable, StyleSheet, Text, View, useAnimatedValue } from 'react-native'; import Example from '../../shared/example'; export default function AnimatedPage() { - const anim = useRef(new Animated.Value(0)); + const anim = useAnimatedValue(0); const animateBox = () => { - Animated.timing(anim.current, { + Animated.timing(anim, { toValue: 1, duration: 1000, useNativeDriver: false }).start(); }; - const transform = anim.current.interpolate({ + const transform = anim.interpolate({ inputRange: [0, 1], outputRange: ['rotate(0deg)', 'rotate(45deg)'] });