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

Active slide delay Android #92

Closed
AndrePech opened this issue Jun 30, 2017 · 4 comments
Closed

Active slide delay Android #92

AndrePech opened this issue Jun 30, 2017 · 4 comments

Comments

@AndrePech
Copy link

I have noticed that the selected slide takes a while to show as active.

For example, on Android, when executing snapToItem(index) the carousel scrolls nicely to the desired slide, but it takes around 3 seconds for it to show as active.

I am using the example code.
No problem on iOS thought.

@bd-arc
Copy link
Contributor

bd-arc commented Jul 2, 2017

Hi @AndrePech,

I haven't been able to reproduce the issue so far. Have you tested on different Android devices?

Can you try adding the following to your <Carousel /> and see if it helps?

animationFunc={'spring'}
animationOptions={{
    friction: 4,
    tension: 40,
    isInteraction: false,
    useNativeDriver: true
}}

@AndrePech
Copy link
Author

AndrePech commented Jul 3, 2017

Thanks @bd-arc

EDIT 2: Figured out the problem, I was displaying around 20 slides, that seems too heavy for the Carousel.... I Tested with 5 slides and its very good now. But Unfortunately I will have to look for another solution, since I need to display more than 20 slides on my app.

The effect got better but it still taking around 2s to activate the "slide";
EDIT:
Actually it is taking around 2 to 3 seconds for it to call onSnapToItem() when a slide is selected;

I might be doing something wrong o my side:

(the code below is the way it worked better, on iOS it is very smooth)

<Carousel
              ref={(carousel) => { this._carousel = carousel; }}
              itemWidth={itemWidth}
              sliderHeight={300}
              enableMomentum={false}
              decelerationRate={0.1}
              activeSlideOffset={1}
              scrollEndDragDebounceValue={0.1}
              removeClippedSubviews={false}
              onSnapToItem={(index)=>this.onSnapToItem(index)}
              sliderWidth={sliderWidth}
              showsHorizontalScrollIndicator={false}
              containerCustomStyle={styles.carousel_container}
              animationFunc={'timing'}
              animationOptions={{
                friction: 4,
                tension: 40,
                isInteraction: false,
                useNativeDriver: true
              }}>
          {this.Slides(this.state.slides_list)}
        </Carousel>);

I will try to test on other Android Devices, I am trying to achieve the same very smooth effect from the showcase app, with the animation starting as soon as the slide enters the screen. I will keep trying and let you know if something changes.

@bd-arc
Copy link
Contributor

bd-arc commented Jul 5, 2017

@AndrePech Were you, by any chance, testing in debug mode? Because carousel's performances are crappy on Android when JS Dev Mode is activated.

Regarding the number of slides, I've used it with 15 really graphic slides on an old Android device without any issue. Still, you might be interested in knowing that I will probably release next week a FlatList implementation that should solve performance issues when displaying large numbers of slides.

@AndrePech
Copy link
Author

@bd-arc Holy s***t I am really sorry, I is working wonder now.

Yes, I was JS DEV mode indeed, I was pretty sure it was off that did even check it. MY BAD.
hahaha, I will stick with this library.

Thank you very much and sorry again.

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

No branches or pull requests

2 participants