Skip to content
Advertisement

Getting error Invariant Violation tried to get frame out of range index?

I have create VenueList component. I want to display list using FlatList component in react native app. I am getting error: Invariant Violation tried to get frame out of range index (See screenshot).

Code:

VenueList.js:

JavaScript

venueReducer.js:

JavaScript

venueAction.js:

JavaScript

The data which I want to display from API endpoint has json data as follows:

JavaScript

See screenshot:

Advertisement

Answer

As per the the above response for the api request,

The problem is with the payload which is set in the actions. You need to pass the data from the api to the Flatlist since it accepts only arrays.

JavaScript

EDIT: Adding in VenueList.js component (if the api is returning values inside data key):

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement