我有一个组件,其Props
接口从React Native扩展到ViewProps
,即:
export interface Props extends ViewProps {
// Custom props
}
当然,这是style
props 的延伸.有一个警告,我用的是Animated.View
,风格如下:
style={{
opacity: animationCharacter.interpolate({
inputRange: [0, 1],
outputRange: [0, 1]
}),
transform: [
{
scale: animationCharacter.interpolate({
inputRange: [0, 1],
outputRange: [1.2, 1]
})
}
]
}}
我认为interpolate
呼叫与ViewProps
的样式输入不兼容,但我无法扩展AnimatedViewProps
.
这里有解决方案吗?还是我必须设置style: any
?