Commit 03e4a898 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

change address redux

parent 560b2871
......@@ -63,7 +63,7 @@ class DeliveryAddrees extends React.Component {
'Apakah anda akan memilih alamat untuk pengiriman ?',
[
{text: 'OK', onPress: () => this.props.navigation.navigate('')},
{text: 'OK', onPress: () => this.props.navigation.navigate('Menu Select')},
],
{ cancelable: false }
)
......@@ -75,25 +75,27 @@ class DeliveryAddrees extends React.Component {
this.props.setAddress(setDataAddress);
}
renderItem = ({item})=>{
return (
<View style={styles.list_addrees}>
<TouchableOpacity onPress={()=> this.onSave(item.address)}>
<View style={{ margin: 5, }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{item.name}</Text>
</View>
<Text style={{ margin: 5 }}>
{item.address}
</Text>
<Text style={{ margin: 5 }}>
Patokan : {item.description}
</Text>
</TouchableOpacity>
</View>
);
}
render() {
function Item({ name, description, address }) {
return (
<View style={styles.list_addrees}>
<TouchableOpacity onPress={()=>this.onSave(address)}>
<View style={{ margin: 5, }}>
<Text style={{ fontWeight: 'bold', fontSize: 20 }}>{name}</Text>
</View>
<Text style={{ margin: 5 }}>
{address}
</Text>
<Text style={{ margin: 5 }}>
Patokan : {description}
</Text>
</TouchableOpacity>
</View>
);
}
return (
<View style={styles.container}>
<View style={styles.header}>
......@@ -107,7 +109,7 @@ class DeliveryAddrees extends React.Component {
<FlatList
data={this.state.data}
renderItem={({ item }) => <Item name={item.name} description={item.description} address={item.address} />}
renderItem={this.renderItem}
keyExtractor={item => item.id}
/>
{/*
......@@ -180,5 +182,5 @@ const mapDispatchToProps = (dispacth) => {
}
}
export default connect(mapStateToProps)(DeliveryAddrees)
export default connect(mapStateToProps,mapDispatchToProps)(DeliveryAddrees)
......@@ -218,6 +218,7 @@ const mapStateToProps = (state) => {
order_quantity: state.order_quantity,
order_total: state.order_total,
quantity: state.quantity,
address: state.address
// qty: state.qty,
// totalOrder: state.totalOrder,
// totalQty: state.totalQty,
......
......@@ -360,7 +360,7 @@ class ShoppingCart extends React.Component {
<Text style={{ paddingLeft: 20, paddingTop: 10, color: 'gray' }}>Tujuan</Text>
</View>
<View>
<Text style={{ color: '#ccb46c', paddingRight: 150, paddingTop: 10 }}>undefined</Text>
<Text style={{ color: '#ccb46c', paddingRight: 150, paddingTop: 10 }}>{this.props.address}</Text>
</View>
</View>
<View style={{ margin: 20, }}>
......@@ -513,6 +513,7 @@ const mapStateToProps = (state) => {
order_total: state.order_total,
order_item: state.order_item,
quantity: state.quantity,
address: state.address
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment