RN的listview Demo
来源:互联网 发布:鼠标指针软件下载 编辑:程序博客网 时间:2024/06/05 05:08
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */import React, { Component } from 'react';import { AppRegistry, StyleSheet, Text, View, ListView, Image, TouchableOpacity, AlertIOS} from 'react-native';var Wine = require('./Wine.json');var Dimensions = require('Dimensions');var {width, height} = Dimensions.get('window');var ListDemo1 = React.createClass({ getInitialState(){ var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); return{ ds: ds.cloneWithRows(Wine) } }, render() { return ( <View style={styles.outerViewStyle}> <View style={styles.headerViewStyle}> <Text style={{color:'white', fontSize:20}}>listviewDemo</Text> </View> <ListView dataSource={this.state.ds} renderRow={this.renderRow}/> </View> ); }, renderRow(rowData,sectionID,rowID,highlightRow){ return( <TouchableOpacity activeOpacity={0.5} onPress={()=>{AlertIOS.alert('系统已经赠送予你 '+rowData.name+'¥'+rowData.money)}}> <View style={styles.cellViewStyle}> <Image source={{uri: rowData.image}} style={styles.leftImageStyle}/> <View style={styles.rightViewStyle}> <Text style={styles.topTitleStyle}>{rowData.name}</Text> <Text style={styles.bottomTitleStyle}>¥{rowData.money}</Text> </View> </View> </TouchableOpacity> ); }});const styles = StyleSheet.create({ outerViewStyle:{ flex:1 }, headerViewStyle:{ height:44, backgroundColor:'orange', justifyContent:'flex-end', alignItems:'center', }, cellViewStyle:{ padding:10, backgroundColor:'white', borderBottomWidth:0.1, borderBottomColor:'#DDDDDD', flexDirection:'row', }, leftImageStyle:{ width:60, height:60, marginRight:10, }, rightViewStyle:{ justifyContent:'center', }, topTitleStyle:{ color:'darkgrey', fontSize:15, width:width * 0.7, marginBottom:10, }, bottomTitleStyle:{ color:'red', }});AppRegistry.registerComponent('ListDemo1', () => ListDemo1);
0 0
- RN的listview Demo
- RN-Demo
- RN中的navigation的使用方式 demo
- 供参考的rn脚手架demo项目
- RN入门练习Demo
- RN ListView 列表
- RN listView使用
- RN实现ListView
- listView的小demo
- ListView分页的Demo
- 关于RN listview item ref
- ListView嵌套GridView的Demo
- ListView的侧滑demo
- RN布局(登陆界面Demo)
- RN的ListView有时不渲染行,需要滑动才会显示的解决方法
- ListView的优化 自己的demo
- 滑动删除listview的demo的分析
- RN 的配置步骤
- 配置apache虚拟域名
- Latex编译参考文献出现问号解决方法
- [How to expression urself clearly and completely] Confidence and Target
- Redis集群 Java客户端Jedis的使用
- jquery操作---从html中取值不同方式
- RN的listview Demo
- nio学习之netty入门(1)---发送字符串
- 详细简单无线破解之wifi密码获取 2017
- Class对象
- 利用 ZXing Android Embedded 实现二维码处理
- 详解 Spring 3.0 基于 Annotation 的依赖注入实现
- NTP服务
- Beyond Australis
- getsockopt()和setsockopt()函数详解