• 0
Votes
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

scrollToIndex() is not a function

I have currently have a map and a carousel(similar to FlatList) and I want to be able to use scrollToIndex method of FlatList to snap to a certain item in the array. The issue is when I adopted the react-native-snap-carousel library, which is based on ScrollView, I lost the ability to use the scrollToIndex method. The ability to scroll to a certain index was working perfectly fine with FlatList.

I'm using a functional component so I'm using the useRef hook:

    const flatListRef = useRef()     const handleMarker = index => {         flatListRef.current.scrollToIndex({ index, animated: true })     } 

I'm using react-native-maps for my map and the handleMarker above is so that when the user clicks on a marker on the map, the Carousel snaps to the pertaining item:

 handleMarker(index)}     ref={markerRef[index]} >  

Following is the Carousel that replaced FlatList:

 }     horizontal={true}     ref={flatListRef}     sliderWidth={width}     sliderHeight={100}     itemWidth={140}     itemHeight={100} /> 

How do I achieve this this without scrollToIndex?

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]