React Native - flex, ScrollView and dynamic height not filling screen React Native - flex, ScrollView and dynamic height not filling screen reactjs reactjs

React Native - flex, ScrollView and dynamic height not filling screen


I think, you have to adjust contentInset prop of ScrollView when you expand(increase height) and collpase(decrease height) your contents.

...<ScrollView    automaticallyAdjustContentInsets={false}    contentInset={{top:0, bottom: this.state.contentInsetBottom }} >...

You can have some predefined values something like,

const bottom_initial = 0;const arbitrary_move_value = 100;

In you state,

this.state={  contentInsetBottom: bottom_initial}

When you expand or collapse, calculate appropriate move value and change the contentInset.

this.setState({  contentInsetBottom: arbitrary_move_value})

This is just the idea. You have to calculate appropriate contentInset. Hope this helps.