【发布时间】:2021-08-12 15:54:27
【问题描述】:
我在 flex 中的 react-native 中使用了我的滚动视图,它可以在 web 上运行,但它不能在我的 android 手机上运行
这是我的代码-
render() {
return (
<View style={styles.root}>
<ScrollView contentContainerStyle={{flex: 1 }}>
<View style={styles.box1} >
</View>
<View style={[styles.box2, { height: this.state.height }]} />
<View style={styles.box1} >
<TouchableOpacity onPress={() => this.setState({ height: this.state.height + 50 })}>
<Text>Click me to grow the purple section</Text>
</TouchableOpacity>
</View>
</ScrollView>
</View>
);
}
}
这是我的样式表 -
const styles = StyleSheet.create({
root: {
flex: 1,
flexDirection: 'column',
backgroundColor: '#fff',
},
box1: {
height: 200,
backgroundColor: 'blue'
},
box2: {
height: 200,
backgroundColor: 'purple'
}
});
【问题讨论】:
标签: react-native flexbox scrollview