ordering-ui-react-native 0.12.39 → 0.12.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.12.39",
3
+ "version": "0.12.43",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -214,15 +214,15 @@ const CartUI = (props: any) => {
214
214
  {cart?.valid_products && (
215
215
  <CheckoutAction>
216
216
  <OButton
217
- text={(cart?.subtotal_to_calculate >= cart?.minimum || !cart?.minimum) && cart?.valid_address ? (
218
- !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')
219
- ) : !cart?.valid_address ? (
220
- `${t('OUT_OF_COVERAGE', 'Out of Coverage')}`
221
- ) : (
217
+ text={!cart?.valid_address ? (
218
+ t('OUT_OF_COVERAGE', 'Out of Coverage')
219
+ ) : !cart?.valid_maximum ? (
220
+ `${t('MAXIMUM_SUBTOTAL_ORDER', 'Maximum subtotal order')}: ${parsePrice(cart?.maximum)}`
221
+ ) : (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) ? (
222
222
  `${t('MINIMUN_SUBTOTAL_ORDER', 'Minimum subtotal order:')} ${parsePrice(cart?.minimum)}`
223
- )}
224
- bgColor={(cart?.subtotal_to_calculate < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
225
- isDisabled={(openUpselling && !canOpenUpselling) || cart?.subtotal_to_calculate < cart?.minimum || !cart?.valid_address}
223
+ ) : !openUpselling !== canOpenUpselling ? t('CHECKOUT', 'Checkout') : t('LOADING', 'Loading')}
224
+ bgColor={(!cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
225
+ isDisabled={(openUpselling && !canOpenUpselling) || !cart?.valid_maximum || (!cart?.valid_minimum && !(cart?.discount_type === 1 && cart?.discount_rate === 100)) || !cart?.valid_address}
226
226
  borderColor={theme.colors.primary}
227
227
  imgRightSrc={null}
228
228
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
@@ -250,7 +250,7 @@ export const OrderContentComponent = (props: OrderContent) => {
250
250
  {order?.customer?.zipcode}
251
251
  </OText>
252
252
  )}
253
- {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
253
+ {/* {!order?.user_review && pastOrderStatuses.includes(order?.status) && !isCustomerReviewed && (
254
254
  <OButton
255
255
  style={styles.btnReview}
256
256
  textStyle={{ color: theme.colors.white }}
@@ -258,7 +258,7 @@ export const OrderContentComponent = (props: OrderContent) => {
258
258
  imgRightSrc={false}
259
259
  onClick={() => setOpenReviewModal(true)}
260
260
  />
261
- )}
261
+ )} */}
262
262
  </OrderCustomer>
263
263
 
264
264
  <OrderProducts>
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import {
3
3
  ProductForm as ProductOptions,
4
4
  useSession,
@@ -9,7 +9,7 @@ import {
9
9
  import { useTheme } from 'styled-components/native';
10
10
  import { ProductIngredient } from '../ProductIngredient';
11
11
  import { ProductOption } from '../ProductOption';
12
- import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard } from 'react-native';
12
+ import { View, TouchableOpacity, StyleSheet, Dimensions, Platform, useWindowDimensions, Keyboard, KeyboardAvoidingView } from 'react-native';
13
13
 
14
14
  import {
15
15
  ProductHeader,
@@ -120,7 +120,7 @@ export const ProductOptionsUI = (props: any) => {
120
120
  const { top, bottom } = useSafeAreaInsets();
121
121
  const { height } = useWindowDimensions();
122
122
  const [selOpt, setSelectedOpt] = useState(0);
123
-
123
+ const scrollViewRef = useRef<any>()
124
124
  const isError = (id: number) => {
125
125
  let bgColor = theme.colors.white;
126
126
  if (errors[`id:${id}`]) {
@@ -241,6 +241,7 @@ export const ProductOptionsUI = (props: any) => {
241
241
  const keyboardDidShowListener = Keyboard.addListener(
242
242
  'keyboardDidShow',
243
243
  () => {
244
+ scrollViewRef?.current && scrollViewRef?.current?.scrollToEnd()
244
245
  setIsKeyboardShow(true);
245
246
  }
246
247
  );
@@ -259,7 +260,7 @@ export const ProductOptionsUI = (props: any) => {
259
260
 
260
261
  return (
261
262
  <>
262
- <ScrollView style={{ height: windowHeight * 0.85 }}>
263
+ <ScrollView ref={scrollViewRef}>
263
264
  {!error && (
264
265
  <>
265
266
  <WrapHeader>
@@ -560,7 +561,7 @@ export const ProductOptionsUI = (props: any) => {
560
561
  )}
561
562
  </>
562
563
  )}
563
- <ProductComment style={{ paddingBottom: isKeyboardShow ? 200 : 0 }}>
564
+ <ProductComment>
564
565
  <SectionTitle>
565
566
  <OText size={16} weight={'600'} lineHeight={24}>
566
567
  {t('SPECIAL_COMMENT', 'Special comment')}
@@ -597,7 +598,7 @@ export const ProductOptionsUI = (props: any) => {
597
598
  )}
598
599
  </ScrollView>
599
600
  {!loading && !error && product && (
600
- <ProductActions style={{ maxHeight: windowHeight * 0.15 }}>
601
+ <ProductActions>
601
602
  <OText size={16} lineHeight={24} weight={'600'}>
602
603
  {productCart.total ? parsePrice(productCart?.total) : ''}
603
604
  </OText>
@@ -59,9 +59,12 @@ export const WrapperSubOption = styled.View`
59
59
  `
60
60
 
61
61
  export const ProductComment = styled.View`
62
+ padding-bottom: 40px
62
63
  `
63
64
 
64
65
  export const ProductActions = styled.View`
66
+ position: absolute;
67
+ bottom: 0px;
65
68
  min-height: 70px;
66
69
  padding: 12px 40px;
67
70
  width: 100%;
@@ -72,7 +75,10 @@ export const ProductActions = styled.View`
72
75
  justify-content: space-between;
73
76
  border-top-width: 1px;
74
77
  border-top-color: ${(props: any) => props.theme.colors.border};
78
+ flex: 1;
79
+ flex-direction: row;
75
80
  `
81
+
76
82
  export const ExtraOptionWrap = styled.ScrollView`
77
83
  margin-horizontal: -40px;
78
84
  `;
@@ -114,8 +114,9 @@ const ProfileUI = (props: ProfileParams) => {
114
114
  console.log('ImagePicker Error: ', response.errorMessage);
115
115
  showToast(ToastType.Error, response.errorMessage);
116
116
  } else {
117
- if (response.uri) {
118
- const url = `data:${response.type};base64,${response.base64}`;
117
+ if (response?.assets?.[0]?.uri) {
118
+ const image = response?.assets?.[0]
119
+ const url = `data:${image?.type};base64,${image?.base64}`;
119
120
  handleButtonUpdateClick(null, true, url);
120
121
  } else {
121
122
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));