I can use ViewPagerAndroid, but when I put it under a ScrollView component nothing gets rendered. Did anyone encounter this before?
React-Native: version 0.22 Platform: Android
This works as expected:
<ViewPagerAndroid style={{flex: 1}} initialPage={0}>
<View><Text>View 1</Text></View>
<View><Text>View 2</Text></View>
<View><Text>View 3</Text></View>
</ViewPagerAndroid>;
The following renders nothing:
<ScrollView style={{flex: 1}}>
<ViewPagerAndroid style={{flex: 1}} initialPage={0}>
<View><Text>View 1</Text></View>
<View><Text>View 2</Text></View>
<View><Text>View 3</Text></View>
</ViewPagerAndroid>
</ScrollView>
I created an issue on github too: #6469
It is an old question but I also faced simmilar issue and solved it by adding contentContainerStyle={{ flex: 1 }} to scrollview tag. E.g.
<View style={{ flex: 1 }}>
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ flex: 1 }}>
<ViewPagerAndroid style={{ flex: 1 }} initialPage={0}>
<View><Text>View 1</Text></View>
<View><Text>View 2</Text></View>
<View><Text>View 3</Text></View>
</ViewPagerAndroid>
</ScrollView>
{/*some other views*/}
<View style={{ height: 20, width: null, flex: 1 }}/>
</View>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With