All Questions
Tagged with react-native arrays
1,095
questions
48votes
10answers
99kviews
React Native - Use a keyExtractor with FlatList
I have been getting the:
"VirtualizedList: missing keys for items, make sure to specify a key property on an item or provide a custom keyExtractor"
pretty confusing..., the array i am passing it ...
41votes
3answers
51kviews
React-Native Updating List View DataSource
I have an iOS app I am making with react-native. The Game class contains a ListView component. I set the state in the constructor and include a dataSource. I have a hardcoded array of data for right ...
16votes
4answers
115kviews
How to filter array of objects in react native?
I want to filter this data array into state and city array. How can I achieve this using lodash or any other better way rather than for loop and maintaining extra arrays.
data: [
{ id: 1, name: ...
16votes
8answers
20kviews
How to add a comma in array.map after every element except last element in React JSX
How can I add a trailing comma after every element of an array for making a list like:
INV, INV, INV, INV
Note that the last element doesn't have a trailing comma
Currently iterating the list with ...
11votes
4answers
4kviews
JavaScript Array flat function doesn't define in React native
I'm writing an application based on react-native and we know definitely we can use JavaScript codes in this project and all react projects.
But when I use below code the transpiler return Error to ...
10votes
5answers
14kviews
React Native - Dynamic Image Source
I'm trying to loop through the SOURCE array with the map method, but I keep getting this error:
Unknown named module: '../images/one.jpeg'
Anyone know why this is happening? The file path in the ...
10votes
2answers
2kviews
React Native: Rendering infinite number of pages (bi-directional swiping)
Question
How do people implement an infinite number of pages for you to swipe through dynamically?
Details
If an app renders a page for a day you can expect to swipe to the right for the previous day ...
8votes
3answers
8kviews
Javascript - Counting duplicates in object array and storing the count as a new object
I have an array of javascript objects that are products. These products are displayed in a list as a cart.
I want to count the number of duplicate products in the array based in the _.id value and ...
6votes
9answers
50kviews
Pushing To React State Array
How can I write this better , I want to do it with setState instead of this.state.floors.push as I know that is bad practice but I couldnt figure it out. Im using react native.
FloorAPI....
6votes
4answers
11kviews
React Native: Array.map not rendering within Scrollview
I'm trying to render a list of items within a ScrollView Component from an array of data, but for some reason the items are not showing up, or perhaps rendering at all!? From the example below, only &...
6votes
3answers
52kviews
how to get the index of selected element in react native array
I want an index of the selected element in the react native array. I tried with indexOf() but it always returns -1. School is my array & email contains the value of the element whose index to find....
6votes
1answer
16kviews
How to get the next element on Map function?
I'm trying to make some coordinate plane functions on React native. But I'm having a problem that I don't know how to get the next element on my array.
This is my array:
[
{"M":["0","0"]},
{"H":"100"...
6votes
4answers
24kviews
Reactjs how to initialize array object in state
I'm new to reactjs and i'm learning to change state in reactjs. I'm trying to initialize an array object in state with unknown length, and later update the array object using set state. Following is ...
6votes
5answers
410views
How to handle object and Array in react native?
Am actively creating a react native app for my college studies ! In that am using external api as data source. The problem am facing is that sometimes am getting data in single object and sometimes ...