-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
firstItem not working #63
Comments
Hey @dnish, You shouldn't have any issue when returning children from a custom method (in fact, that's the way we're doing it). Still, there might be a problem if your children are generated asynchronously. This is supposed to be handled, but you might have uncovered some dirt :) Could you share your method |
Hey, This is our getCovers method:
The getUserFiles method:
So all data is available during the render process. If I add a console.log within my render method, I get correct values:
Gives me 10 objects with the correct selected index (f.e. 9). But if 9 is selected, the cover of 8 is shown. If I select 8 or 7, it also shows the cover of 8. I've also tried this approach, but still get the same error:
Same problem also if I set a fixed value for firstItem:
8 is selected instead the last one 9. |
@dnish Thanks for the detailed info! I'll take a look at it as soon as possible. |
Hi @dnish, I'm desperately trying to reproduce the issue you are facing, but to no avail so far. I've made a short screencast to show you that everything works fine for me: https://media.giphy.com/media/3o7bufKXOwspGnnbpe/giphy.gif I initialize my If you could set up a test case, I would gladly take a look at it. |
@bd-arc I can easily reproduce this problem using this setup: const firstItem = 2;
...
<Carousel
sliderWidth={sliderWidth}
itemWidth={itemWidth}
firstItem={firstItem}
inactiveSlideScale={0.94}
inactiveSlideOpacity={0.6}
enableMomentum={false}
containerCustomStyle={sliderEntryStyles.slider}
contentContainerCustomStyle={sliderEntryStyles.sliderContainer}
showsHorizontalScrollIndicator={false}
snapOnAndroid={true}
removeClippedSubviews={false}
onSnapToItem={(slideIndex: number) => this._centerMapOnMarker(slideIndex, places)}
>
{_getSlides(selectedPlace, places)}
</Carousel> |
@PublicParadise Would you mind setting up a simple example project? Because I'm not able to reproduce the bug with only the code you've shared. Since it works properly for me, I guess this has to do with how slides are generated... |
Closing as no further feedback was provided. Please note that version 2.4.0 fixes an issue that prevented |
I just had similar issue where the carousel has long list (eg. 90 items) and set the
I hope this helps someone else related to |
|
FirstItem prop not working for me if the index is greater than ~6. Could only get it to work by enabling the "useScrollView" prop, or by having "initialNumToRender" to be the same as the index + 1. Of course, using this has a great performance penalty. Is there a way for this to work correctly at the moment? |
@juanamd Unfortunately, this is definitely a I'll copy-paste my comment to a similar issue as this might still help you.
|
} |
Thanks @balwinder4264 I used your solution with a slight tweak, I set |
I'm wondering why firstItem after some index is not showing related index data from array. I use your way which adding initial number to array length. Solving my firstItem thought |
Hey,
I'm having an issue with setting firstItem. Most of the time, the wrong item is selected. We are using a function which returns the children, so we got something like this:
In our case, the 8th item wasn't selected when the component mounts. If we do something like this:
...the correct item is selected. Are there any issues when generating the childrens via function?
The text was updated successfully, but these errors were encountered: