gpt4 book ai didi

javascript - Animated.Component/createAnimatedComponent(Component) 与 Component 有何不同?

转载 作者:可可西里 更新时间:2023-11-01 02:27:21 28 4
gpt4 key购买 nike

我们正试图从 styled-components 项目中找出以下问题的原因:https://github.com/styled-components/styled-components/issues/389

对 refs + setNativeProps 进行了一些更改,在一个地方破坏了动画,假设是因为一些动画相关信息没有被正确传递。

因此问题是了解 createAnimatedComponent 如何改变初始组件,添加了什么?如果传递不正确,什么会导致动画中断?

如果您知道可能导致此问题的原因,请提供想法/详细答案。

更新与问题相关的重大更改发生在 this file 中的某处引用 innerRef 向下传递 refisTag 函数检查它是否是原生组件。

最佳答案

animatable components can be animated. View, Text, and Image are already provided, and you can create custom ones with createAnimatedComponent. These special components do the magic of binding the animated values to the properties, and do targeted native updates to avoid the cost of the react render and reconciliation process on every frame. They also handle cleanup on unmount so they are safe by default.

https://facebook.github.io/react-native/docs/animated.html

关于javascript - Animated.Component/createAnimatedComponent(Component) 与 Component 有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41808942/

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