【发布时间】:2016-01-31 02:12:07
【问题描述】:
有没有办法在 React Native 中设置视图背后的整体背景颜色?例如,如果我使用marginTop: 30 设置视图样式,则视图上方会有一个空白区域。我想知道是否有办法改变这种背景颜色?
renderStoriesListView() {
if (this.state.dataSource.getRowCount() === 0) {
return (
<Loading>top stories</Loading>
)
} else {
return (
<View style={{marginTop: 30, backgroundColor: 'black'}}>
<RefreshableListView
dataSource={this.state.dataSource}
renderRow={this.renderStory}
loadData={this.loadTopStories}
refreshDescription="Refreshing top stories"
refreshingIndictatorComponent={<Refreshing />}
/></View>
)
}
},
render() {
return this.renderStoriesListView()
}
})
【问题讨论】:
-
寻求代码帮助的问题必须在问题本身中包含重现它所需的最短代码。见How to create a Minimal, Complete, and Verifiable example
标签: javascript ios css react-native