constructor(props) { super(props); const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, sectionHeaderHasChanged: (s1, s2) => s1 !== s2 }); this.state = { dataSource: ds.cloneWithRowsAndSections(props.contacts), loading: true } }
search(text: mixed): void { this.props.search && this.props.search(text); var regex = new RegExp(text, 'i'); var filter = (component) => regex.test(component.title); this.setState({ dataSource: ds.cloneWithRowsAndSections({ components: this.props.components.filter(filter), apis: this.props.apis.filter(filter), }), searchText: text, }); }
constructor(props: any) { super(props); this.state = { dataSource: ds.cloneWithRowsAndSections({ components: [], apis: [], }), searchText: this.props.searchText, }; }
fetchData() { fetch(REQUEST_URL) .then((response) => response.json()) .then((responseData) => { this.setState({ dataSource: this.state.dataSource.cloneWithRowsAndSections(this._convertArrayToMap(responseData)), loaded: true, refreshing: false }); }) .done(); }
constructor(props) { super(props); this.ReactNativeComponentTree = require('react/lib/ReactNativeComponentTree'); const ds = new ListView.DataSource({ sectionHeaderHasChanged: (r1, r2) => r1 !== r2, rowHasChanged: (r1, r2) => r1.id !== r2.id, }); this.state = { sectionHeaders: {}, //hash map for { tag: nodeId } heightOne: 15, //height for every section index ds: ds, //DataSource component of ListView dataSource: ds.cloneWithRowsAndSections({}, []), //dataSource for ListView sectionIds: [], //the list of section index brands: {}, //brand tree data parsed from json data imageDefault: 'http://kepkezelo.com/images/59fqze7llmos6freeupr.png', }; }
constructor(props) { super(props) const getSectionData = (dataBlob, sectionId) => dataBlob[sectionId]; const getRowData = (dataBlob, sectionId, rowId) => dataBlob[`${rowId}`]; const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, sectionHeaderHasChanged : (s1, s2) => s1 !== s2, getSectionData, getRowData, }); const { dataBlob, sectionIds, rowIds } = this.formatData(demoData); this.state = { dataSource: ds.cloneWithRowsAndSections(dataBlob, sectionIds, rowIds) } }
dataSource: dataSource.cloneWithRowsAndSections(data, sectionIDs, rowIDs), }; },
constructor(props) { super(props); let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, sectionHeaderHasChanged: (s1, s2) => s1 !== s2 }); let data = [vegetables, fruits, [others]]; this.state = { dataSource: ds.cloneWithRowsAndSections(data) } }
constructor(props) { super(props); let ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2, sectionHeaderHasChanged: (s1, s2) => s1 !== s2 }); let data = [vegetables, fruits, [others]]; this.state = { dataSource: ds.cloneWithRowsAndSections(data) } }
dataSource: ds.cloneWithRowsAndSections(dataObjects)
dataSource: ds.cloneWithRowsAndSections(dataObjects)
dataSource: ds.cloneWithRowsAndSections(dataObjects)
dataSource: ds.cloneWithRowsAndSections(dataObjects)
dataSource: ds.cloneWithRowsAndSections(dataObjects)
dataSource: ds.cloneWithRowsAndSections(dataObjects)