Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

React Native – fill remaining height of a View

<ScrollView contentContainerStyle={{flexGrow: 1}}>
    <View></View>
    <View><LinearGradient></LinearGradient></View>
</ScrollView>

How do i make the second View or the LinearGradient to fill the remaining height. I don’t have specific height set on the first View. I’ve tried flex: 1 for the second view but it still doesn’t work.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Adding flex to your second view works:

 <ScrollView contentContainerStyle={{ flexGrow: 1 }}>
    <View></View>
    <View style={{ flex: 1, backgroundColor: "red" }}>{Other content here}</View>
  </ScrollView>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading