ordering-ui-react-native 0.17.25-release → 0.17.26-release
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}
|
|
@@ -121,17 +121,17 @@ const WalletsUI = (props: any) => {
|
|
|
121
121
|
<>
|
|
122
122
|
<Container>
|
|
123
123
|
<Header>
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
124
|
+
<View style={{
|
|
125
|
+
...{
|
|
126
|
+
width: '100%',
|
|
127
|
+
display: 'flex',
|
|
128
|
+
flexDirection: 'row',
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
marginTop: 30,
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
alignContent: 'center'
|
|
133
|
+
},
|
|
134
|
+
}}>
|
|
135
135
|
{(!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout && (
|
|
136
136
|
<OButton
|
|
137
137
|
imgLeftStyle={{ width: 18 }}
|
|
@@ -145,7 +145,6 @@ const WalletsUI = (props: any) => {
|
|
|
145
145
|
shadowColor: '#FFF',
|
|
146
146
|
paddingLeft: 0,
|
|
147
147
|
paddingRight: 0,
|
|
148
|
-
marginTop: 30,
|
|
149
148
|
}}
|
|
150
149
|
onClick={goToBack}
|
|
151
150
|
icon={AntDesignIcon}
|
|
@@ -260,9 +259,13 @@ const WalletsUI = (props: any) => {
|
|
|
260
259
|
</OText>
|
|
261
260
|
</BalanceElement>
|
|
262
261
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
262
|
+
{currentWalletSelected?.type === 'cash' && (
|
|
263
|
+
<>
|
|
264
|
+
<View style={styles.dividerStyle} />
|
|
265
|
+
<GiftCardUI navigation={navigation} />
|
|
266
|
+
<View style={styles.dividerStyle} />
|
|
267
|
+
</>
|
|
268
|
+
)}
|
|
266
269
|
|
|
267
270
|
{!isChewLayout && (
|
|
268
271
|
<WalletTransactions
|