0

New to react native, I have a view component with flex direction as row, now it is nested with two view components with background colours pink and blue respectively. It renders as expected.
without Scrollview image

<View style={{flex:1, flexDirection:'row'}}>
    <View style ={{flex:0.3, backgroundColor: 'pink'}}>
    </View>
    <View style ={{flex:0.7, backgroundColor: 'blue'}}>
    </View>
</View>

Now if i wrap above code inside scrollView then nothing is being rendered on screen. It is trimming the empty view components.I want scrollview also should render the empty view components with background colours. with scrollview image

<View style={{flex:1}}>
    <ScrollView style={{flex:1}}>
        //above code here
    </ScrollView>
</View>

1 Answers1

2

change ScrollView style prop to contentContainerStyle like this:

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

check this link: style vs contentContainerStyle

Haidar Zeineddine
  • 979
  • 1
  • 8
  • 20
Mervzs
  • 1,114
  • 7
  • 21