scrolltolocation not working outside of initialNumToRender props window in Sectionlist untill I manually scroll

Viewed 217

I am using sectionlist for showing data in react native. I have large data with section list. Here We use scrolltolocation for scrolling to the specific section but it is not wokring untill I render to that section using manually scroll

My Code Need help on this


    <SectionList
                            sections={this.props.fooddata}
                            ref={(s) => (this.sectionList = s)}
                            //onScroll={this.handleScroll}
                            stickySectionHeadersEnabled={true}
                            onViewableItemsChanged={this.props.onCheckViewableItems}
            viewabilityConfig={{
              itemVisiblePercentThreshold: 50 //means if 50% of the item is visible
            }}
                            
                            removeClippedSubviews={false}
                            
                            maxToRenderPerBatch={6}
                           
                            
                            scrollEnabled={true}
                          
                          
                          
                            onScrollToIndexFailed={info => {
                                const wait = new Promise(resolve => setTimeout(resolve, 500));
                                wait.then(() => {
                                   
                                  //flatList.current?.scrollToIndex({ index: info.index, animated: false });
                                });
                              }}
                            
    
                              initialNumToRender={4}
                              windowSize={5}
    
                            ListFooterComponent={this.ItemSeprator}

                            style={{ width: this.windowwidth,top:this.props.searchclicked?135:(this.props.nonveg || this.props.veg)?200:117,bottom:0,position:'absolute'}}
                           // keyExtractor={(item, index) => index}
                           keyExtractor={this.keyExtractor}
    
                            renderSectionHeader={({ section,index }) => this.createSection(section,index)}
                           // renderItem={(item)=>this.jackRecommned(item)}  //{({ item, index }) => this.renderItem(item, index)}
                            
                           renderItem={this.renderItem.bind(this)}
                           renderFooter={this.footer} 
    
                           
                           />
0 Answers
Related