【发布时间】:2019-09-13 08:54:27
【问题描述】:
我正在尝试在我的 React Native 动画中包含一个旋转。对象应围绕其中心以“2D 方式”旋转。在标准 CSS3 transform 模型中,这将是围绕 Z 轴的旋转。
style.transform = [{
'rotateZ': animatedValue.interpolate({
inputRange: [0, 1],
outputRange: ['0rad', targetAngle + 'rad']
})
}]
只要我不使用useNativeDriver = true,这段代码就可以正常工作。所以看起来 React Native 确实希望我们使用 rotateZ 以 2D 方式旋转项目。
但是,使用useNativeDriver = true,我得到一个错误:
Property 'rotateZ' is not supported by native animated module
如何使用本机驱动程序进行这种旋转?
【问题讨论】:
标签: react-native animation react-animated