微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – Animated.Component / createAnimatedComponent(Component)如何与Component不同?

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

有一些修改对于在一个地方打破动画的setNativeProps做了一些修改,假设因为一些动画相关信息没有被正确传递.

因此,了解createAnimatedComponent如何改变初始组件的问题,添加什么?如果没有正确传递,会导致动画破坏?

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

UPDATE
关于这个问题的突破变化发生在this file年的某个地方,参考innerRef传递下来的ref,isTag函数检查它是否是一个本机组件.

解决方法

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

原文地址:https://www.jb51.cc/js/154426.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐