Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel does not swipe right when its gets to the 3 image it gets stuck #840

Open
MWaqasHussain-dev opened this issue May 29, 2021 · 10 comments

Comments

@MWaqasHussain-dev
Copy link

MWaqasHussain-dev commented May 29, 2021

Un able to swipe right when i get to the third image on android... swipe right doesnot seems to work when i am on the third image... but swipe left seems to be working perfect on android and ios

Please help me out Thanks in advance

import { View, Text, TouchableOpacity, TextInput, ScrollView, SafeAreaView, Dimensions, Image, ImageBackground } from 'react-native';
import Carousel, { Pagination } from 'react-native-snap-carousel';
import { appbaseThemeColor } from '../../contants';

const BannerCaroselSlider = () => {
    useEffect(() => {

    }, [])
    const

        [activeSlide, setActiveSlide] = useState(0),
        [bannerGridData, setBannerGridData] = useState([
            {

                image: require('../../assests/banner1.png'),


            },
            {

                image: require('../../assests/banner2.png'),


            },
            {

                image: require('../../assests/banner3.png'),


            },
            {

                image: require('../../assests/banner4.png'),
            }
        ]);
    function pagination() {
        // const { activeSlide } = activeSlide;
        return (
            <Pagination
                // activeOpacity={0.5}
                // animatedTension={0}
                // animatedFriction={0}
                // animatedDuration={10}

                dotsLength={bannerGridData.length}
                activeDotIndex={activeSlide}
                containerStyle={{
                    backgroundColor: 'rgba(0, 0, 0, 0.0)'
                }}
                dotStyle={{
                    width: 7,
                    height: 7,
                    borderRadius: 5,
                    marginVertical: 0,
                    backgroundColor: appbaseThemeColor
                }}
                inactiveDotStyle={{
                    width: 10,
                    height: 10,
                    borderRadius: 5,
                    backgroundColor: '#DEDEDE'
                }}
                inactiveDotOpacity={1}
                inactiveDotScale={0.6}

            />
        );
    }
    function _renderItem({ item, index }) {
        return (
            // <View key={index} style={{ width: "100%", aspectRatio: 2 / 1, borderWidth: 2, borderColor: "red" }} >
            //     <ImageBackground source={item.image} style={{ width: "100%", height: "100%", flexDirection: "column", justifyContent: "flex-end", paddingBottom: 20 }} resizeMode="cover" resizeMethod="auto">

            //         {pagination()}

            //     </ImageBackground>
            // </View>

            <View key={index} style={{ flex: 1, borderWidth: 0, marginBottom: 20 }} >
                <ImageBackground source={item.image} style={{ aspectRatio: 1.1 / 0.5, flexDirection: "column", justifyContent: "flex-end", }} resizeMode="contain" resizeMethod="resize">

                    {pagination()}

                </ImageBackground>
            </View>
        )
    }
    return (
        <SafeAreaView style={{marginTop:-2}}>

            <Carousel
                sliderWidth={Dimensions.get('window').width}
                itemWidth={Dimensions.get('window').width}
                data={bannerGridData}
                renderItem={_renderItem}
                onSnapToItem={(index, animation = false) => setActiveSlide(index)}
                autoplay={true}
                autoplayDelay={2000}
                autoplayInterval={2000}
                loop={true}
                activeAnimationType="decay"
            />
            {/* {pagination()} */}
        </SafeAreaView>
    )
}
export default BannerCaroselSlider;
@thevijaysoni
Copy link

Getting same issue.

@mjdelb
Copy link

mjdelb commented Jun 29, 2021

Same here. Any progress or work arounds on this?

@nawfalhaddi
Copy link

same here , any updates ?

@andrelfnavarro
Copy link

Same here. Getting this in some specific Android devices. Would appreciate some help...

@khoitruongg
Copy link

check this PR guys
#842

@andrelfnavarro
Copy link

@khoitruongg it keeps happening on some devices even when loop is not enabled. Any other tips?

@dohooo

This comment was marked as spam.

@MWaqasHussain-dev
Copy link
Author

MWaqasHussain-dev commented Oct 8, 2021 via email

@Apurvapimparkar
Copy link

This happens due to the property "loopClonesPerSide". By default the value of this property is 3 and when loop is enabled we face an issue where scroll gets stuck at 3rd image. If you try changing the number of this property, scroll gets stuck at that particular number image.
If you disable the loop; that should resolve this issue.

@BoBoooooo
Copy link

Getting same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants