如果把顶层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