Troila Mobile Ui

Troila Mobile Ui

  • Docs
  • API
  • Help
  • Blog

›Components

Troila Mobile Ui

  • Getting Started

Components

  • Text
  • ListView
  • List
  • TextInput
  • InputItem
  • Step
  • SpringAnimatedView

卓朗云桌面-内部组件

  • request (请求类)
  • BackgroundButton
  • ExtendsBackButton
  • HeaderTitleButton
  • HeaderImageButton
  • 注意事项
  • 不同平台和设备的入口

List

适用于不复杂的列表场景处理

规则

  • Item必须放在List中使用

Example

iOS Android

Code

import React, { Component } from 'react';
import {
    View,
    StyleSheet,
    Image,
    Button,
} from 'react-native';
import { List, Text } from 'troila-mobile-ui';

const {
    Item
} = List

export default class Example extends Component {
    render() {
        return (
            <View style={styles.container}>
                <List>
                    <Item>List.Item</Item>
                    <Item
                        required={true}
                        numberOfLines={1}
                        extraIcon={'horizontal'}
                    >
                        You can also declare that a prop is an instance of a class. This uses JS's instanceof operator
                    </Item>
                    <Item
                        numberOfLines={2}
                        extraIcon={'close'}
                        onClose={()=>{
                            alert('this a close')
                        }}
                    >
                        You can also declare that a prop is an instance of a class. This uses JS's instanceof operator
                    </Item>
                    <Item
                        extra={
                            <Image
                                source={require('../assets/list_1.png')}
                                style={{width:20}}
                            />
                        }
                        onPress={()=>{
                            alert('onPress the item')
                        }}
                    >
                        List.Item
                    </Item>
                    <Item
                        extra={
                            <Button
                                title={'extra'}
                                onPress={()=>{}}
                            />
                        }
                        onPress={() => {
                            alert('onPress the item')
                        }}
                    >
                        <View>
                            <Image
                                source={require('../assets/list_2.png')}
                                style={{width:80,height: 80,}}
                            />
                            <Text style={{marginTop: 5,color:'red'}}>Troila</Text>
                        </View>
                    </Item>
                </List>
            </View>
        )
    }
}


const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#f5f5f9',
    }
})

List Props

属性说明类型默认值
disabled禁用Booleanfalse
disabledOnPress禁用时点击事件Function()=>{}
style容器样式Stylenull

List.Item Props

属性说明类型默认值
onPress点击事件Function()=>{}
required是否必填Booleanfalse
style样式Stylenull
numberOfLines内容文本行数Number1
extra右侧内容String,Elementnull
extraIcon右侧iconhorizontal,closenull
extraTextStyle右侧内容为String时Text样式Stylenull
onClose右侧icon为close时点击事件Function()=>{}
← ListViewTextInput →
  • 规则
  • Example
  • Code
  • List Props
  • List.Item Props
Troila Mobile Ui
Docs
Getting Started (or other categories)Guides (or other categories)API Reference (or other categories)
Community
User ShowcaseStack OverflowProject ChatTwitter
More
BlogGitHubStar
Facebook Open Source
Copyright © 2018 Your Name or Your Company Name