【问题标题】:How to set the overall background color behind the view in React-Native如何在 React-Native 中设置视图背后的整体背景颜色
【发布时间】: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()
}
})

【问题讨论】:

标签: javascript ios css react-native


【解决方案1】:

试试这个...

<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>

【讨论】:

    猜你喜欢
    • 2015-09-28
    • 2023-03-25
    • 2021-09-16
    • 2011-01-11
    • 2017-01-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多