You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To address the issue of a small swipe range on iOS with the react-native-reanimated-carousel, you can try adjusting the windowSize parameter in the useVisibleRanges hook. Increasing the windowSize can effectively increase the swipe range by allowing more items to be considered within the swipe range.
Here's an example of how you might adjust the windowSize:
import{useVisibleRanges}from'path-to-useVisibleRanges';consttotalItems=images.length;// Total number of items in the carouselconstviewSize=width;// Size of each view/itemconsttranslation=useSharedValue(0);// Shared value for translationconstvisibleRanges=useVisibleRanges({total: totalItems,viewSize: viewSize,windowSize: 5,// Increase this value to increase the swipe rangetranslation: translation,loop: true,// Set to true if you want the carousel to loop});
Additionally, you might want to explore the maxScrollDistancePerSwipe prop, which can limit the maximum distance the carousel can scroll in a single swipe. Adjusting this prop might also help in achieving the desired swipe behavior on iOS [1].
<View style={{ flex: 1, marginTop: Platform.OS == 'android' ? height / 8 : height / 6.5, marginBottom: 40, borderRadius: 10, }} > <Carousel loop width={width * 1} height={width / 2} autoPlay autoPlayInterval={5000} data={images} renderItem={({ item }) => ( <Pressable style={styles.banner} onPress={() => navigation.navigate('Banner')}> <Image source={item} style={styles.imgBanner} /> </Pressable> )} /> </View>
I am using:
"react-native-gesture-handler": "~2.20.2",
"react-native-reanimated": "~3.16.1",
"react-native-reanimated-carousel": "^4.0.2",
When I do a horizontal swipe on android everything works fine. For IOS the range that can be swiped and right pressed is around the top of the photo
The text was updated successfully, but these errors were encountered: