Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import { StyleSheet } from 'react-native';
  3. import { List, ListItem, Button, Container, Content, View, Card, CardItem, Thumbnail, Text, Left, Body, Icon } from 'native-base';
  4. import { Actions } from 'react-native-router-flux';
  5. import { heightPercentageToDP as hp, widthPercentageToDP as wp } from 'react-native-responsive-screen';
  6.  
  7. import { connect } from 'react-redux'
  8.  
  9.  
  10. class ListSapi extends Component {
  11.  
  12.    constructor(props) {
  13.       super(props)
  14.   }
  15.  
  16.    render() {
  17.      
  18.       return (
  19.          <View style={{ backgroundColor: '#e7e7e8' }}   >
  20.             <Content padder  >
  21.                <Card >
  22.                   {this.props.listsapi.map((s, index) =>
  23.                      <CardItem key={index} bordered button onPress={() => { Actions.detail({sd: s})}}>
  24.                         <Left >
  25.                            <Thumbnail square source={{ uri: s.gambar }} style={styles.cardlist} />
  26.                            <Body  >
  27.                               <Text >{s.nama}</Text>
  28.                               <Text note numberOfLines={2}>{s.alamat}</Text>
  29.                               <Text>Rp. {s.harga}</Text>
  30.                            </Body>
  31.                         </Left>
  32.                      </CardItem>
  33.                   )}
  34.                </Card>
  35.             </Content>
  36.          </View>
  37.       )
  38.    }
  39. }
  40.  
  41. const styles = StyleSheet.create({
  42.    cardlist: {
  43.       borderRadius: 10,
  44.       height: hp('10%'),
  45.       width: wp('20%'),
  46.       resizeMode: 'cover'
  47.  
  48.    },
  49.    wrapper: {
  50.  
  51.    },
  52. });
  53.  
  54.  
  55. const mapStateToProps = state => {
  56.    return { listsapi: state.listsapi  };
  57. };
  58.  
  59. export default connect(mapStateToProps)(ListSapi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement