Commit 7d15e57f authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo

bug fatal error di tab mane selection

parent 0dae9f18
......@@ -68,7 +68,7 @@ class Item extends React.Component {
{item.code == 'CATEGORY' ? (
<Text style={{ fontSize: 15, color: '#c9af6d', fontFamily: 'Gotham-Black' }}>{item.name}</Text>
) : (
<View style={{ flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 1, flexDirection: 'row', height: 100 }}>
<Modal animationType="slide"
transparent={true}
visible={this.state.modalVisible}
......@@ -85,7 +85,6 @@ class Item extends React.Component {
style={styles.textInput}
onChangeText={(notes) => this.setState({ notes })}
textAlign='center'
>
{item.note}
</TextInput>
......@@ -105,12 +104,13 @@ class Item extends React.Component {
</View>
</View>
</Modal>
<View style={{ flex: 1 }}>
<View style={{ flex: 1, height: 100 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Menu Detail', { nameMenu: item.name, desc: item.description, image: item.image })}>
<Image source={{ uri: item.image }} style={{ height: 100, width: 100, borderRadius: 10, }}></Image>
{/* <Image source={{ uri: item.image }} style={{ height: 100, width: 100, borderRadius: 10, }}></Image> */}
<Image style={{ height: 100, width: 100, borderRadius: 10, }} source={item.image ? {uri: item.image } : null} />
</TouchableOpacity>
</View>
<View style={{ flex: 2 }}>
<View style={{ flex: 1, height: 100 }}>
<View style={{ marginLeft: 5, marginRight: 5 }}>
{
item.motm ? (
......
import React from 'react';
import { View, Text, StyleSheet, ScrollView, Platform, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator, Alert,Modal } from 'react-native';
import { View, Text, StyleSheet, ScrollView, Platform, TouchableOpacity, Image, FlatList, Button, StatusBar, ActivityIndicator, Alert, Modal } from 'react-native';
import Axios from 'axios';
import Item from './Item';
import { connect } from 'react-redux';
......@@ -31,7 +31,7 @@ class MenuSelection extends React.Component {
indicator: true,
my_lat: 0,
my_long: 0,
note :''
note: ''
}
}
......@@ -98,13 +98,13 @@ class MenuSelection extends React.Component {
_getOutletClosest() {
let params = Object.assign(requestParams,{
let params = Object.assign(requestParams, {
session_id: this.props.session_id,
lat: this.state.my_lat,
long: this.state.my_long
})
// console.log(params);
Axios.post(this.props.BASE_URL+'crm/v2/outlet/get_closest', params).then((res) => {
Axios.post(this.props.BASE_URL + 'crm/v2/outlet/get_closest', params).then((res) => {
let outletId = res.data.data.outlet_id
......@@ -127,11 +127,11 @@ class MenuSelection extends React.Component {
getMenuList() {
let params = Object.assign(requestParams,{
let params = Object.assign(requestParams, {
outlet_id: this.props.outlet_id
})
// console.log("INI YA " + params)
Axios.post(this.props.BASE_URL+'crm/v2/menu/get_list', params).then(res => {
Axios.post(this.props.BASE_URL + 'crm/v2/menu/get_list', params).then(res => {
let data = res.data.data
// console.log("INI DATANYA" + JSON.stringify(data))
......@@ -206,9 +206,7 @@ class MenuSelection extends React.Component {
}
scrollToItem = () => {
this.props._scrollView.scrollTo({ y: 1 * 100 });
}
handleAdd(item, index) {
......@@ -296,7 +294,7 @@ class MenuSelection extends React.Component {
scrollToIndex = (item) => {
index = _.findIndex(this.props.menu_item, ['name', item.name])
if (index > -1) {
this.flatListRef.scrollToIndex({animated: true, index: index});
this.flatListRef.scrollToIndex({ animated: true, index: index });
}
}
......@@ -304,7 +302,7 @@ class MenuSelection extends React.Component {
return (
<View style={styles.container}>
{Platform.OS === 'ios' ? (
<CustomIosStatusBar color='#CFB368'/>
<CustomIosStatusBar color='#CFB368' />
) : (
<StatusBar backgroundColor='#CFB368' />
)}
......@@ -317,7 +315,7 @@ class MenuSelection extends React.Component {
/>
</View>
<View style={{ height: 1, backgroundColor: 'grey', marginRight: 10, marginLeft: 10, marginTop: 5, }}></View>
<View style={{ flex: 3,marginRight:10,marginLeft:10 }}>
<View style={{ flex: 3, marginRight: 10, marginLeft: 10 }}>
{this.state.indicator == true ? (
<ActivityIndicator style={{ top: 10 }} size="large" color="#c9af6d" />
) : (
......@@ -330,8 +328,14 @@ class MenuSelection extends React.Component {
handleMin={() => this.handleMin(item, index)}
/>
)}
getItemLayout={(data, index) => (
{ length: 100, offset: 100 * index, index }
)}
keyExtractor={item => item.id}
ref={(ref) => { this.flatListRef = ref; }}
initialNumToRender={5}
maxToRenderPerBatch={10}
windowSize={10}
/>
)}
</View>
......@@ -339,13 +343,12 @@ class MenuSelection extends React.Component {
</View>
<View style={{ height: 1, backgroundColor: 'grey', marginRight: 10, marginLeft: 10, marginTop: 5, }}></View>
<View style={{ height: 70 }}>
<View style={{ flex: 1, flexDirection: 'row' }}>
<View style={{ flex: 1, justifyContent:'flex-start' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', textAlign: 'center', top: 10, color:'#838383' }}>{this.props.order_quantity} Item {this.props.type_pickup == true ? (null) : (
<NumberFormat decimalScale={0} value={this.props.grabamount} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color:'#838383' }}>/ {i18n.t('rateDelivery')} Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<View style={{ flex: 1, justifyContent: 'flex-start' }}>
<Text style={{ fontSize: 12, fontFamily: 'Gotham-Black', textAlign: 'center', top: 10, color: '#838383' }}>{this.props.order_quantity} Item {this.props.type_pickup == true ? (null) : (
<NumberFormat decimalScale={0} value={this.props.grabamount} renderText={value => <Text style={{ fontSize: 12, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color: '#838383' }}>/ {i18n.t('rateDelivery')} Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
)} </Text>
<NumberFormat decimalScale={0} value={this.props.order_total} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color:'#838383' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
<NumberFormat decimalScale={0} value={this.props.order_total} renderText={value => <Text style={{ fontSize: 20, fontFamily: 'Gotham-Light', top: 20, textAlign: 'center', color: '#838383' }}>Rp. {value}</Text>} displayType={'text'} thousandSeparator={true} prefix={''} />
</View>
<View style={{ flex: 1, height: 100 }}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Shopping Cart')}>
......
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