/**
* Created by ZHOUZ on 2016-08-21.
*/
"use strict";
const React = require('react');
const react_native_1 = require('react-native');
const ArticleReadPage_1 = require('../page/ArticleReadPage');
const IndexUI_1 = require('../ui/IndexUI');
const ArticleModel_1 = require('../model/ArticleModel');
class IndexPage extends React.Component {
constructor(props) {
super(props);
this.dataSource = null;
this.dataSource = new react_native_1.ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 });
this.state = {
dataSource: this.dataSource.cloneWithRows([])
};
}
_onPress() {
let _this = this;
const { navigator } = this.props;
if (navigator) {
navigator.push({
name: 'ArticleReadPage',
component: ArticleReadPage_1.default,
params: {
id: this.state.id,
//从SecondPageComponent获取user
getUser: function (user) {
_this.setState({ user: user });
}
}
});
}
}
render() {
return IndexUI_1.default(this.state.dataSource, this);
}
componentDidMount() {
ArticleModel_1.default.getList({
page: 1,
size: 10,
onResponse: (json) => {
console.log("json", json);
console.log("state", this.state);
let newState = {
dataSource: this.dataSource.cloneWithRows(json.data.List),
};
react_native_1.ToastAndroid.show("DDDDDD", react_native_1.ToastAndroid.SHORT);
console.log("state", this.state);
this.setState(newState);
},
onError: (e) => {
react_native_1.ToastAndroid.show("error: " + e.toString(), react_native_1.ToastAndroid.LONG);
}
});
}
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = IndexPage;
没有合适的资源?快使用搜索试试~ 我知道了~
typescript开发react-native的简单示例代码
共22个文件
js:11个
ts:6个
tsx:5个
5星 · 超过95%的资源 需积分: 42 91 下载量 127 浏览量
2016-08-31
23:12:24
上传
评论
收藏 23KB ZIP 举报
温馨提示
详见《typescript开发react-native的简单示例代码》http://blog.csdn.net/zhouzme/article/details/52390022
资源推荐
资源详情
资源评论
收起资源包目录
application_typescript_201608312258.zip (22个子文件)
application
dist
src
config
Config.js 227B
Config.ts 149B
component
assets
controller
style
IndexStyle.ts 1KB
IndexStyle.js 1KB
model
ArticleModel.js 833B
ArticleModel.ts 2KB
page
ArticlePage.js 1KB
IndexPage.js 2KB
ArticleReadPage.js 1KB
ArticlePage.tsx 1KB
IndexPage.ts 2KB
ArticleReadPage.ts 1KB
navigator
IndexNavigator.js 1KB
ArticleReadNavigator.js 944B
ArticleReadNavigator.tsx 883B
IndexNavigator.tsx 816B
ui
IndexUI.js 2KB
ArticleReadUI.js 747B
IndexUI.tsx 2KB
ArticleReadUI.tsx 676B
util
NetworkUtil.js 1KB
NetworkUtil.ts 3KB
共 22 条
- 1
资源评论
- yy60602018-06-20挺好的,谢谢!
- 小宇丝2019-06-06挺好的,谢谢!
- henjery2017-10-18可以使用,好!
神神的蜗牛
- 粉丝: 226
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功