race604 / react-native-viewpager

[Deprecated] ViewPager component for React Native
1.41k stars 373 forks source link

Doesn't work in a ScrollView #35

Open eklavya opened 8 years ago

eklavya commented 8 years ago

No matter what I do, I can't seem to make it work in a ScrollView. It doesn't show up except the dots part. I have tried all sorts of flex settings, height etc. Please help.

race604 commented 8 years ago

I haven't test this in ScrollView. I'll try it latter.

eklavya commented 8 years ago

Thanks for the prompt reply @race604 :)

artem-russkikh commented 8 years ago

@eklavya, add contentContainerStyle prop to your ScrollList component, something like that:

<ScrollView contentContainerStyle={{ width: Dimensions.get('window').width, height: 200 }} >
  <ViewPager
    isLoop={true}
    autoPlay={true}
    dataSource={this.state.dataSource}
    renderPage={this._renderPage}/>
</ScrollView>
eklavya commented 8 years ago

thanks @artem-russkikh but this breaks many other things. Besides changing height for anything useful with viewpager results in unusable ScrollView :(

sercanov commented 8 years ago

+1

duduzai commented 8 years ago

@eklavya you can do like this <View style={{height:200}}> <ViewPager >...</ViewPage></View>,it's work for me.

amin3mej commented 7 years ago

+1