Advertisement
yosadade

Index.js

Feb 5th, 2020
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. import React from 'react'
  2. import { FlatList, View, Text } from 'react-native'
  3. import Image1 from '../../assets/images/abstract-dark-banner.jpg'
  4. import Image2 from '../../assets/images/baby.jpg'
  5. import Image3 from '../../assets/images/best-seller.jpg'
  6. import Image4 from '../../assets/images/black-friday.jpg'
  7.  
  8. import SecondaryHeader from '../../components/global/Header/SecondaryHeader'
  9. import Item from './Item'
  10.  
  11. export default class App extends React.Component {
  12. constructor(props) {
  13. super(props)
  14. this.state = {
  15. FlatListItems: [
  16. {
  17. title: '6 produk Anda kemungkinan terpengaruh durasi, pengiriman akan tertunda karena perayaan Tahun Baru Imlek',
  18. image_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
  19. impresi: '24 Jan 2020 10:39',
  20. img : [ Image1, Image2, Image3, Image4]
  21. },
  22. {
  23. title: 'Pesanan #decdd574-9b9b-4979-9b11-54f771797505 untuk bad telah kadaluwarsa',
  24. image_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
  25. impresi: '23 Jan 2020 13.31',
  26. img : []
  27. },
  28. {
  29. title: 'Pesanan #fcaba6d8-c5df-4702-85a6-86fa914ddfd9 untuk bad telah kadaluwarsa',
  30. image_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/ladylexy/128.jpg',
  31. impresi: '19 Jan 2020 08.29',
  32. img : []
  33. },
  34. ]
  35. }
  36. }
  37. FlatListItemSeparator = () => {
  38. return (
  39. //Item Separator
  40. <View>
  41. </View>
  42. )
  43. }
  44. render() {
  45. return (
  46. <View >
  47. <View>
  48. {this.header()}
  49. </View>
  50.  
  51. <View style={{ backgroundColor: '#F7F7F7', color: '#777777', paddingHorizontal: 15, height: 35, justifyContent: 'center' }}>
  52. <Text style={{ fontSize: 15, fontWeight: '600' }}> Terdahulu </Text>
  53. </View>
  54.  
  55. <FlatList
  56. data={this.state.FlatListItems}
  57. //data defined in constructor
  58. ItemSeparatorComponent={this.FlatListItemSeparator}
  59. //Item Separator View
  60. renderItem={({ item }) =>
  61. <Item item={item} image_url={item.image_url} impresi={item.impresi} title={item.title} img={item.img}/>
  62. }
  63. keyExtractor={(item, index) => index.toString()}
  64. />
  65.  
  66. </View>
  67. )
  68. }
  69. header = () => {
  70. return (
  71. <SecondaryHeader
  72. withBack
  73. title='Notifikasi'
  74. />
  75. )
  76. }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement