From d483566022e390b33ce6ba05ced9baf9da1a9f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81tila=20Camur=C3=A7a?= Date: Tue, 1 Mar 2016 19:25:28 -0300 Subject: [PATCH] Documentation for List component. * Description * Basic Usage * Props --- components/list.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/components/list.md b/components/list.md index 20fb7c6..dee5142 100644 --- a/components/list.md +++ b/components/list.md @@ -2,4 +2,58 @@ layout: docs title: List github: https://github.com/react-native-material-design/react-native-material-design/blob/master/lib/List.js +google: https://www.google.com/design/spec/components/lists.html --- + +The List component generates multiple line items vertically based on a data source. + +## Usage + +``` +... +import React, { Component, ScrollView } from 'react-native'; +import { List } from 'react-native-material-design'; +const data = { + items: [ + { + text: 'Item A', + text: 'Item B', + text: 'Item C', + text: 'Item D', + } + ] +}; + +class Demo extends Component { + render() { + return ( + + {data.items.map(item, index) => ( + + )} + + ); + } +} +``` + +## Props + +Prop | Type | Description | Required | Default +--- | --- | --- | --- | --- +primaryText | string | Main text | true | +secondaryText | string | Optional text | false | +captionText | string | | false | +secondaryTextMoreLine | shape | | false | +leftIcon | [Icon][icon] | Icon that appears on the left of the Text | false | +rightIcon | [Icon][icon] | Icon that appears on the right of the Text | false | +leftAvatar | [Avatar][avatar] | Avatar that appears on the left of the Text | false | +rightAvatar | [Avatar][avatar] | Avatar that appears on the right of the Text | false | +lines | number | Number of lines | false | 1 +primaryColor | string | Primary color of the text | false | rgba(0,0,0,.87) +onPress | func | Function to be called when the user press the item | false | +onLeftIconClick | func | Function to be called when the user click on the Left Icon | false | +onRightIconClick | func | Function to be called when the user click on the Right Icon | false | + +[icon]: http://react-native-material-design.github.io/components/icon +[avatar]: http://react-native-material-design.github.io/components/avatar