scrollView 设置style无效

如果把顶层view的style删掉或者改成style={{flex:1}} 就是对的
求解原因???

 renderTab = ()=> {
        return (
            <View style={{width:WIDTH,height:SCALE(100),backgroundColor:'blue',flexDirection:'row', justifyContent:'space-around', alignItems:'center'}}>
            <View><Text>我发起的</Text></View>
            {(this.state.data&&this.state.data.myIsLeader===1)?<View><Text>带我审批</Text></View>:null}
            {(this.state.data&&this.state.data.myIsLeader===1)?<View><Text>我已审批</Text></View>:null}
        </View>)
    };

    render(){
        return (
            <View style={{width:WIDTH,height:HEIGHT}}>
                <ScrollView
                    style={{backgroundColor:'red',width:WIDTH,height:HEIGHT-SCALE(200)}}>

            </ScrollView>
                {this.renderTab()}
        </View>
        );
    }

希望的行为:
图片描述
实际的行为:
图片描述

版本:
react-native -v:0.46.4
node -v:v8.3.0
npm -v:5.3.0
yarn --version:0.27.5

阅读 2k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题