Commit 189f580d authored by Fred's avatar Fred

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

# Conflicts:
#	view/Outlets.js
parents 39002021 75aab192
import Axios from 'axios';
import Constants from 'expo-constants';
import { Alert } from 'react-native';
export default function CheckVersion(navigation) {
let version = Constants.manifest.version
Axios.get('https://excelsocrm.ravintoladev.com/cms/v2/detail/apps-version').then(respon => {
let version_server = respon.data.content5
let msg_res = respon.data.content6
if (version_server !== '2.0.1') {
Alert.alert(
'Update Version',
msg_res,
[
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel'
},
{ text: 'OK', onPress: () => navigation.navigate('UpdateVersion') }
],
{ cancelable: false }
);
}
}).catch(error => {
console.log(error)
})
}
\ No newline at end of file
...@@ -9,7 +9,8 @@ import { ...@@ -9,7 +9,8 @@ import {
TouchableOpacity, TouchableOpacity,
Alert, Alert,
Button, Button,
ImageBackground ImageBackground,
ActivityIndicator
} from 'react-native'; } from 'react-native';
import { StackActions } from '@react-navigation/native'; import { StackActions } from '@react-navigation/native';
...@@ -41,7 +42,8 @@ class Account extends React.Component { ...@@ -41,7 +42,8 @@ class Account extends React.Component {
premium: "", premium: "",
my_lat: 0, my_lat: 0,
my_long: 0, my_long: 0,
full_name: '' full_name: '',
indicator: true
} }
} }
...@@ -49,6 +51,9 @@ class Account extends React.Component { ...@@ -49,6 +51,9 @@ class Account extends React.Component {
this._getProfile() this._getProfile()
this._unsubscribe = this.props.navigation.addListener('focus', () => { this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator: true
})
this._getProfile() this._getProfile()
}); });
} }
...@@ -144,7 +149,8 @@ class Account extends React.Component { ...@@ -144,7 +149,8 @@ class Account extends React.Component {
img_card: img_card, img_card: img_card,
expire_date: expire, expire_date: expire,
premium: premium, premium: premium,
full_name: full_name full_name: full_name,
indicator: false
}) })
}).catch(error => { }).catch(error => {
...@@ -182,12 +188,23 @@ class Account extends React.Component { ...@@ -182,12 +188,23 @@ class Account extends React.Component {
} }
handleSettings() {
if (this.state.clickSettings == 8) {
this.props.navigation.navigate('SettingsScreen')
this.setState({ clickSettings: 0 })
} else {
new_count = this.state.clickSettings
this.setState({ clickSettings: new_count + 1 })
}
}
render() { render() {
const navigation = this.props.navigation const navigation = this.props.navigation
return ( return (
<View style={styles.container}> <View style={styles.container}>
<ScrollView> <ScrollView>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Profile')}>
<View style={{ flex: 1, height: 90 }}> <View style={{ flex: 1, height: 90 }}>
<View style={{ alignSelf: 'center' }}> <View style={{ alignSelf: 'center' }}>
<Image <Image
...@@ -200,10 +217,11 @@ class Account extends React.Component { ...@@ -200,10 +217,11 @@ class Account extends React.Component {
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center' }}> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center' }}>
{this.state.full_name} {this.state.full_name}
</Text> </Text>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Profile')}>
<Text style={{ fontFamily: 'Gotham-Light', color: '#838383', fontSize: 12, textAlign: 'center', top: 2 }}>View Profile</Text> <Text style={{ fontFamily: 'Gotham-Light', color: '#838383', fontSize: 12, textAlign: 'center', top: 2 }}>View Profile</Text>
</TouchableOpacity>
</View> </View>
</View> </View>
</TouchableOpacity>
{ {
this.props.set_card === false ? ( this.props.set_card === false ? (
...@@ -239,6 +257,12 @@ class Account extends React.Component { ...@@ -239,6 +257,12 @@ class Account extends React.Component {
<View style={styles.Card}> <View style={styles.Card}>
<View style={styles.card}> <View style={styles.card}>
<View style={styles.card}> <View style={styles.card}>
{
this.state.indicator ? (
<Card style={{ padding: 50, alignContent: 'center' }}>
<ActivityIndicator style={{ justifyContent: "center" }} size="large" color="#c9af6d" />
</Card>
) : (
<Card style={{ padding: 20, alignContent: 'center' }}> <Card style={{ padding: 20, alignContent: 'center' }}>
<View style={{ flexDirection: 'row', flex: 1, paddingBottom: 5 }}> <View style={{ flexDirection: 'row', flex: 1, paddingBottom: 5 }}>
<View style={{ flex: 0.5 }}> <View style={{ flex: 0.5 }}>
...@@ -265,11 +289,7 @@ class Account extends React.Component { ...@@ -265,11 +289,7 @@ class Account extends React.Component {
</View> </View>
</View> </View>
<View style={styles.line2}></View> <View style={styles.line2}></View>
{/* <Text style={{ textAlign: 'left', fontWeight: 'bold' }}>
{i18n.t('point')} {this.state.point}
</Text> */}
<View style={{ flexDirection: 'row', flex: 1 }}> <View style={{ flexDirection: 'row', flex: 1 }}>
<View style={{ flex: 0.3, justifyContent: 'center' }}> <View style={{ flex: 0.3, justifyContent: 'center' }}>
{/* <Text>{i18n.t('balance')}</Text> */} {/* <Text>{i18n.t('balance')}</Text> */}
...@@ -280,6 +300,8 @@ class Account extends React.Component { ...@@ -280,6 +300,8 @@ class Account extends React.Component {
</View> </View>
</View> </View>
</Card> </Card>
)
}
</View> </View>
</View> </View>
</View> </View>
......
...@@ -55,6 +55,7 @@ import WelcomeLog from './WelcomeLog'; ...@@ -55,6 +55,7 @@ import WelcomeLog from './WelcomeLog';
import RatingOrder from './RatingOrder'; import RatingOrder from './RatingOrder';
import UseBalance from './UseBalance'; import UseBalance from './UseBalance';
import PaymentCode from './PaymentCode'; import PaymentCode from './PaymentCode';
import UpdateVersion from './UpdateVersion';
enableScreens(); enableScreens();
...@@ -118,10 +119,10 @@ const BottomNavigation = ({ state, descriptors, navigation }) => { ...@@ -118,10 +119,10 @@ const BottomNavigation = ({ state, descriptors, navigation }) => {
testID={options.tabBarTestID} testID={options.tabBarTestID}
onPress={onPress} onPress={onPress}
onLongPress={onLongPress} onLongPress={onLongPress}
style={{ flex: 1, alignItems: 'center', backgroundColor: 'white', borderTopWidth:1, borderTopColor: '#f0f0f0' }} style={{ flex: 1, alignItems: 'center', backgroundColor: 'white', borderTopWidth: 1, borderTopColor: '#f0f0f0' }}
> >
<Image source={icon} style={{ height: 50, width: 50, tintColor: isFocused ? '#CFB368' : 'gray'}} /> <Image source={icon} style={{ height: 50, width: 50, tintColor: isFocused ? '#CFB368' : 'gray' }} />
</TouchableOpacity> </TouchableOpacity>
); );
...@@ -130,9 +131,9 @@ const BottomNavigation = ({ state, descriptors, navigation }) => { ...@@ -130,9 +131,9 @@ const BottomNavigation = ({ state, descriptors, navigation }) => {
) )
} }
function HomePage({navigation}) { function HomePage({ navigation }) {
return ( return (
<Tab.Navigator tabBar={props => <BottomNavigation {...props}/>} <Tab.Navigator tabBar={props => <BottomNavigation {...props} />}
// screenOptions={({ route }) => ({ // screenOptions={({ route }) => ({
// tabBarIcon: ({ focused, color, size }) => { // tabBarIcon: ({ focused, color, size }) => {
...@@ -237,6 +238,9 @@ class Auth extends React.Component { ...@@ -237,6 +238,9 @@ class Auth extends React.Component {
textAlign: 'center' textAlign: 'center'
}, title: 'PROFILE' }, title: 'PROFILE'
}} /> }} />
<Stack.Screen name="UpdateVersion" component={UpdateVersion}
options={{ headerShown: false }}
/>
<Stack.Screen name="Change Profil" component={ChangeProfile} options={{ <Stack.Screen name="Change Profil" component={ChangeProfile} options={{
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
headerTitleContainerStyle: { alignContent: 'center' }, headerTitleContainerStyle: { alignContent: 'center' },
...@@ -282,11 +286,14 @@ class Auth extends React.Component { ...@@ -282,11 +286,14 @@ class Auth extends React.Component {
textAlign: 'center' textAlign: 'center'
}, title: 'EMAIL CONFIRMATION' }, title: 'EMAIL CONFIRMATION'
}} /> }} />
<Stack.Screen name="Login" component={Login} options={{headerShown:false}} /> <Stack.Screen name="Login" component={Login} options={{ headerShown: false }} />
<Stack.Screen name="LoginWelcome" component={WelcomeLog} options={{ <Stack.Screen name="LoginWelcome" component={WelcomeLog} options={{
headerShown: false, headerShown: false,
}} /> }} />
<Stack.Screen name="Home" component={Home} options={{ headerShown: false }} /> <Stack.Screen name="Home" component={Home} options={{ headerShown: false }} />
<Stack.Screen name="UpdateVersion" component={UpdateVersion}
options={{ headerShown: false }}
/>
</> </>
) : ( ) : (
<> <>
...@@ -536,6 +543,10 @@ class Auth extends React.Component { ...@@ -536,6 +543,10 @@ class Auth extends React.Component {
}, title: 'RATING ORDER' }, title: 'RATING ORDER'
}} }}
/> />
<Stack.Screen name="UpdateVersion" component={UpdateVersion}
options={{ headerShown: false }}
/>
<Stack.Screen name="UseBalance" component={UseBalance} <Stack.Screen name="UseBalance" component={UseBalance}
options={{ options={{
headerStyle: { backgroundColor: '#CFB368' }, headerStyle: { backgroundColor: '#CFB368' },
......
...@@ -19,7 +19,7 @@ class EmailConfirmation extends React.Component { ...@@ -19,7 +19,7 @@ class EmailConfirmation extends React.Component {
} }
componentDidMount() { componentDidMount() {
// console.log("SESSION " + this.props.session_id) console.log("SESSION " + this.props.pageEmailConfirmation)
} }
handleSubmit() { handleSubmit() {
...@@ -115,13 +115,22 @@ class EmailConfirmation extends React.Component { ...@@ -115,13 +115,22 @@ class EmailConfirmation extends React.Component {
} }
handleCancel() { handleCancel() {
if (this.props.proses !== 'Register') {
let pageProps = { let pageProps = {
pageEmailConfirmation: false isEmailverif: false
}
this.props.setPage(pageProps)
this.props.navigation.navigate('Login');
} else {
let pageProps = {
isEmailverif: false
} }
this.props.setPage(pageProps) this.props.setPage(pageProps)
this.props.navigation.navigate('New Register'); this.props.navigation.navigate('New Register');
} }
}
handleResend() { handleResend() {
this.setState({ this.setState({
spinner: true, spinner: true,
...@@ -147,7 +156,7 @@ class EmailConfirmation extends React.Component { ...@@ -147,7 +156,7 @@ class EmailConfirmation extends React.Component {
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
Alert.alert('','Silahkan Cek Email Kembali'); Alert.alert('', 'Silahkan Cek Email Kembali');
this.setState({ this.setState({
spinner: false, spinner: false,
}) })
...@@ -186,6 +195,7 @@ class EmailConfirmation extends React.Component { ...@@ -186,6 +195,7 @@ class EmailConfirmation extends React.Component {
} }
render() { render() {
console.log(this.props.proses)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<MyStatusBar /> <MyStatusBar />
...@@ -216,9 +226,11 @@ class EmailConfirmation extends React.Component { ...@@ -216,9 +226,11 @@ class EmailConfirmation extends React.Component {
<TouchableOpacity style={{ height: 60 }} onPress={() => this.handleResend()}> <TouchableOpacity style={{ height: 60 }} onPress={() => this.handleResend()}>
<Text style={{ alignSelf: 'center', color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 20, top: 10 }}>RESEND EMAIL TOKEN</Text> <Text style={{ alignSelf: 'center', color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 20, top: 10 }}>RESEND EMAIL TOKEN</Text>
</TouchableOpacity> </TouchableOpacity>
{this.props.proses == 'Register' ? (
<TouchableOpacity style={{ height: 60 }} onPress={() => this.props.navigation.navigate('Change Email')}> <TouchableOpacity style={{ height: 60 }} onPress={() => this.props.navigation.navigate('Change Email')}>
<Text style={{ alignSelf: 'center', color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 20, }}>CHANGE EMAIL</Text> <Text style={{ alignSelf: 'center', color: '#CFB368', fontFamily: 'Gotham-Black', fontSize: 20, }}>CHANGE EMAIL</Text>
</TouchableOpacity> </TouchableOpacity>
) : (null)}
</View> </View>
</View> </View>
<View style={{ flex: 1, flexDirection: 'row' }}> <View style={{ flex: 1, flexDirection: 'row' }}>
......
...@@ -10,6 +10,7 @@ import { Card } from 'react-native-shadow-cards'; ...@@ -10,6 +10,7 @@ import { Card } from 'react-native-shadow-cards';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import info from '../app.json'; import info from '../app.json';
import session from '../function/session'; import session from '../function/session';
import CheckVersion from '../function/CheckVersion';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
import Toast from 'react-native-tiny-toast'; import Toast from 'react-native-tiny-toast';
...@@ -29,6 +30,7 @@ class Home extends React.Component { ...@@ -29,6 +30,7 @@ class Home extends React.Component {
my_lat: 0, my_lat: 0,
my_long: 0, my_long: 0,
indicator: true, indicator: true,
indicatorProfileCard: true,
slider_height: 350, slider_height: 350,
slugs: [], slugs: [],
placeholder: true placeholder: true
...@@ -36,9 +38,8 @@ class Home extends React.Component { ...@@ -36,9 +38,8 @@ class Home extends React.Component {
} }
componentDidMount() { componentDidMount() {
console.log('ini outlet id' + this.props.outlet_id) // const { navigation } = this.props
console.log('ini nama outlet ' + this.props.name_outlet) // CheckVersion(navigation)
console.log('ini alamat outlet ' + this.props.outlet_detailadress)
const screenWidth = Math.round(Dimensions.get('window').width); const screenWidth = Math.round(Dimensions.get('window').width);
this.setState({ this.setState({
...@@ -59,17 +60,19 @@ class Home extends React.Component { ...@@ -59,17 +60,19 @@ class Home extends React.Component {
this._unsubscribe = this.props.navigation.addListener('focus', () => { this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({ this.setState({
indicator: true, indicator: true,
indicatorProfileCard: true
}) })
this._account(); this._account();
if (this.props.outlet_id == '' && this.props.name_outlet == '' && this.props.outlet_detailadress == '') { if (this.props.outlet_id == '' && this.props.name_outlet == '' && this.props.outlet_detailadress == '') {
this._getPermissions() this._getPermissions()
} else { } else {
this.setState({ this.setState({
indicator: false indicator: false,
}) })
} }
this._renderCarousell() this._renderCarousell()
// CheckVersion(navigation)
}); });
} }
...@@ -155,7 +158,7 @@ class Home extends React.Component { ...@@ -155,7 +158,7 @@ class Home extends React.Component {
balance: balance, balance: balance,
account_number: account_number, account_number: account_number,
expire_date: expire, expire_date: expire,
indicator: false indicatorProfileCard: false
}) })
}).catch(error => { }).catch(error => {
let response = error.response.data let response = error.response.data
...@@ -372,7 +375,13 @@ class Home extends React.Component { ...@@ -372,7 +375,13 @@ class Home extends React.Component {
{ {
this.state.indicator == true ? (<ActivityIndicator style={{ top: 20, justifyContent: "center" }} size="large" color="#c9af6d" />) : this.state.indicatorProfileCard == true ? (
<View style={styles.card}>
<Card style={{ padding: 50, margin: 10, alignContent: 'center' }}>
<ActivityIndicator style={{ justifyContent: "center" }} size="large" color="#c9af6d" />
</Card>
</View>
) :
this.state.account_number === "" ? ( this.state.account_number === "" ? (
<View style={styles.card}> <View style={styles.card}>
<Card style={{ padding: 10, margin: 10, alignContent: 'center' }}> <Card style={{ padding: 10, margin: 10, alignContent: 'center' }}>
...@@ -662,6 +671,7 @@ const mapStateToProps = (state) => { ...@@ -662,6 +671,7 @@ const mapStateToProps = (state) => {
// login // login
in_payment: state.in_payment, in_payment: state.in_payment,
BASE_URL : state.BASE_URL,
email: state.email, email: state.email,
outlet_id: state.outlet_id, outlet_id: state.outlet_id,
name_outlet: state.name_outlet, name_outlet: state.name_outlet,
......
...@@ -43,8 +43,8 @@ class Item extends React.Component { ...@@ -43,8 +43,8 @@ class Item extends React.Component {
handleEdit = (item) => { handleEdit = (item) => {
let note = '' let note = ''
if (this.state.notes === '') { if (this.state.notes == '') {
note = item.note; note = '';
} else { } else {
note = this.state.notes; note = this.state.notes;
} }
......
...@@ -45,7 +45,7 @@ class ItemShoping extends React.Component { ...@@ -45,7 +45,7 @@ class ItemShoping extends React.Component {
handleEdit = (item) =>{ handleEdit = (item) =>{
let note = '' let note = ''
if (this.state.note === '') { if (this.state.note === '') {
note = item.note; note = '';
} else { } else {
note = this.state.note; note = this.state.note;
} }
......
...@@ -11,6 +11,7 @@ import { BASE_URL_LOGIN } from '../model/Base_Model'; ...@@ -11,6 +11,7 @@ import { BASE_URL_LOGIN } from '../model/Base_Model';
import { Notifications } from 'expo'; import { Notifications } from 'expo';
import Spinner from 'react-native-loading-spinner-overlay'; import Spinner from 'react-native-loading-spinner-overlay';
import Toast from 'react-native-tiny-toast'; import Toast from 'react-native-tiny-toast';
import CheckVersion from '../function/CheckVersion';
class Login extends React.Component { class Login extends React.Component {
constructor(props) { constructor(props) {
...@@ -31,11 +32,10 @@ class Login extends React.Component { ...@@ -31,11 +32,10 @@ class Login extends React.Component {
} }
componentDidMount() { componentDidMount() {
// console.log(this.props.language) const { navigation } = this.props
console.log(this.props.navigation)
CheckVersion(navigation)
this._getDeviceInfo() this._getDeviceInfo()
} }
_getDeviceInfo = async () => { _getDeviceInfo = async () => {
...@@ -166,7 +166,7 @@ class Login extends React.Component { ...@@ -166,7 +166,7 @@ class Login extends React.Component {
} }
let prosesProps = { let prosesProps = {
proses: 'Register' proses: ''
} }
this.props.setProses(prosesProps); this.props.setProses(prosesProps);
...@@ -185,8 +185,6 @@ class Login extends React.Component { ...@@ -185,8 +185,6 @@ class Login extends React.Component {
], ],
}) })
}).catch(error => { }).catch(error => {
let response = error.response.data; let response = error.response.data;
...@@ -228,11 +226,12 @@ class Login extends React.Component { ...@@ -228,11 +226,12 @@ class Login extends React.Component {
} }
render() { render() {
console.log(this.props.device_id)
console.log(this.props.os_name) // console.log(this.props.device_id)
console.log(this.props.fb_token) // console.log(this.props.os_name)
console.log(this.props.os_version) // console.log(this.props.fb_token)
console.log(this.props.app_version) // console.log(this.props.os_version)
// console.log(this.props.app_version)
return ( return (
<View style={styles.container}> <View style={styles.container}>
<Spinner <Spinner
......
import React from 'react'; import React from 'react';
import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity, Image } from 'react-native'; import { View, Text, TextInput, StyleSheet, Button, Alert, TouchableOpacity, Image, ImageBackground, ScrollView } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
import ActionType from '../redux/globalActionType'; import ActionType from '../redux/globalActionType';
...@@ -82,7 +82,7 @@ class NewPassword extends React.Component { ...@@ -82,7 +82,7 @@ class NewPassword extends React.Component {
textStyle={styles.spinnerTextStyle} textStyle={styles.spinnerTextStyle}
/> />
<View style={{ flex: 3 }}> <View style={{ flex: 3 }}>
<View style={{ flex: 1, marginRight: 30, marginLeft: 30, top: 50 }}> <View style={{ flex: 1, marginRight: 30, marginLeft: 30, top: 20 }}>
<Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Email</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#CFB368', fontSize: 20, textAlign: 'center', margin: 3 }}>Email</Text>
<Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 18, textAlign: 'center', margin: 3, marginBottom: 15 }}>{this.props.email}</Text> <Text style={{ fontFamily: 'Gotham-Black', color: '#838383', fontSize: 18, textAlign: 'center', margin: 3, marginBottom: 15 }}>{this.props.email}</Text>
...@@ -112,7 +112,7 @@ class NewPassword extends React.Component { ...@@ -112,7 +112,7 @@ class NewPassword extends React.Component {
<View style={{ flex: 1, flexDirection: 'row' }}> <View style={{ flex: 1, flexDirection: 'row' }}>
<View style={styles.v_logo}> <View style={styles.v_logo}>
<View style={{ flex: 1, alignSelf: 'flex-start' }}> <View style={{ flex: 1, alignSelf: 'flex-start' }}>
<Image resizeMode="contain" source={require('../assets/images/daun.png')} style={styles.logo}></Image> <Image resizeMode="contain" source={require('../assets/images/daun.png')} style={styles.logo} />
</View> </View>
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
</View> </View>
......
...@@ -38,17 +38,25 @@ class Outlets extends React.Component { ...@@ -38,17 +38,25 @@ class Outlets extends React.Component {
componentDidMount() { componentDidMount() {
this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator: true,
})
// this._getOutletClosest() // this._getOutletClosest()
this.OrderedList() this.OrderedList()
this._getPermissions() this._getPermissions()
});
// this._unsubscribe = this.props.navigation.addListener('focus', () => {
// this.setState({
// indicator: true,
// })
// // this._getOutletClosest()
// this.OrderedList()
// this._getPermissions()
// });
} }
// componentWillUnmount() {
// this._unsubscribe()
// }
_getPermissions = async () => { _getPermissions = async () => {
let { status } = await Permissions.askAsync(Permissions.LOCATION); let { status } = await Permissions.askAsync(Permissions.LOCATION);
if (status !== 'granted') { if (status !== 'granted') {
...@@ -176,7 +184,7 @@ class Outlets extends React.Component { ...@@ -176,7 +184,7 @@ class Outlets extends React.Component {
// let outletName = res.data.data.outlet_name // let outletName = res.data.data.outlet_name
// this.setState({ // this.setState({
// indicator: false, // // indicator: false,
// data_name: outletName // data_name: outletName
// }) // })
...@@ -315,12 +323,13 @@ class Outlets extends React.Component { ...@@ -315,12 +323,13 @@ class Outlets extends React.Component {
placeholder={{ label: 'All City' }} placeholder={{ label: 'All City' }}
onValueChange={(label) => this.filterData(label)} onValueChange={(label) => this.filterData(label)}
items={this.state.data_outlet} items={this.state.data_outlet}
style={{inputIOSContainer: {paddingVertical: 10, alignItems: 'center'}}} style={{ inputIOSContainer: { paddingVertical: 10, alignItems: 'center' } }}
/> />
</View> </View>
</View> </View>
<View style={styles.body}> <View style={styles.body}>
{this.state.dataOutlets.length > 0 ? ( {this.state.indicator ? (<ActivityIndicator style={{ top: 20, justifyContent: "center" }} size="large" color="#c9af6d" />) : (
this.state.dataOutlets.length > 0 ? (
<FlatList <FlatList
data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])} data={_.orderBy(this.state.dataOutlets, ['distance'], ['asc'])}
renderItem={this.RenderItem} renderItem={this.RenderItem}
...@@ -331,8 +340,8 @@ class Outlets extends React.Component { ...@@ -331,8 +340,8 @@ class Outlets extends React.Component {
onEndReachedThreshold={0.5} onEndReachedThreshold={0.5}
/> />
) : ( ) : (
<Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2', textAlign:'center' }}> Tidak Ada Outlets di area anda !</Text> <Text style={{ flexWrap: 'wrap', fontFamily: 'Gotham-Light', color: '#b1b1b2', textAlign: 'center' }}> Tidak Ada Outlets di area anda !</Text>
)} ))}
</View> </View>
</View> </View>
......
import React from 'react'; import React from 'react';
import { View, Text, Image, StyleSheet, ScrollView, Alert, TouchableOpacity } from 'react-native'; import { View, Text, Image, StyleSheet, ScrollView, Alert, TouchableOpacity, ActivityIndicator } from 'react-native';
import { Card } from 'react-native-shadow-cards' import { Card } from 'react-native-shadow-cards'
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Axios from 'axios'; import Axios from 'axios';
...@@ -9,13 +9,17 @@ class RewardsList extends React.Component { ...@@ -9,13 +9,17 @@ class RewardsList extends React.Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
rewardsList: [] rewardsList: [],
indicator: true
} }
} }
componentDidMount() { componentDidMount() {
this.getRewardsList() this.getRewardsList()
this._unsubscribe = this.props.navigation.addListener('focus', () => { this._unsubscribe = this.props.navigation.addListener('focus', () => {
this.setState({
indicator: true
})
this.getRewardsList() this.getRewardsList()
}); });
...@@ -38,7 +42,8 @@ class RewardsList extends React.Component { ...@@ -38,7 +42,8 @@ class RewardsList extends React.Component {
}) })
// console.log(data) // console.log(data)
this.setState({ this.setState({
rewardsList: data rewardsList: data,
indicator: false
}) })
}).catch(error => { }).catch(error => {
...@@ -55,6 +60,7 @@ class RewardsList extends React.Component { ...@@ -55,6 +60,7 @@ class RewardsList extends React.Component {
</View> </View>
<ScrollView style={styles.body}> <ScrollView style={styles.body}>
{ {
this.state.indicator ? (<ActivityIndicator style={{ top: 20, justifyContent: "center" }} size="large" color="#c9af6d" />) : (
this.state.rewardsList.length ? ( this.state.rewardsList.length ? (
this.state.rewardsList.map((item, key) => ( this.state.rewardsList.map((item, key) => (
<TouchableOpacity key={key} onPress={() => this.props.navigation.navigate('Reward Detail', { rewardId: item.id })}> <TouchableOpacity key={key} onPress={() => this.props.navigation.navigate('Reward Detail', { rewardId: item.id })}>
...@@ -67,11 +73,11 @@ class RewardsList extends React.Component { ...@@ -67,11 +73,11 @@ class RewardsList extends React.Component {
style={{ height: 100, width: '100%' }} /> style={{ height: 100, width: '100%' }} />
</View> </View>
<View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}> <View style={{ flex: 1, flexDirection: 'row', justifyContent: 'space-between', padding: 10 }}>
<View style={{ flex: 0.6}}> <View style={{ flex: 0.6 }}>
<Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>{item.reward.title}</Text> <Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Black', color: '#838383' }}>{item.reward.title}</Text>
<Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>{item.reward.subtitle}</Text> <Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>{item.reward.subtitle}</Text>
</View> </View>
<View style={{ flex: 0.4}}> <View style={{ flex: 0.4 }}>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>Expired On</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>Expired On</Text>
<Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>{item.expire_time}</Text> <Text style={{ textAlign: 'right', fontSize: 12, fontFamily: 'Gotham-Light', color: '#838383' }}>{item.expire_time}</Text>
</View> </View>
...@@ -84,7 +90,7 @@ class RewardsList extends React.Component { ...@@ -84,7 +90,7 @@ class RewardsList extends React.Component {
<View style={{ justifyContent: 'center', alignItems: 'center', height: 100 }}> <View style={{ justifyContent: 'center', alignItems: 'center', height: 100 }}>
<Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>No E-Voucher Available</Text> <Text style={{ textAlign: 'left', fontSize: 12, fontFamily: 'Gotham-Light', color: 'grey' }}>No E-Voucher Available</Text>
</View> </View>
) ))
} }
<TouchableOpacity style={{ marginVertical: 20 }} onPress={() => this.props.navigation.navigate('Reward History')}> <TouchableOpacity style={{ marginVertical: 20 }} onPress={() => this.props.navigation.navigate('Reward History')}>
<Text style={{ textAlign: 'center', color: '#CFB368', fontSize: 12, fontFamily: 'Gotham-Black' }}>REDEEM E-VOUCHER HISTORY</Text> <Text style={{ textAlign: 'center', color: '#CFB368', fontSize: 12, fontFamily: 'Gotham-Black' }}>REDEEM E-VOUCHER HISTORY</Text>
...@@ -103,7 +109,7 @@ const styles = StyleSheet.create({ ...@@ -103,7 +109,7 @@ const styles = StyleSheet.create({
}, },
header: { header: {
flex: 0.1, flex: 0.1,
marginBottom:5, marginBottom: 5,
backgroundColor: '#CFB368', backgroundColor: '#CFB368',
justifyContent: 'center' justifyContent: 'center'
}, },
......
import Axios from 'axios';
import React from 'react';
import { ScrollView, StyleSheet, Text, View, Image, StatusBar } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler';
import HTML from 'react-native-render-html';
import { Collapse, CollapseHeader, CollapseBody, AccordionList } from 'accordion-collapse-react-native'
import { getStatusBarHeight } from 'react-native-status-bar-height';
import MyStatusBar from './MyStatusBar';
export default class UpdateVersion extends React.Component {
constructor(props) {
super(props);
this.state = {
}
}
componentDidMount() {
}
render() {
return (
<View style={{ justifyContent: 'center', alignItems: 'center', flex: 1, backgroundColor:'white' }}>
<Text>Mohon update aplikasi terlebih dahulu</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white'
},
headerTitle: {
flex: 1,
textAlign: 'center',
margin: 20,
fontSize: 23,
alignSelf: 'center',
color: 'white',
fontFamily: 'Gotham-Black'
},
image_container: (height) => ({
height: height,
backgroundColor: 'gray'
}),
image: (height) => ({
width: '100%',
height: height
}),
title: {
textAlign: 'center',
fontFamily: 'Gotham-Black',
fontSize: 22,
marginBottom: 10,
color: '#CFB368'
},
content: {
paddingHorizontal: 20,
paddingVertical: 25
},
item_container: {
borderColor: 'gray',
borderWidth: 1,
borderRadius: 10,
marginBottom: 20,
color: '#adadad'
},
item_title: {
fontSize: 18,
color: '#adadad',
fontFamily: 'Gotham-Black',
flex: 1,
alignSelf: 'center',
},
item_image: {
width: 96,
height: 28,
alignItems: 'flex-end'
}
})
\ No newline at end of file
import * as React from 'react'; import * as React from 'react';
import { Button, View, Text, TextInput, StyleSheet, Alert, Platform, Image, TouchableOpacity, StatusBar, ImageBackground, ScrollView } from 'react-native'; import { Button, View, Text, TextInput, StyleSheet, Alert, Platform, Image, TouchableOpacity, StatusBar, ImageBackground, ScrollView } from 'react-native';
import Spinner from 'react-native-loading-spinner-overlay'; import Spinner from 'react-native-loading-spinner-overlay';
import CheckVersion from '../function/CheckVersion';
export default class WelcomeLog extends React.Component { export default class WelcomeLog extends React.Component {
constructor(props) { constructor(props) {
...@@ -11,7 +12,8 @@ export default class WelcomeLog extends React.Component { ...@@ -11,7 +12,8 @@ export default class WelcomeLog extends React.Component {
} }
componentDidMount() { componentDidMount() {
// console.log(this.props.language) const { navigation } = this.props
CheckVersion(navigation)
} }
......
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