nick / react-native-carousel

Carousel component for react-native
MIT License
458 stars 107 forks source link

Use getWidth() and wrapping children to have consistent width #63

Open njpearman opened 8 years ago

njpearman commented 8 years ago

I was trying to get a full-width carousel, which wasn't that easy. This might be an improvement, as it assumes full width if no explicit width is set on the Carousel, and pulls that width through as appropriate if it is set.

The wrapping of the children means that they all have consistent width without the width having to be set explicitly. The only thing I don't like about this is creating another View node in the process.

This could be carried further by listening for orientation changes and then pushing the change in width down the component tree.