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.

Loop and firstItem parameters doesn't work together

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?

(Check the step you’ve followed - replace the space character between the square brackets ([]) by an x.)

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

It seems to be an plugin implementation bug.

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

Both Platforms

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

Both environments

Environment

“react”: “16.5.0”, “react-native”: “0.57.1”, “react-native-snap-carousel”: “3.7.5”,

Using scrollview implementation or flatlist

Expected Behavior

The first banner to appear in the screen must be the one at the index 0 or any configured with firstItem parameter.

Actual Behavior

Carousel starts showing the central banner of the array and ignores any argument used in firstItem parameter.

Sample Code

<Carousel
                              data={this.state.bannerList}
                              renderItem={({item, index}) => {
                                  return (<BannerCarrouselItem item={item}/>)
                              }}
                              sliderWidth={this.windowWidth}
                              itemWidth={this.windowWidth}
                              inactiveSlideOpacity={1}
                              inactiveSlideScale={1}
                              useScrollView={true}
                              loop={true} />

https://snack.expo.io/@calindratech/carousel-loop-vs-firstitem

Steps to Reproduce

The first render of the component is already enough to reproduce this behaviour.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
phonganhhung9xtbcommented, Mar 27, 2019

+1, when set loop = true, first item rendered incorrect!

1reaction
atulmycommented, Feb 9, 2019

This stills seems to not work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Parameters in for loop, missing first one? - Stack Overflow
The second parameter is a conditional statement While that condition is 'true', the 'for' loop will continue to be executed.
Read more >
5. Working with Arrays and Loops - JavaScript Cookbook [Book]
The function itself has three parameters: the array element, the index of the element, and the array. All three were used in the...
Read more >
Loops — Ansible Documentation
When you run a task with until and register the result as a variable, the registered variable will include a key called “attempts”,...
Read more >
Indexed collections - JavaScript - MDN Web Docs - Mozilla
This chapter introduces collections of data which are ordered by an index value. This includes arrays and array-like constructs such as ...
Read more >
4. More Control Flow Tools — Python 3.11.1 documentation
It is an object which returns the successive items of the desired sequence when you iterate over it, but it doesn't really make...
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