react-native-swiper: Doesn't fit inside container unless width/height are hard-coded
I’d like the Swiper to take up the full size of its parent View
element. Approaches:
- If I don’t specify
width
andheight
attributes, theSwiper
element extends outside the parent container to full-screen (gets size from device properties?). - Styling the container doesn’t appear to have any effect.
- If I hard-code
width
andheight
attributes it will sit inside the container, but I don’t want to hard-code these numbers.
If the container is indeed flex:1
, I’d expect it to expand to the parent container size rather than the full screen dimensions. Is there a way to achieve this?
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 15 (1 by maintainers)
Okay, so this is horrendously ugly on multiple fronts, but depending on how many times you need to do this… This does work for me… I’m basically just measuring the parent container after it renders (plus a timeout), then just hard-coding it anyway. It’s really not great. Forgive the ES6/7 notation, but it should be reasonably straightforward. Let me know if not. Or if you have a better solution.