Describe the bug
I've implemented this library to show item cards in a container which is modal view. I think it's due to prop bcoz when I remove this prop then it's showing me my view with all cards.
initialIndex
But I need to show my first item card which would be selected by user from list view and which has index "this.props.currentSelectedIndex"
<Carousel style = {styles.carouselContainer} data = {this.state.entries} initialIndex = {this.props.currentSelectedIndex} renderItem = {({item, index}) => this.renderItem({item, index})} itemWidth = {globalFunction.wp(70) + (globalFunction.wp(5) * 4)} containerWidth = {Constants.iDeviceWidth} inActiveScale = {0.95} separatorWidth = {10} ref = {(c) => { this._carousel = c; }} itemContainerStyle = {styles.slideContentContainer} />
and my renderItem function is like below
renderItem ({item, index}) { let jsonData = JSON.parse(item.jsonRepresentation); let activeIngredientDetails = jsonData; let ingredientDetailsDynamicTabsArray = globalFunction.getDynamicTabsForIngredient(activeIngredientDetails, this.props.userData.accesses); return <IngredientCard allIngredientsData = {this.state.entries} data = {item} ingredientIndex = {index} tabsArray = {ingredientDetailsDynamicTabsArray} userDetails = {this.props.userData} />; }
IngredientCard is a pure component within same class only.
But I'm getting an error - scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures.
and my Xcode console logs - Unhandled JS Exception: scrollToIndex should be used in conjunction with getItemLayout or onScrollToIndexFailed, otherwise there is no way to know the location of offscreen indices or handle failures.
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
- Device: [e.g. iPhone8]
- OS: [e.g. iOS12.3]
Additional context
my react-native environment from package.json
"react": "16.8.3",
"react-native": "^0.59.9",
"react-native-anchor-carousel": "^3.1.0",
Please tell me how to resolve this error.
And, If you have any logic for displaying large data say 2000 in batches then please share it as well.
Thanks in advance.