react-native-listview

React-native - Passing data from one screen to another

放肆的年华 提交于 2019-11-29 13:21:16
问题 I am trying to learn how to use react-native, so I am putting up a small app that fetch a list of users from a server, displays it in a listview and where pressing a row opens a screen displaying user's data. I set up a navigator to go from one screen to another. When pressing on the row I am able to open a new screen but I can't figure how to pass data to this new screen. I set up an navigator in index.android.js import React from 'react'; import { AppRegistry, Navigator, } from 'react

How to add/Delete item into ListView?

老子叫甜甜 提交于 2019-11-28 03:29:09
We can create a datasource for ListView like this var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); var dataSource = ds.cloneWithRows(['row 1', 'row 2']), }; But if I want to add items or delete items from datasource, how can I do that? Do I need to always call cloneWithRows with updated array? tohster Yes, call cloneWithRows(...) The React Native documentation doesn't cover the ListViewDataSource object, so it can be helpful to read the comments in the source code to see how this works. Some notes which may be helpful: cloneWithRows(data) is a bit misleadingly named

Checked - Unchecked doesn't working in ListView - React Native

梦想的初衷 提交于 2019-11-27 07:31:10
问题 friend I Will integrated checked - unchecked in listView. So that When user click on checked then store the data in Array and unchecked then i will remove the data. Its working fine, But the UI Will not updated after checked - unchecked. <List containerStyle={{marginTop : 0 , borderBottomWidth : 0 , borderBottomColor : 'black', borderTopWidth : 0}}> <FlatList data={this.state.list} renderItem={({ item }) => ( <ListItem containerStyle={{height: 80, backgroundColor : 'transparent',

How to add/Delete item into ListView?

一世执手 提交于 2019-11-27 00:04:20
问题 We can create a datasource for ListView like this var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); var dataSource = ds.cloneWithRows(['row 1', 'row 2']), }; But if I want to add items or delete items from datasource, how can I do that? Do I need to always call cloneWithRows with updated array? 回答1: Yes, call cloneWithRows(...) The React Native documentation doesn't cover the ListViewDataSource object, so it can be helpful to read the comments in the source code to see