constructor(props) { super(props); let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); this.state = { url: props.url, dataSource: ds.cloneWithRows([]) } }
//页面渲染完成请求数据 componentDidMount() { let url = this.state.url; let that = this; Uitls.ajax(url, function (data) { if (data.status === 1) { let obj = data.data; let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); that.setState({ dataSource: ds.cloneWithRows(obj) }) } else { alert('服务异常,正在紧急修复,请耐心等待'); } }, function (err) { alert('服务异常,正在紧急修复,请耐心等待'); }) }
componentDidMount() { this.setState({ dataSource: this.state.dataSource.cloneWithRows(responseData), }); }
constructor(props) { super(props); this.state = { dataSource: ds.cloneWithRows(props.todos) }; this.renderRow = this.renderRow.bind(this); }
componentWillReceiveProps(nextProps){ if (nextProps.faskes.open) { this.setState({ dataSource: this.state.dataSource.cloneWithRows(nextProps.faskes.dataFaskes.data) }); } }
constructor(props){ super(props) this.state = { images: ds.cloneWithRows([]), info: {}, token: '', id: 'my_id', loading: false } }
constructor(props) { super(props); let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); this.state = { dataSource: ds.cloneWithRows(data) } }
constructor (props) { super(props); this.state = { posts: [], loading: false, token: '', search_query: '', mostUpvotedAllTimes: ds.cloneWithRows([]), mostUpvotedLastWeek: ds.cloneWithRows([]), bestOfMarmara: ds.cloneWithRows([]) }; }
constructor(props) { super(props); let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); this.state = { url: props.url, dataSource: ds.cloneWithRows([]) } }
//页面渲染完成请求数据 componentDidMount() { let url = this.state.url; let that = this; Uitls.ajax(url, function (data) { if (data.status === 1) { let obj = data.data; let ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); that.setState({ dataSource: ds.cloneWithRows(obj) }) } else { alert('服务异常,正在紧急修复,请耐心等待'); } }, function (err) { alert('服务异常,正在紧急修复,请耐心等待'); }) }
constructor(props) { super(props); let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); this.state = { dataSource: ds.cloneWithRows(data) } }
constructor(props) { super(props); let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); this.state = { dataSource: ds.cloneWithRows(items) } }
componentDidMount() { this.setState({ dataSource: this.state.dataSource.cloneWithRows(responseData), }); }
componentDidMount() { var responseData = [ {"title": "PanResponderExample","detail":"PanResponder的使用"}, {"title": "LayoutAnimationExample","detail":"用于全局的布局动画LayoutAnimation 的使用"}, {"title": "AnimatedExample","detail":"用于创建更精细的交互控制的动画Animated的使用"}, ] this.setState({ dataSource: this.state.dataSource.cloneWithRows(responseData), loaded: true, }); }
componentDidMount() { var responseData = [ {"title": "ListView","detail":"listview,sglistview,tableview性能对比,演示如何获取网络数据"}, {"title": "AnimateExample","detail":"PanResponder,LayoutAnimation,Animate的使用"}, {"title": "redux","detail":"redux的使用"}, {"title": "invoke","detail":"invoke ObjC"}, ] this.setState({ dataSource: this.state.dataSource.cloneWithRows(responseData), }); }