estimatedHeight + initialScrollIndex = Wrong position #562
Unanswered
siddharth-kt
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
-
You can use |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was facing same issue with RecyclerListView also (and issue was also raised for this See : Flipkart/recyclerlistview#241)
Eg,
import React from "react";
import { Text, View } from "react-native";
import { FlashList } from "@shopify/flash-list";
const FlashListTest = () => {
const DATA = [
{ title: "First Item", color: "grey" },
{ title: "Second Item", color: "pink" },
{ title: "First Item", color: "antiquewhite" },
{ title: "Second Item", color: "aqua" },
{ title: "First Item", color: "bisque" },
{ title: "Second Item", color: "blueviolet" },
{
title:
First Item
,color: "brown",
},
{ title: "Second Item", color: "burlywood" },
];
return (
<FlashList
data={DATA}
initialScrollIndex={6}
renderItem={({ item }) => {
return (
<View
style={{
minHeight: 400,
width: "360%",
backgroundColor: item.color,
}}
>
<Text numberOfLines={3} style={{ width: 360 }}>
{item.title});
}}
estimatedItemSize={300}
// horizontal
/>
);
};
export default FlashListTest;
In above example estimatedHeight (i.e 300) is different from actual Item height(i.e 400) so initialScrollIndex takes to wrong position.
@naqvitalha What can be solution to this issue ?
Thanks 🙂
Beta Was this translation helpful? Give feedback.
All reactions