Guest User

Untitled

a guest
Oct 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. Object {
  2. "44": Object {
  3. "pro_id": "44",
  4. "pro_img": "url",
  5. "pro_name": " S4 ",
  6. },
  7. "52": Object {
  8. "pro_id": "52",
  9. "pro_img": "url",
  10. "pro_name": " S4 ",
  11.  
  12. },
  13. }
  14.  
  15. retrieveData = async () => {
  16. try {
  17. await AsyncStorage.getItem('userFavorites') .then(req => JSON.parse(req))
  18. .then(json =>
  19. this.setState({
  20. favPro:json
  21. })
  22.  
  23. )
  24.  
  25.  
  26. } catch (error) {
  27.  
  28. } }
  29.  
  30.  
  31.  
  32. fav = ({ item }) => {
  33. return (
  34. <View>
  35. <Text>{item.pro_id+ item.pro_name}</Text>
  36. </View>
  37. )
  38. }
  39.  
  40. <FlatList
  41. data={this.state.favPro}
  42. renderItem={this.fav}
  43. keyExtractor={item => item.pro_id}
  44. />
Add Comment
Please, Sign In to add comment