ordering-ui-react-native 0.18.63 → 0.18.64
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,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='
|
|
94
|
-
value={
|
|
95
|
-
onChange={(val: any) =>
|
|
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}
|
|
@@ -260,9 +260,13 @@ const WalletsUI = (props: any) => {
|
|
|
260
260
|
</OText>
|
|
261
261
|
</BalanceElement>
|
|
262
262
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|