Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, {Component} from 'react';
  2. import {
  3.   View,
  4.   Text,
  5.   Image,
  6.   TouchableOpacity,
  7.   ImageBackground,
  8.   FlatList,
  9.   ScrollView,
  10.   Linking,
  11. } from 'react-native';
  12. import styles from './styles';
  13. import {Card} from 'react-native-elements';
  14. import Modal from 'react-native-modal';
  15. import {SafeAreaView} from 'react-navigation';
  16.  
  17. const data = [
  18.   {
  19.     imageUrl: 'http://via.placeholder.com/160x160',
  20.     title: 'something',
  21.   },
  22.   {
  23.     imageUrl: 'http://via.placeholder.com/160x160',
  24.     title: 'something two',
  25.   },
  26.   {
  27.     imageUrl: 'http://via.placeholder.com/160x160',
  28.     title: 'something three',
  29.   },
  30.   {
  31.     imageUrl: 'http://via.placeholder.com/160x160',
  32.     title: 'something four',
  33.   },
  34.   {
  35.     imageUrl: 'http://via.placeholder.com/160x160',
  36.     title: 'something five',
  37.   },
  38.   {
  39.     imageUrl: 'http://via.placeholder.com/160x160',
  40.     title: 'something six',
  41.   },
  42. ];
  43.  
  44. export default class SellerProfile extends Component {
  45.   constructor(props) {
  46.     super(props);
  47.     this.state = {
  48.       data: data,
  49.       isModalVisible: false,
  50.       textShare: true,
  51.     };
  52.   }
  53.   toggleModal = () => {
  54.     this.setState({isModalVisible: !this.state.isModalVisible});
  55.   };
  56.   componentHideAndShow = () => {
  57.     this.setState(previousState => ({textShare: !previousState.textShare}));
  58.   };
  59.   render() {
  60.     return (
  61.       <View style={[styles.flex, styles.backgroundColor]}>
  62.         <ScrollView nestedScrollEnabled={true}>
  63.           <View style={[styles.flex_Row, styles.Header]}>
  64.             <View style={styles.container_Icon}>
  65.               <TouchableOpacity>
  66.                 <View style={styles.btn}>
  67.                   <Image
  68.                     source={require('../../assets/img/chevron-left.png')}
  69.                     style={styles.Icon}
  70.                   />
  71.                 </View>
  72.               </TouchableOpacity>
  73.             </View>
  74.             <View style={styles.container_Icon2}>
  75.               <TouchableOpacity onPress={this.toggleModal}>
  76.                 <View style={styles.btn}>
  77.                   <Image
  78.                     source={require('../../assets/img/share-21.png')}
  79.                     style={styles.Icon}
  80.                   />
  81.                 </View>
  82.               </TouchableOpacity>
  83.             </View>
  84.           </View>
  85.  
  86.           <View style={styles.container}>
  87.             <View style={styles.flex_Row}>
  88.               <View style={styles.container_Logo}>
  89.                 <Image
  90.                   source={{uri: 'http://via.placeholder.com/160x160'}}
  91.                   style={styles.img_Logo}
  92.                 />
  93.               </View>
  94.               <ImageBackground
  95.                 source={require('../../assets/img/Rectangle111.png')}
  96.                 style={styles.imgBackRate}>
  97.                 <Text style={styles.text_Rate}>4.5</Text>
  98.               </ImageBackground>
  99.             </View>
  100.             <Text style={styles.text_NamaRestaurant}>J.CO Donuts & Cofee</Text>
  101.             <View style={styles.flex_Row}>
  102.               <Image
  103.                 source={require('../../assets/img/map-pin.png')}
  104.                 style={styles.Icon2}
  105.               />
  106.               <View style={styles.flex_Column}>
  107.                 <Text style={styles.text_Jarak}>Jarak 5 KM</Text>
  108.                 <Text style={styles.text_alamatRestaurant}>
  109.                   Paviliun Rental Arkadi, Surdirman, Jakarta Pusat
  110.                 </Text>
  111.               </View>
  112.             </View>
  113.             <View style={styles.flex_Row}>
  114.               <Image
  115.                 source={require('../../assets/img/info.png')}
  116.                 style={styles.Icon3}
  117.               />
  118.               <Text style={styles.text_waktu}>21 : 00 - 22 : 00</Text>
  119.             </View>
  120.             <View style={styles.container_Divider}>
  121.               <View style={styles.divider} />
  122.             </View>
  123.             <Text style={styles.text_Daftar}>Daftar Menu</Text>
  124.  
  125.             <View>
  126.               <FlatList
  127.                 data={this.state.data}
  128.                 vertical={true}
  129.                 bounces={false}
  130.                 style={{}}
  131.                 renderItem={({item: rowData}) => {
  132.                   return (
  133.                     <Card
  134.                       title={null}
  135.                       containerStyle={{
  136.                         // position: 'absolute',
  137.                         width: '87%',
  138.                         height: 272,
  139.                         marginLeft: '6.7%',
  140.                         marginTop: 14,
  141.                         marginBottom: 25,
  142.                         padding: 0,
  143.                         elevation: 5,
  144.                         backgroundColor: '#FFFFFF',
  145.                         borderColor: '#ddd',
  146.                         borderRadius: 8,
  147.                       }}>
  148.                       <Image
  149.                         source={{uri: 'http://via.placeholder.com/160x160'}}
  150.                         style={{
  151.                           // position: 'absolute',
  152.                           width: '100%',
  153.                           height: 144,
  154.                           marginBottom: 17,
  155.                           borderTopLeftRadius: 8,
  156.                           borderTopRightRadius: 8,
  157.                         }}
  158.                       />
  159.                       <ImageBackground
  160.                         source={require('../../assets/img/Rectangle111.png')}
  161.                         style={styles.imgBackRate2}>
  162.                         <Text style={styles.text_Rate2}>4.5</Text>
  163.                       </ImageBackground>
  164.                       <View
  165.                         style={{
  166.                           flexDirection: 'column',
  167.                         }}>
  168.                         <View>
  169.                           <Text style={styles.text_makananCard}>Karedok</Text>
  170.                           <Text style={styles.text_pemilikMakanan}>
  171.                             Bu Suharti - Kemang, Jakarta Selatan
  172.                           </Text>
  173.                           <Text style={styles.text_waktuAmbil}>
  174.                             Waktu Pengambilan 21.00 - 22.00
  175.                           </Text>
  176.                         </View>
  177.                         <View
  178.                           style={{
  179.                             flexDirection: 'row',
  180.                             alignItems: 'center',
  181.                           }}>
  182.                           <Text style={styles.hargaSekarang}>8000</Text>
  183.                           <Text style={styles.hargaAsli}>10000</Text>
  184.                           <Text style={styles.diskon}>Diskon 50%</Text>
  185.                         </View>
  186.                       </View>
  187.                     </Card>
  188.                   );
  189.                 }}
  190.                 keyExtractor={(item, index) => index}
  191.               />
  192.             </View>
  193.           </View>
  194.           <Modal
  195.             isVisible={this.state.isModalVisible}
  196.             animationIn="fadeIn"
  197.             animationOut="fadeOut"
  198.             style={{justifyContent: 'flex-end', margin: 0}}
  199.             animationInTiming={500}
  200.             animationOutTiming={500}>
  201.             <View style={styles.popup}>
  202.               <View style={[styles.flex_Row, styles.container_text]}>
  203.                 {this.state.textShare == false ? (
  204.                   <View style={{width: '87%'}}>
  205.                     <Text
  206.                       onPress={this.componentHideAndShow}
  207.                       style={styles.txt_share}>
  208.                       Ada makanan berlebih dengan diskon 50% di *nama restoran*
  209.                       nih. Yuk selamatkan makanan tersebut dan jadilah food
  210.                       waste hero di lingkunganmu{' '}
  211.                       <Image
  212.                         source={require('../../assets/img/smile-icon-free.png')}
  213.                         style={styles.img_smile}
  214.                       />
  215.                     </Text>
  216.                     <TouchableOpacity
  217.                       onPress={() => {
  218.                         Linking.openURL('https://www.surplus.id/');
  219.                       }}>
  220.                       <Text style={styles.txt_link}>www.surplus.id</Text>
  221.                     </TouchableOpacity>
  222.                   </View>
  223.                 ) : (
  224.                   <View style={{width: '87%'}}>
  225.                     <Text
  226.                       numberOfLines={2}
  227.                       onPress={this.componentHideAndShow}
  228.                       style={styles.txt_share}>
  229.                       Ada makanan berlebih dengan diskon 50% di *nama restoran*
  230.                       nih. Yuk selamatkan makanan tersebut dan jadilah food
  231.                       waste hero di lingkunganmu
  232.                       <Image
  233.                         source={require('../../assets/img/smile-icon-free.png')}
  234.                         style={styles.img_smile}
  235.                       />
  236.                     </Text>
  237.                   </View>
  238.                 )}
  239.                 <TouchableOpacity onPress={this.toggleModal}>
  240.                   <Image
  241.                     source={require('../../assets/img/close-circle.png')}
  242.                     style={styles.close_img}
  243.                   />
  244.                 </TouchableOpacity>
  245.               </View>
  246.               <View style={[styles.flex_Row, styles.container_img_sosmed]}>
  247.                 <TouchableOpacity>
  248.                   <Image
  249.                     source={require('../../assets/img/instagram.png')}
  250.                     style={styles.img_Sosmed}
  251.                   />
  252.                 </TouchableOpacity>
  253.                 <TouchableOpacity>
  254.                   <Image
  255.                     source={require('../../assets/img/facebook.png')}
  256.                     style={styles.img_Sosmed}
  257.                   />
  258.                 </TouchableOpacity>
  259.                 <TouchableOpacity>
  260.                   <Image
  261.                     source={require('../../assets/img/twitter.png')}
  262.                     style={styles.img_Sosmed}
  263.                   />
  264.                 </TouchableOpacity>
  265.                 <TouchableOpacity>
  266.                   <Image
  267.                     source={require('../../assets/img/whatsapp.png')}
  268.                     style={styles.img_Sosmed}
  269.                   />
  270.                 </TouchableOpacity>
  271.               </View>
  272.             </View>
  273.           </Modal>
  274.         </ScrollView>
  275.       </View>
  276.     );
  277.   }
  278. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement