question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

firstItem not working on Android

See original GitHub issue

Is this a bug report, a feature request, or a question?

bug report

Have you followed the required steps before opening a bug report?

Have you made sure that it wasn’t a React Native bug?

yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Android

Is the bug reproductible in a production environment (not a debug one)?

yes

Environment

Environment: React: 16.0.0-beta.5 React native: 0.51 react-native-snap-carousel: 3.3.4

Target Platform: Android (6.0) iOS (11) –>

(Write your answer here.)

Expected Behavior

scroll to item number specified in firstItem

Actual Behavior

does not scroll

Reproducible Demo

  1. use firstItem on android.

This might be related to https://stackoverflow.com/questions/33208477/react-native-android-scrollview-scrollto-not-working

I fixed it when using scrollTo in my component in a hacky way by introducing a 200ms delay or so on android.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
AshishCdcommented, Mar 19, 2019

Hey @eoghanmccarthy please use useScrollView into your Carousel component, it will solve your problem.

<Carousel data={photos} renderItem={this._renderItem} sliderWidth={sliderWidth} itemWidth={itemWidth} firstItem={this.state.selectedIndex} contentContainerCustomStyle={styles.sliderContentContainer} layout={"default"} loop={true} onSnapToItem={slideIndex => this.setState({ selectedIndex: slideIndex }) } useScrollView />

0reactions
dohooocommented, Oct 8, 2021

Sorry, please allow me to advertise for my open source library! ~ I think this library react-native-reanimated-carousel will solve your problem. It is a high performance and very simple component, complete with React-Native reanimated 2

Read more comments on GitHub >

github_iconTop Results From Across the Web

firstItem not working · Issue #63 · meliorence/react-native-snap ...
Hey, I'm having an issue with setting firstItem. Most of the time, the wrong item is selected. We are using a function which...
Read more >
Why is the first item in the Spinner not working - Stack Overflow
ArrayAdapter aa = new ArrayAdapter(this,R.layout.languagespinner,countries); aa.setDropDownViewResource(android.R.layout.
Read more >
Change Switch Access settings - Android Accessibility Help
Open your device's Settings app . Open Accessibility and then Switch Access and then Settings. Assign switches for scanning. When you set up...
Read more >
Lists and grids | Jetpack Compose - Android Developers
By default, each item's state is keyed against the position of the item in the list or grid. However, this can cause issues...
Read more >
RecyclerView Recipes: Snap to first item - ProAndroidDev
It's also the first article in a series about the not so trivial RecyclerView ... The latest posts from Android Professionals and Google...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found