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

Android. Debug build do not work as production build #110

Closed
xvonabur opened this issue Aug 14, 2017 · 2 comments
Closed

Android. Debug build do not work as production build #110

xvonabur opened this issue Aug 14, 2017 · 2 comments

Comments

@xvonabur
Copy link

Hello.

I've run into the issue where android debug build is working not the same as production build.
I made a simple app which shows only one carousel item at the time. Production build works fine. But debug with enabled/disabled remote debugging is working like this:

gif

So, basically, I can move through all items in once during the first slide gesture (unexpected). But after that, I can slide only one item per sliding gesture (expected behaviour).

My code is simple:

<Carousel
  animationOptions={{
    easing: Easing.out(Easing.quad),
    duration: 350,
    isInteraction: false,
    useNativeDriver: true
  }}
  sliderWidth={Metrics.screenWidth}
  itemWidth={Metrics.screenWidth}
  inactiveSlideScale={1}
  inactiveSlideOpacity={1}
  slideStyle={styles.slide}
  decelerationRate={'fast'}
  swipeThreshold={5}
  scrollEndDragDebounceValue={10}
  onSnapToItem={ (index) => { this.setState({ currentStep: index }) } }
  ref={(carousel) => { this._carousel = carousel }}>
  {
    this.state.stepsData.map((step, index) => {
      return <StepInfo key={index} data={step} />
    })
  }
</Carousel>

I saw #34, but I would like to know whether I can do with my code to fix this behaviour. Am I missing something?

@bd-arc
Copy link
Contributor

bd-arc commented Aug 16, 2017

Hi @xvonabur,

ScrollView's performance on Android while debugging is everything but ideal. Unfortunately there is nothing we can do about it since React Native doesn't offer a proper scroll callback for its component. This means that when momentum is disabled (the default behavior), we have to rely on onScrollEndDrag and a bunch of hacks to make it work. In debug mode, onScrollEndDrag is apparently triggered a bit late, just enough to let you scroll through multiple slides...

Still, here are a few things you could try:

  • disabling JS Dev Mode in the dev menu, which usually result in a huge performance boost on Android
  • setting scrollEndDragDebounceValue to 0 for your debug build
  • setting enableMomentum to true for your debug build so that the callback will be triggered on onMomentumScrollEnd instead of onScrollEndDrag. Note that you will be able to scroll through multiple slides, but the callback might be more reliable.

Let me know if any of this helped!

@xvonabur
Copy link
Author

Thanks, @BR-arC.

I've already tried all your suggestions, but unfortunately neither of them suits me. It's not a big deal for me, cause production build is fine. I will use it for testing. It's really annoying to see such android only limitations, through. Hopefully some day things will be better.

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

2 participants