【问题标题】:React Native and Flexbox ViewsReact Native 和 Flexbox 视图
【发布时间】:2015-08-05 17:28:43
【问题描述】:

我正在尝试在生成的 cmets 列表上方添加一个 TouchableHighlight + View。我似乎无法让 cmets 的开始更接近 TouchableHighlight 结束的位置(它在文本之后结束,下面没有填充/边距)。

这里是相关的 JSX:

  renderListView: function() {
    return (
      <View style={styles.container}>
      <TouchableHighlight onPress={this.onSelect}>
      <View style={styles.header}>
        <Text style={styles.text}>
        Visit Site
        </Text>
      </View>
      </TouchableHighlight>
      <ListView
        dataSource={this.state.dataSource}
        renderRow={this.renderCommentCell}
        style={styles.commentListView} />
      </View>
      )
  },

这是我的styles.js:

container: {
  flex: 1,
  marginTop: 65,
  backgroundColor: '#FFFFFD',
  flexDirection: 'column',
},
commentListView:{
  margin: 0,
  marginTop: 10,
  marginRight: 15,
  padding: 0,
  backgroundColor: '#FFFFFD',
},
centering: {
  alignItems: 'center',
  justifyContent: 'center',
  height: 80
},
header: {
  alignItems: 'center',
  flexDirection: 'row',
  flex: 1
},
loadingText: {
  fontSize: 75,
  textAlign: 'center',
  marginTop: 75,
  marginBottom: 10,
  marginRight: 10,
  color: '#D6573D'
},
text: {
  textAlign: 'center',
  flexDirection: 'row',
  justifyContent: 'center',
  alignSelf: 'stretch',
  fontSize: 40,
  flex: 1
}

另外,这是我看到的截图:

【问题讨论】:

    标签: css flexbox react-native


    【解决方案1】:

    automaticallyAdjustContentInsets={false} 添加到您的ListView

    【讨论】:

    • 谢谢!正是我需要的。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-15
    • 2020-05-20
    • 2019-05-30
    • 1970-01-01
    • 2021-05-30
    • 1970-01-01
    • 2020-07-27
    相关资源
    最近更新 更多