Richard Kho
Richard Kho

Reputation: 5286

React Native and Flexbox Views

I'm trying to have a TouchableHighlight + View above this list of generated comments. I can't seem to bring the start of the comments closer up to where the TouchableHighlight ends (it ends right after the text, no padding/margin below).

Here's the relevant 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>
      )
  },

And here's my 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
}

Additionally, here's a screenshot of what I'm seeing:

enter image description here

Upvotes: 1

Views: 1206

Answers (1)

tadeuzagallo
tadeuzagallo

Reputation: 2522

Add automaticallyAdjustContentInsets={false} to your ListView

Upvotes: 3

Related Questions