Commit fa14074c authored by Trisno's avatar Trisno

tampilkan dialog saat belum ada alamat

parent 83f1850c
import React from 'react';
import { View, Text, StyleSheet, Button, FlatList, Alert, TextInput, Image,ScrollView,ActivityIndicator } from 'react-native';
import { View, Text, StyleSheet, Button, FlatList, Alert, TextInput, Image, ScrollView, ActivityIndicator } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
import { connect } from 'react-redux';
import { CheckBox, Icon } from 'react-native-elements';
......@@ -41,7 +41,7 @@ class DeliveryAddrees extends React.Component {
}
// console.log(params)
Axios.post(this.props.BASE_URL+'crm/v2/member/get_address', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/member/get_address', params).then(res => {
const dataAlamat = res.data.data;
console.log("INI DATA :" + JSON.stringify(dataAlamat))
let address = []
......@@ -82,7 +82,7 @@ class DeliveryAddrees extends React.Component {
// console.log("INI PRAMETER NYA : " + JSON.stringify(params))
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/delivery/rate', params).then(res => {
// this.setState({
// grabamount: res.data.data.amount,
......@@ -162,7 +162,7 @@ class DeliveryAddrees extends React.Component {
address_id: id,
}
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/delivery/rate', params).then(res => {
let setGrabProps = {
// grabdestination: this.state.grabdestination,
......@@ -222,7 +222,7 @@ class DeliveryAddrees extends React.Component {
renderItem = ({ item }) => {
return (
<View style={styles.list_addrees}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id , item.name)}>
<TouchableOpacity onPress={() => this.onSave(item.address, item.id, item.name)}>
<View style={{ flex: 1, flexDirection: 'row', margin: 5, }}>
<View style={{ flex: 1, justifyContent: 'center' }}>
<View>
......@@ -241,7 +241,7 @@ class DeliveryAddrees extends React.Component {
</View>
<View style={{ flex: 3, justifyContent: 'center' }}>
<View>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 15,margin:1 }}>{item.name}</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 15, margin: 1 }}>{item.name}</Text>
</View>
<Text style={{ fontFamily: 'Gotham-Light', color: '#838383', fontSize: 15 }}>{item.address}</Text>
</View>
......@@ -284,12 +284,18 @@ class DeliveryAddrees extends React.Component {
<View style={styles.listAddress}>
{this.state.indicator == true ? (
<ActivityIndicator size="large" color="#c9af6d" />
) : (
<FlatList style={{marginBottom:25}}
) : (this.state.data.length ? (
<FlatList style={{ marginBottom: 25 }}
data={this.state.data}
renderItem={this.renderItem}
keyExtractor={item => item.id}
/>
) : (
<View style={{ margin: 20 }}>
<Text style={{ fontFamily: 'Gotham-Light', textAlign: 'center', fontSize: 16 }}>{i18n.t('noAddressSaved')}</Text>
</View>
)
)}
</View>
</ScrollView>
......@@ -324,10 +330,10 @@ const styles = StyleSheet.create({
list_addrees: {
flex: 1,
top:20,
marginLeft:20,
marginRight:20,
marginBottom:20,
top: 20,
marginLeft: 20,
marginRight: 20,
marginBottom: 20,
borderWidth: 1,
borderColor: '#838383',
borderRadius: 10,
......
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