React-native-snap-carousel: How to vertically center items when carousel is horizontal?

Created on 21 Sep 2018  路  3Comments  路  Source: meliorence/react-native-snap-carousel

I'd like to center the items vertically in horizontal carousel.

I tried giving

contentContainerCustomStyle={{flex:1, alignItems: 'center', flexDirection: 'row' }}

to Carousel component as a prop but it doesn't seem to work as I hope.
How to vertically center items in horizontal carousel?

Currently my items(images) are aligned at the top of the screen

Is this a bug report, a feature request, or a question?

question

Have you followed the required steps before opening a bug report?

(Check the step you've followed - replace the space character between the square brackets ([]) by an x.)

Most helpful comment

@littlehome-eugene I encountered the same issue and I fixed it by settting:
<Carousel ... contentContainerCustomStyle={{ alignItems: 'center' }} />
the outer container (depends on your applicatin) I also set it to flex: 1, alignItems: 'center'

All 3 comments

@littlehome-eugene Can you please provide a Snack example in which the issue can be reproduced?

Closing as no further feedback has been provided.

@littlehome-eugene I encountered the same issue and I fixed it by settting:
<Carousel ... contentContainerCustomStyle={{ alignItems: 'center' }} />
the outer container (depends on your applicatin) I also set it to flex: 1, alignItems: 'center'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

codejet picture codejet  路  5Comments

siderakis picture siderakis  路  3Comments

KarlosQ picture KarlosQ  路  4Comments

ajonno picture ajonno  路  4Comments

sujitpk-perennial picture sujitpk-perennial  路  3Comments