我有Props接口ViewProps从 React Native扩展的组件,即:
export interface Props extends ViewProps {
// Custom props
}
Run Code Online (Sandbox Code Playgroud)
自然地,这扩展了style道具。有一个警告,我正在使用Animated.View并具有这样的风格:
style={{
opacity: animationCharacter.interpolate({
inputRange: [0, 1],
outputRange: [0, 1]
}),
transform: [
{
scale: animationCharacter.interpolate({
inputRange: [0, 1],
outputRange: [1.2, 1]
})
}
]
}}
Run Code Online (Sandbox Code Playgroud)
我认为该interpolate调用与来自 的样式类型不兼容ViewProps,但AnimatedViewProps我无法扩展。
这里有解决方案还是我必须设置style: any?