This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| $(document).ready(function() { | |
| var pageSize = 20; | |
| $("#UserList").select2({ | |
| multiple: true, | |
| width: '100%', | |
| ajax: { | |
| theme: 'bootstrap', | |
| url: "https://gorest.co.in/public/v1/users", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deleteButton: { | |
| alignSelf: 'flex-end', | |
| width: 75, | |
| flex: 1, | |
| justifyContent: 'center', | |
| alignItems: 'center', | |
| backgroundColor: 'red', | |
| marginVertical: 3, | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| renderHiddenItem(person) { | |
| return ( | |
| <TouchableOpacity | |
| style={styles.deleteButton} | |
| onPress={() => this.deletePerson(person.id)}> | |
| <Text style={styles.deleteText}>Delete</Text> | |
| </TouchableOpacity> | |
| ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <SwipeListView | |
| data={this.state.persons} | |
| renderItem={({item}) => this.renderPerson(item)} | |
| renderHiddenItem={({item}) => this.renderHiddenItem(item)} | |
| rightOpenValue={-75} | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| deletePerson(personId) { | |
| let {persons} = this.state; | |
| persons = persons.filter(person => person.id !== personId); | |
| this.setState({...this.state, persons}); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| renderPersons() { | |
| if (this.state.persons.length > 0) { | |
| return this.state.persons.map(person => { | |
| return ( | |
| <View key={person.id} style={styles.itemContainer}> | |
| <Swipeable | |
| rightButtons={this.renderRightButtons(person.id)} | |
| rightButtonWidth={75}> | |
| <View style={styles.swipeable}> | |
| <Image style={styles.avatar} source={{uri: person.avatarUrl}} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import images from '../data/image-list.json'; | |
| import persons from '../data/person-list.json'; | |
| export const getImages = () => { | |
| return images; | |
| }; | |
| export const getPersons = () => { | |
| return persons; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "1", | |
| "name": "John Smith", | |
| "avatarUrl": "https://randomuser.me/api/portraits/men/75.jpg" | |
| }, | |
| { | |
| "id": "2", | |
| "name": "Lance Chapman", | |
| "avatarUrl": "https://randomuser.me/api/portraits/men/41.jpg" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "1", | |
| "imageUrl": "https://homepages.cae.wisc.edu/~ece533/images/airplane.png" | |
| }, | |
| { | |
| "id": "2", | |
| "imageUrl": "https://homepages.cae.wisc.edu/~ece533/images/arctichare.png" | |
| } | |
| ] |
NewerOlder