【发布时间】:2018-01-13 14:36:37
【问题描述】:
我正在使用 React Native,现在知道 Image 不能再包含子组件。
问题是我正在使用这样的动画组件:
return (
<Animated.Image source={this.props.image}
style={[styles.top, borderStyles, {
width: this.state.top_width,
height: this.state.top_height,
transform: this.state.top_pan.getTranslateTransform()
}]}>
{back}
</Animated.Image>
)
另一种方法是使用 ImageBackground,但是当我尝试将上面的代码转换为使用如下自定义动画时:
var AnimatedImage = Animated.createAnimatedComponent(ImageBackground)
return (
<AnimatedImage
source={this.props.image}
style={[styles.top, borderStyles, {
width: this.state.top_width,
height: this.state.top_height,
transform: this.state.top_pan.getTranslateTransform()
}]}
>
{back}
</AnimatedImage>
)
现在在更新由 RCTView 管理的视图的属性“不透明度”时会出错
在动画中使用 ImageBackground 以适应 RN 0.50 重大变化的正确方法是什么?
【问题讨论】:
-
你能解决吗?我有同样的问题
标签: react-native