You could solve it with styling a view, in which you put the Flatlist and styling the view with the attribute height. For example height: "85%".
<View style={styles.list}>
<FlatList ... />
</View>
const styles = StyleSheet.create({
list: {
...
Height: "85%",
},
If you want a bit more flexability, you can look at the following.
(I had two lists which should use the space equally, or if only one was shown, the complete space exclusive the headers)
For that I used minHeight and maxHeight. (One alone didn't want to work)
<View>
<Header1 />
<View style={ this.state.showValids && this.state.showInvalid ? styles.validViewHalved : styles.validView }>
{ this.state.showValid &&
<View style={styles.list}>
<FlatList ... />
</View>
}
</View>
</View>
<View>
<Header2 />
<View style={ this.state.showValid && this.state.showInvalid ? styles.invalidViewHalved : styles.invalidView }>
{ !this.state.showInvalid &&
<View style={styles.list}>
<FlatList ... />
</View>
}
</View>
</View>
const styles = StyleSheet.create({
validView: {
...
minHeight: "0%",
maxHeight: "93%",
},
invalidView: {
...
minHeight: "0%",
maxHeight: "93%",
},
validViewHalved: {
...
minHeight: "0%",
maxHeight: "50%",
},
invalidViewHalved: {
...
minHeight: "0%",
maxHeight: "50%",
},
list: {
...
//height: "85%",
},