React Native和Flexbox Views

时间:2015-05-23 21:46:10

标签: css flexbox react-native

我试图在生成的评论列表上方设置一个TouchableHighlight + View。我似乎无法将评论的开头靠近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
}

此外,这里是我所看到的截图:

enter image description here

1 个答案:

答案 0 :(得分:2)

automaticallyAdjustContentInsets={false}添加到您的ListView