Commit 09dc293c authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

Merge branch 'master' of ssh://repo.cs.co.id:2222/wahyu/bahanoprek

# Conflicts:
#	view/MenuSelection.js
parents ec8a6ac2 f72d6870
......@@ -140,10 +140,22 @@ class Home extends React.Component {
})
}
_pickup() {
this.props.navigation.navigate('Pickup Name', {from : 'home'});
}
_delivery(){
this.props.navigation.navigate('Delivery Address', {from : 'home'});
}
_orderNow = () => {
if (this.props.outlet_id != '' && this.props.name_outlet != '') {
this.props.setTypePickup(true)
this.props.navigation.navigate("Menu Select")
this.props.navigation.navigate('Home', {
screen: 'MENU',
params: { user: 'jaxi' },
});
} else {
Alert.alert('Belum dapat outlet terdekat')
}
......
......@@ -81,9 +81,10 @@ class MenuConfirmation extends React.Component {
orderSuccess = () => {
this.props.setOrderFinish()
this.props.navigation.reset({
routes: [{ name: 'Home' }]
})
this.props.navigation.navigate('Home', {
screen: 'ORDER',
params: { user: 'jax' },
});
}
......
import React from 'react';
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator } from 'react-native';
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator, Alert } from 'react-native';
import Axios from 'axios';
import Item from './Item';
import { connect } from 'react-redux';
......@@ -25,10 +25,18 @@ class MenuSelection extends React.Component {
}
componentDidMount() {
this.getMenuList()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
if (this.props.outlet_id != '') {
this.getMenuList()
console.log("INI DI RELOAD");
} else {
Alert.alert('Device belum mendapatkan lokasi anda')
}
console.log("INI OUTLET : "+ this.props.outlet_id)
this._unsubscribe = this.props.navigation.addListener('focus', () => {
if (this.props.outlet_id != '') {
this.getMenuList()
} else {
Alert.alert('Device belum mendapatkan lokasi anda')
}
});
}
......
......@@ -46,8 +46,20 @@ class ShoppingCart extends React.Component {
this.getRate()
}
this.getBalance()
this._unsubscribe = this.props.navigation.addListener('focus', () => {
if (!this.props.type_pickup) {
this.getRate()
}
this.getBalance()
});
}
componentWillUnmount() {
this._unsubscribe();
}
checkChangeTrans(val) {
if (val == 'delivery') {
......@@ -549,14 +561,20 @@ class ShoppingCart extends React.Component {
</View>
)}
</View>
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View>
<Text style={{ paddingLeft: 20, paddingTop: 10, color: 'gray' }}>Tujuan</Text>
</View>
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ color: '#ccb46c' }}>{this.props.address}</Text>
</View>
</View>
{this.props.type_pickup == true ? (
null
):(
<View style={{ flexDirection: 'row', marginTop: 10, justifyContent: 'space-between' }}>
<View>
<Text style={{ paddingLeft: 20, paddingTop: 10, color: 'gray' }}>Tujuan</Text>
</View>
<View style={{ paddingRight: 30, paddingTop: 10, alignItems: 'flex-end' }}>
<Text style={{ color: '#ccb46c' }}>{this.props.address}</Text>
</View>
</View>
)}
<View style={{ margin: 20, }}>
<Button title='Checkout' color='#ccb46c' onPress={() => this.checkOut()} />
</View>
......
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