比较简单的项目

//index.js
/** @format */import {AppRegistry} from 'react-native';
//默认创建的类
import App from './App';
//json
import {name as appName} from './app.json';
//FlatList类
import DWBFlatList from './DWBHomeFlatList'import DWBTestVC from './DWBTestVC'import DWBTButton from './DWBTButton'// import DWBSwipeout from './DWBSwipeout'import DWBNavVC from './DWBNavVC'
import DWBTouchableOpacity from './DWBTouchableOpacity'import DWBSectionList from './DWBSectionList'import DWBActionButton from './DWBActionButton'//修改这里可以切换不同的类显示: => App
AppRegistry.registerComponent(appName, () => DWBFlatList);// react-native关闭所有黄色警告,将这两句话加在index.js文件中,放在AppRegistry.registerComponent('App', () => App)之前。
console.ignoredYellowBox = ['Warning: BackAndroid is deprecated. Please use BackHandler instead.','source.uri should not be an empty string','Invalid props.style key'];console.disableYellowBox = true // 关闭全部黄色警告

//DWBHomeFlatList.js
import React, { Component } from 'react';
import {AppRegistry,StyleSheet,Text,View,FlatList,TouchableOpacity, Button,
} from 'react-native';// 初始化数据
var Arr = [{name:'河北省',},{name:'山西省',},{name:'辽宁省',},{name:'吉林省',},{name:'黑龙江省',},{name:'江苏省',},{name:'浙江省',},{name:'福州省',}];export default class MyFlatList extends Component {render() {//给数据追加一个key的字段,不然会有警告的,参数数组中的每一项,需要包含 key 值作为唯一标示for (var i = 0; i < Arr.length; i++) {Arr[i]['key'] = i;}return (//初始化FlatList<View style={styles.container}><FlatList style={styles.FlatListStyle}data = {Arr}ListHeaderComponent={this.ListHeaderComponent.bind(this)}ListFooterComponent={this.ListFooterComponent.bind(this)}renderItem={this.renderItemView.bind(this)}//分割线组件ItemSeparatorComponent={ItemDivideComponent}></FlatList></View>);}//列表的每一行renderItemView({item,index}){return(<TouchableOpacity onPress={()=>{this.Cellheader(item)}}><View style={{backgroundColor:'#ffffff',//背景色height:59,//view高度justifyContent:'center',//内容上下居中alignItems: 'center'//内容左右居中}}><Text>{item.name}</Text></View></TouchableOpacity>);}//点击每一行的对象Cellheader(data){alert(data.name);}//定义页头ListHeaderComponent(){return(<View style={{height:140,backgroundColor:'red',justifyContent: 'center',}}><Text>我是页头</Text></View>);}//定义页脚ListFooterComponent(){return(<View style={{height:140,backgroundColor:'yellow',justifyContent: 'center',}}><Text>我是页脚</Text></View>);}
}// //设置分割线
// renderSeparator(){
//     return (
//         <View style={{height: 1, backgroundColor: 'skyblue'}}></View>
//     );
// };class ItemDivideComponent extends Component {render() {return (<View style={{height: 1, backgroundColor: 'skyblue'}}></View>);}
};const styles = StyleSheet.create({//控制器属性container: {flex: 1,flexDirection: 'column',justifyContent: 'space-between',backgroundColor: '#F5FCFF',},
//FlatList属性FlatListStyle:{backgroundColor:'#f6f6f6',flex:1,marginTop:64,marginBottom: 100,// width:300}});
//DWBActionButton.js
import React, { Component } from 'react';
import { StyleSheet, View,Text,Alert } from 'react-native';
import ButtonMy from 'apsl-react-native-button'export default class ActionButton extends Component {render() {return (<View style={styles.ViewSyt}><ButtonMy style={{backgroundColor: '#c771ec'}} onPress={()=>{Alert.alert('我是一个button');}}><View style={styles.actionButtonIcon}><Text style={styles.actionButtonIcon}>我是一个button</Text></View></ButtonMy></View>);}}const styles = StyleSheet.create({ViewSyt:{flex:1,marginTop:100,fontSize: 20,height: 40,color: 'white',},actionButtonIcon: {fontSize: 20,height: 22,color: 'white',},
});

比较基础,=-=

转载于:https://www.cnblogs.com/smart-girl/p/10899590.html

【水滴石穿】MyFirstRNDemo相关推荐

  1. 做人晶莹剔透,做事水滴石穿

    看了余世维的讲座,在最后的闭幕中,出现了这样的文字:做人晶莹剔透,做事水滴石穿.晶莹剔透意味着诚信光明,水滴石穿意味着用心坚持.让我心一惊,真是说得太对了.我要用他来鼓舞激励自己. 现在很多人都很虚伪 ...

  2. Redis 水滴石穿之(六)哨兵

    Redis-水滴石穿之(六)哨兵 目录 Redis-水滴石穿之(六)哨兵 一.概述 二.哨兵应用 2.1.主从及哨兵配置 2.2.依次启动主.从.哨兵 2.3.主从节点验证 2.4.故障迁移演示 2. ...

  3. 水滴石穿、坚持不懈,必能有所精进

    在跟随这门课程学习的过程中,我增长了很多大数据相关的知识,对于大数据技术和相关开源组件,也有了更深的了解.今天正好可以借着这个机会,来记录下自己的一点心得体会,也跟你分享一下我的学习思路,咱们一起聊一 ...

  4. 2.4 找准位置,水滴石穿

            考试时的方法多数不是"灵机一动"现场创造出来的,而是平时刻苦训练中积累出来的. 俗话说得好,"水滴石穿",但"水滴未必石穿" ...

  5. Redis 水滴石穿之(四)持久化

    Redis 水滴石穿之(四)持久化 目录 Redis 水滴石穿之(四)持久化 一.概述 二.RDB 1.RDB快照触发时机 1.1 手动触发 (save & bgsave) 1.2 自动触发 ...

  6. 不会-Redis 水滴石穿之(七)集群

    Redis 水滴石穿之(七)集群 目录 Redis 水滴石穿之(七)集群 一.概述 二.集群搭建 2.1.手动搭建集群 1.修改配置文件 2.启动节点 3.节点握手 4.分配槽 5.指定主从关系 2. ...

  7. 期货开户水滴石穿知行合一

    上千年来,人生价值一直都在改变,唯一没有改变的就是价值本身的规律.如果从另一个角度去观察,或许会有另外一番心境,有句老话叫做后生可畏,也许后生并不可畏,真正让人可畏可敬的或许是代表一个时代的思想和精神 ...

  8. 2022-1-14持之以恒,水滴石穿

    1.读到曾文正公修身之难皆因无恒,刚过30的我深有体会,回想往事从幼时读书学习开始总是3分钟热度,学习总浮于表面,老师布置的作业草草了事,出社会参加工作后书倒是买了一大堆,每本书总是翻完几页又想去读其 ...

  9. 水滴石穿oracle之脚本安装

    水滴石穿oracle之脚本安装 上一篇文章带领大家在redhat5.5上一步一步安装了oracle10g,并且详细讲解了每一步操作,图文并茂相信可以帮到一些有需要朋友! 成功动手搭建过一次的朋友们有没 ...

最新文章

  1. freemarker include 和 import
  2. 版本服务器Svn部署与配置
  3. 高效5步走,高速搭建Hadoop2伪分布环境
  4. 从玉农业谋定塞外-丰收节交易会·林裕豪:巴彦淖尔深圳签约
  5. SELinux进阶篇 应用目标策略管理非限制进程和用户
  6. java 线程访问控件_C#多线程与跨线程访问界面控件的方法
  7. jQuery应用实例2:简单动画
  8. linux ssh远程无密码登陆无效
  9. GoLang之使用uber-go/dig进行依赖注入
  10. 【lc3】汇编实现I/O中断
  11. 如何写一个好的缺陷,大牛都是这样的做的
  12. 读书笔记---Naive Bayes
  13. 使用浏览器打开exe文件
  14. 前端学习资料网址汇总
  15. Windows安装程序遇到错误:0x80240037
  16. uni-app里的拓展组件uni ui与UI框架uView UI的Popup 弹出层的区别!
  17. F2FS源码分析-5.2 [数据恢复流程] 后滚恢复和Checkpoint的作用与实现
  18. 恋爱骗局泛滥,过亿单身女性成待宰羔羊!
  19. 腾讯安全“护航舰”亮相网安周,数实融合共筑产业安全防线
  20. Java实现蓝桥杯VIP算法训练 二元函数

热门文章

  1. pgpool-II读写分离
  2. 使用jsdelivr时不要瞎搞
  3. linux 字符串比较、数值比较
  4. WPS 代码域 修改默认代码域 使目录页码样式和页脚样式不同。
  5. 学计算机的该不该去医院信息科,医院信息科日常工作
  6. word中表格不自动换页的问题
  7. 封装 电流密度 重布线_半导体封装及其制造方法与流程
  8. jquery.fileupload.js插件使用--单视频或音频上传预览
  9. 多媒体设计与制作是什么专业?
  10. 迭代和递归思想的总结