Open MetaBenji opened 5 months ago
Hey @MetaBenji! I'm Dosu, a bot that's here to help you solve bugs, answer questions, and become a contributor. Let's get to the bottom of this issue together!
To resolve the issue with react-native-reanimated-carousel
where changing the device orientation causes some items not to render when using the windowSize
prop, you should ensure that the windowSize
prop is correctly set, as the carousel will prioritize windowSize
over itemsCount
.
Additionally, a recent patch has been made to the library to re-calculate when the window size changes, which should help address rendering issues related to orientation changes:
---
'react-native-reanimated-carousel': patch
---
re-calculate when window size changed in browser.
This means that if you are experiencing rendering issues, you may need to adjust the windowSize
prop to ensure it is appropriate for the number of items and the new orientation, and ensure you are using the latest version of the library that includes this patch [1][2].
To continue talking to Dosu, mention @dosu.
I stumbled upon the same issue while using the latest beta version at this point (4.0.0-alpha.12). This seems to be indeed a bug.
@MetaBenji Found a hacky way of working around the issue by slightly changing the windowSize param when the orientation changes; not pretty, but it does the job:
import { useWindowDimensions } from 'react-native';
...
const { width, height } = useWindowDimensions();
...
...
<Carousel
ref={ref}
windowSize={width < height ? 3 : 4}
width={width}
data={data}
....
/>
same problem
Describe the bug A clear and concise description of what the bug is. If you intend to submit a PR for this issue, tell us in the description. Thanks!
To Reproduce Steps to reproduce the behavior:
Expected behavior All of the slides to render
Screenshots
Versions (please complete the following information):
Smartphone (please complete the following information):
Additional context
Note in the snippet below, the width and height props are changing when the screen orientation changes. I wonder if that is having an impact?
Code snippets: