gpt4 book ai didi

react-native - 是否使用 useState react 原生动画 => new Animated.Value()?

转载 作者:行者123 更新时间:2023-12-02 02:42:45 25 4
gpt4 key购买 nike

在 react-native 中使用 Animated.Value () 的最佳方法是什么?

是否使用 useState() ?

const [fadeAnim] = useState(new Animated.Value(0))

或者
const fadeAnim = new Animated.Value(0)

react 原生文档: https://facebook.github.io/react-native/docs/animations

谢谢

最佳答案

实际上,Hook 是更好的方法,所以我会说首选

关于react-native - 是否使用 useState react 原生动画 => new Animated.Value()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58136506/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com