Skip to content

Latest commit

 

History

History
executable file
·
70 lines (65 loc) · 2.09 KB

DynamicList.md

File metadata and controls

executable file
·
70 lines (65 loc) · 2.09 KB

dynamic-list-headref

Dynamic List

A center aspect designed for efficient representation of vertically scrolling lists of changing data. The simplest way is to create a List dataArray, populate it with an array of data chunks, and instantiate a ListItem component with that chunk of data and a renderRow callback which takes a chunk from the whole data array and returns a renderable component.

Preview ios dynamic-list-headref Preview android dynamic-list-headref

Syntax

{% codetabs name="React Native", type="js" -%} import React, { Component } from 'react'; import { Container, Header, Content, List, ListItem, Text } from 'native-base'; export default class DynamicListExample extends Component { render() { var items = [ 'Simon Mignolet', 'Nathaniel Clyne', 'Dejan Lovren', 'Mama Sakho', 'Emre Can' ]; return (

<List dataArray={items} renderRow={(item) => {item} }> ); } } {%- language name="Vue Native", type="vue" -%} {% raw %}{{item}}{% endraw %}

<script> export default { data: function() { return { items: [ "Simon Mignolet", "Nathaniel Clyne", "Dejan Lovren", "Mama Sakho", "Emre Can", ] }; } }; </script>

{%- endcodetabs %}

For more advanced implementation of rendering list dynamically, take a look at nativebase-tutorial.