RN开发-组件View,Text
1、外联js文件(RN自定义组件)
module.exports=Header; 导出模块
const Header=require('./header'); 导入外部js自定义组件()
export default class Demo extends Component{}
import Demo from './demo.js'
2、遍历数组,添加事件
show(title){
alert(title);
}
render(){
var newsItem=[]
for(var i in this.props.news){
var text=(
<Text onPress={this.show.bind(this,this.props.news[i]}
numberOfLines={2}
sytle={sytle.news_item}
key={i}
>
{this.props.news[i]}
</Text>
);
newsItem.push(text);
}
return (
{newsItem}
);
}
最新文章
- VC++ GDI 总结 一一 CBitmap类
- 浅析KMP算法
- 自定义弧形的 tabBar
- 《ArcGIS Engine+C#实例开发教程》第五讲 鹰眼的实现
- Oracle 12c最新特性
- C 语言---漂亮的宏定义
- C#学习日志 day 4 ------ 类相关---this指针以及相关关键字
- Fine Uploader 简单配置方法
- javascript学习笔记-2:jQuery中$(";xx";)返回值探究
- OpenStack_I版 5.Nova部署
- WPF样式中TargetType 属性 (Property) 和 x:Key 属性 (Attribute)
- English trip EM1 - PE2 My My name is... Teacher:Lamb Key: introduce myself
- Ajax常见面试题 -- 前端面试题(二)
- nginx log 错误502 upstream sent too big header while reading response header from upstream
- 【java8】慎用java8的foreach循环(作废)
- 【原创】MySQL CPU %sys高的案例分析(一)
- bzoj 3282
- 【第四周】psp
- SpringInAction--Spring Web应用之SpringMvc 注解配置
- Arduino学习笔记A6(补充) - 在串口读取多个字符串,并且转换为数字数组
热门文章
- Python股票量化第一步环境搭建
- 简易音乐播放器主界面设计 - .NET CORE(C#) WPF开发
- SWIG 3 中文手册——10. 参数处理
- JS中0.1+0.2!=0.3
- 牛客网剑指offer第13题——调整数组顺序使得奇数位于偶数前面
- .net core 3.0 swagger
- NODEJS 使用 sqlite3 本地文件数据库
- 谷歌更新后,chromedriver如何更换新版本
- WebApp开发-Zepto
- Spring BeanDefinitionHolder源码解析