Aneesh P V
Aneesh P V

Reputation: 1390

How to set the ScrollView to fit in react native?

How to set the ScrollView to "take all the remaining space" instead of setting height: XXXX ?

 <ScrollView >
         <View style={{
        flex: 1,
        flexDirection: 'column',
        justifyContent: 'space-between',
      }}>
        <View style={{width: 50, height: 50, backgroundColor: 'powderblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'skyblue'}} />
        <View style={{width: 50, height: 50, backgroundColor: 'steelblue'}} />
        </View>
           </ScrollView>

Upvotes: 1

Views: 6036

Answers (1)

Ajay Venugopal
Ajay Venugopal

Reputation: 1710

 <ScrollView contentContainerStyle={{flex:1}}>
      ...
 </ScrollView>

use contentContainerStyle for fitting the scroolView to the screen

Upvotes: 3

Related Questions