有没有办法在React Native中呈现的视图后面设置整体backgroundColor?例如,如果我使用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()
}
})
答案 0 :(得分:0)
试试这个......
<View style={{backgroundColor: 'black'}}>
<View style={{marginTop: 30}}>
<RefreshableListView
dataSource={this.state.dataSource}
renderRow={this.renderStory}
loadData={this.loadTopStories}
refreshDescription="Refreshing top stories"
refreshingIndictatorComponent={<Refreshing />}
/></View></View>