Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

The animation does not trigger when react native clicks for the first time

$
0
0

Why does the animation effect I set always have no effect when I click it for the first time? and What is the typescript of ref binding animation in react native?

const Test = () => {  const messRef: any = React.useRef(new Animated.Value(0)).current;  const [show, setShow] = React.useState<boolean>(false);  return (<View><Animated.Text        onPress={() => {          Animated.timing(messRef, {            toValue: show ? 200 : 0,            duration: 1000,            useNativeDriver: false,          }).start();          setShow(!show);        }}        style={{          color: messRef.interpolate({            inputRange: [0, 100],            outputRange: ["orange", "blue"],          }),        }}>        Everything you do in life stems from either fear or love</Animated.Text></View>  );};

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>