From the course: Learning React Native

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using a flat list

Using a flat list

From the course: Learning React Native

Start my 1-month free trial

Using a flat list

- [Instructor] The flat list is special type of view that you can use to handle this content. Currently, in our application, we have a small list of colors that's being rendered into color buttons. If we take a look at our files, we'll notice that there's a data folder. And inside the data folder, we have a JSON document for default colors. So here we have an array of colors. Each one of these objects has the name of a color and a unique identifier. So let's use this array of colors to create our list of buttons. Back in the app js file, we will import this JSON data into a variable called default colors. And now to render this list of colors using React components, I'm going to use a special type of view, a flat list. The flat list is a scrollable view that you can use to render a list of content. We'll render it from the app component. So to do this, I'm going to to go ahead and self close this view. I'm…

Contents