How do I add a button at the end of items in ListView in ReactNative?

advertisements

This is what I tried but "Show unlinked tags" appears at the bottom, not after the last item.

render() {

return (
  <View style={styles.container}>
    <Text style={styles.title}> Settings Children </Text>
      <ListView
      dataSource={this.state.dataSource}
      renderRow={(rowData)=> <Text>{rowData}</Text>}
      />
      <View style={styles.button}>
        <Text style={styles.buttonText}>Show unlinked tags</Text>
      </View>

  </View>

)
}

View image!


you can use renderFooter to render view after your list.

renderFooter = () => {
  return (
    <View style={styles.button}>
      <Text style={styles.buttonText}>Show unlinked tags</Text>
    </View>
  )
}
render() {

return (
  <View style={styles.container}>
    <Text style={styles.title}> Settings Children </Text>
    <ListView
      dataSource={this.state.dataSource}
      renderRow={(rowData)=> <Text>{rowData}</Text>}
      renderFooter={this.renderFooter}
    />
  </View>
)
}