Advertisement
Osher15151

React

May 18th, 2020
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import { StyleSheet, Text, View, FlatList } from 'react-native';
  3. import { ListItem } from 'react-native-elements';
  4.  
  5. const list = [
  6.     {
  7.       name: JSON.stringify(friend),
  8.       subtitle: JSON.stringify(phone)
  9.     }
  10.  
  11. ]
  12.  
  13.  
  14. const FriendDetails = ({ route, navigation }) => {
  15.     const { friend } = route.params;
  16.     const { phone } = route.params;
  17.  
  18.  
  19.  
  20.     keyExtractor = (item, index) => index.toString()
  21.  
  22.     renderItem = ({ item }) => (
  23.         <ListItem
  24.           title={item.name}
  25.           subtitle={item.subtitle}
  26.           //leftAvatar={{ source: { uri: item.avatar_url } }}
  27.           bottomDivider
  28.           chevron
  29.         />
  30.       )
  31.      
  32.  
  33.  
  34.     //keyExtractor = (item, index) => index.toString()
  35.     //renderItem = ({ item }) => (
  36.    // return (
  37.        // <ListItem
  38.        // title= {JSON.stringify(friend)}
  39.        // subtitle={JSON.stringify(phone)}
  40.        // leftAvatar={{ source: { uri: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg'} }}
  41.        // bottomDivider
  42.        // />
  43.         //<View style={styles.container}>
  44.            // <Text>{JSON.stringify(friend)} {JSON.stringify(phone)}</Text>
  45.        // </View>
  46.        
  47.        
  48.     //);
  49.  
  50. }
  51.  
  52. render () {
  53.     return (
  54.       <FlatList
  55.         keyExtractor={this.keyExtractor}
  56.         data={list}
  57.         renderItem={this.renderItem}
  58.       />
  59.     )
  60. }
  61.  
  62. const styles = StyleSheet.create({
  63.     container: {
  64.         flex: 1,
  65.         backgroundColor: '#fff',
  66.         alignItems: 'center',
  67.         justifyContent: 'center',
  68.     },
  69. });
  70.  
  71.  
  72. export default FriendDetails;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement