[react-native]无效的道具“高度”提供给“视图”

cit*_*ice 2 android react-native

我有一个观点:

<View style={{height:this.state.pan.y}}></View>
Run Code Online (Sandbox Code Playgroud)

初始化状态:

  ...
  constructor(props){
    super(props);
    this.state = {pan:new Animated.ValueXY()};
  }
  ...
Run Code Online (Sandbox Code Playgroud)

它引发错误:

Failed prop type: Invalid prop `height` supplied to `View`.
Bad object: {
  "height": 0
}
Run Code Online (Sandbox Code Playgroud)

但如果我设置:

<View style={{height:0}}></View>
Run Code Online (Sandbox Code Playgroud)

它为什么有效?

cit*_*ice 6

抱歉,我的错误,我应该使用Animated.View标签,而不是View。