ordering-ui-react-native 0.18.63 → 0.18.65

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.18.63",
3
+ "version": "0.18.65",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -77,7 +77,7 @@ export const GPSButton = (props: any) => {
77
77
  useEffect(() => {
78
78
  if (isIntGeoCoder) return
79
79
  Geocoder.init(apiKey);
80
- }, [])
80
+ }, [isIntGeoCoder])
81
81
 
82
82
  return (
83
83
  <GpsButtonStyle
@@ -1,4 +1,4 @@
1
- import React, { useEffect } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import {
3
3
  useLanguage, useUtils, RedeemGiftCard as RedeemGiftCardController
4
4
  } from 'ordering-components/native'
@@ -26,6 +26,8 @@ const RedeemGiftCardUI = (props: any) => {
26
26
  const { handleSubmit, control, errors } = useForm()
27
27
  const [{ parsePrice }] = useUtils()
28
28
 
29
+ const [codeValue, setCodeValue] = useState('')
30
+
29
31
  const style = StyleSheet.create({
30
32
  btnStyle: {
31
33
  borderRadius: 7.6,
@@ -43,6 +45,14 @@ const RedeemGiftCardUI = (props: any) => {
43
45
  handleApply(values)
44
46
  }
45
47
 
48
+ const handleChangeCode = (string: any) => {
49
+ string = string.replace(/-/g, '')
50
+ if (!string) return
51
+ const codeSlices = string.match(/.{1,4}/g)
52
+ string = codeSlices.join('-')
53
+ setCodeValue(string)
54
+ }
55
+
46
56
  useEffect(() => {
47
57
  if (Object.keys(errors).length > 0) {
48
58
  const list = Object.values(errors)
@@ -90,9 +100,12 @@ const RedeemGiftCardUI = (props: any) => {
90
100
  control={control}
91
101
  render={({ onChange, value }: any) => (
92
102
  <OInput
93
- placeholder='0000 0000'
94
- value={value}
95
- onChange={(val: any) => onChange(val)}
103
+ placeholder='XXXX-XXXX-XXXX-XXXX'
104
+ value={codeValue}
105
+ onChange={(val: any) => {
106
+ onChange(val)
107
+ handleChangeCode(val)
108
+ }}
96
109
  autoCapitalize='none'
97
110
  autoCorrect={false}
98
111
  blurOnSubmit={false}
@@ -53,7 +53,6 @@ const MultiCheckoutUI = (props: any) => {
53
53
  navigation,
54
54
  placing,
55
55
  openCarts,
56
- totalCartsPrice,
57
56
  handleGroupPlaceOrder,
58
57
  paymethodSelected,
59
58
  handleSelectPaymethod,
@@ -99,6 +98,8 @@ const MultiCheckoutUI = (props: any) => {
99
98
  }
100
99
  }
101
100
 
101
+ const totalCartsPrice = cartGroup?.result?.balance
102
+
102
103
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
103
104
  ? JSON.parse(configs?.driver_tip_options?.value) || []
104
105
  : configs?.driver_tip_options?.value || []
@@ -260,9 +260,13 @@ const WalletsUI = (props: any) => {
260
260
  </OText>
261
261
  </BalanceElement>
262
262
 
263
- <View style={styles.dividerStyle} />
264
- <GiftCardUI navigation={navigation} />
265
- <View style={styles.dividerStyle} />
263
+ {currentWalletSelected?.type === 'cash' && (
264
+ <>
265
+ <View style={styles.dividerStyle} />
266
+ <GiftCardUI navigation={navigation} />
267
+ <View style={styles.dividerStyle} />
268
+ </>
269
+ )}
266
270
 
267
271
  {!isChewLayout && (
268
272
  <WalletTransactions