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.

Setting the index of the item to be displayed does not work

See original GitHub issue

Hey @kkemple

Thanks for the great and simple library. I managed to get working for one of my project without any problem (once I had read #23 that is 😃)

I found an issue when setting the index of the item to be rendered first. It really only works when setting the value is equal to 0.

I have created a snack to reproduce the issue. Basically I am displaying a bunch of text in a view

const data = [
  { text: 'THIS IS TEXT 0' },
  { text: 'THIS IS TEXT 1' },
  { text: 'THIS IS TEXT 2' },
  { text: 'THIS IS TEXT 3' },
  { text: 'THIS IS TEXT 4' }
];

and setting the item to be displayed first to entry 3

<SideSwipe
          index={3}
...

What’s happening is that THIS IS TEXT 0 shows up on screen first. As soon as I start swiping, even by the slightest swipe movement, the text updates to THIS IS TEXT 3 as expected.

To reproduce:

  • Load snack
  • Start swiping

Observe text changing from THIS IS TEXT 0 to THIS IS TEXT 3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:18 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
cyphirecommented, Mar 29, 2018

I fixed this… A little confused over the other branch…

Just put:

initialScrollIndex={currentIndex}

anywhere in the <AnimatedFlatList (line 127 is where I put it.

Works perfectly…

1reaction
cyphirecommented, Mar 28, 2018

Much simpler than flatlist… Thanks… Have same issue with the starting index though… Thanks Kurtis!

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 reasons your z-index isn't working (and how to fix it)
1. Elements in the same stacking context will display in order of appearance, with latter elements on top of former elements. · 2....
Read more >
Why does z-index not work?
The z-index property only works on elements with a position value other than static (e.g. position: absolute; , position: relative; ...
Read more >
CSS Z-Index Not Working? How to Fix It Using Stack Order
The z-index property of CSS is a tricky one. It won't work easily by itself if you don't know how to use it...
Read more >
Why your z-index isn't working
I was building a sidebar recently, and I encountered a bug where the content of the page was always on top of the...
Read more >
CSS Z-Index Not Working! Send Help!
TL;DR: the most common cause for z-index not working is not explicitly declaring a CSS position value (i.e. position: relative, absolute, fixed ...
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