ordering-ui-react-native 0.18.69 → 0.18.71

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.69",
3
+ "version": "0.18.71",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react'
1
+ import React, { useEffect, useRef, useState } from 'react'
2
2
  import { formatSeconds } from '../../../utils'
3
3
  import { StyleSheet, TouchableOpacity } from 'react-native';
4
4
  import { useCountdownTimer } from '../../../../../../src/hooks/useCountdownTimer';
@@ -25,8 +25,7 @@ export const Otp = (props: otpParams) => {
25
25
  600, willVerifyOtpState)
26
26
 
27
27
  const [code, setCode] = useState('')
28
-
29
-
28
+ const inputRef = useRef<any>()
30
29
  const handleOnSubmit = () => {
31
30
  setAlertState({
32
31
  open: true,
@@ -49,6 +48,7 @@ export const Otp = (props: otpParams) => {
49
48
  useEffect(() => {
50
49
  if (code?.length === (pinCount || 6)) {
51
50
  handleLoginOtp(code)
51
+ inputRef?.current?.reset()
52
52
  }
53
53
  }, [code])
54
54
 
@@ -82,6 +82,7 @@ export const Otp = (props: otpParams) => {
82
82
  {formatSeconds(otpLeftTime)}
83
83
  </OText>
84
84
  <OtpInputs
85
+ ref={inputRef}
85
86
  autofillFromClipboard
86
87
  numberOfInputs={pinCount || 6}
87
88
  style={loginStyle.container}
@@ -166,7 +166,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
166
166
  <OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
167
167
  {event?.wallet_event
168
168
  ? walletName[event?.wallet_event?.wallet?.type]?.name
169
- : event?.paymethod?.name}
169
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
170
170
  </OText>
171
171
  ))}
172
172
  </Section>
@@ -9,7 +9,6 @@ const TitleWrapper = styled.View`
9
9
  padding-horizontal: 10px;
10
10
  `
11
11
  const TitleTopWrapper = styled.View`
12
- flex: 1;
13
12
  flex-direction: row;
14
13
  align-items: center;
15
14
  `
@@ -44,6 +43,7 @@ interface Props {
44
43
  paddingTop?: number,
45
44
  isVertical?: boolean,
46
45
  noMargin?: any
46
+ hideArrowLeft?: boolean
47
47
  }
48
48
 
49
49
  const NavBar = (props: Props) => {
@@ -54,8 +54,6 @@ const NavBar = (props: Props) => {
54
54
  background-color: ${theme.colors.white};
55
55
  padding: 10px 20px 20px 0px;
56
56
  flex-direction: row;
57
- justify-content: center;
58
- align-items: center;
59
57
  position: relative;
60
58
  `
61
59
 
@@ -64,16 +62,18 @@ const NavBar = (props: Props) => {
64
62
  }
65
63
  return (
66
64
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
67
- <OButton
68
- iconProps={{
69
- name: 'arrowleft',
70
- size: 26
71
- }}
72
- icon={AntDesignIcon}
73
- imgRightSrc={null}
74
- style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
75
- onClick={props?.onActionLeft}
76
- />
65
+ {!props.hideArrowLeft && (
66
+ <OButton
67
+ iconProps={{
68
+ name: 'arrowleft',
69
+ size: 26
70
+ }}
71
+ icon={AntDesignIcon}
72
+ imgRightSrc={null}
73
+ style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
74
+ onClick={props?.onActionLeft}
75
+ />
76
+ )}
77
77
  <TitleTopWrapper>
78
78
  {props.withIcon
79
79
  ? (
@@ -77,6 +77,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
77
77
  const [isServiceOpen, setIsServiceOpen] = useState(false)
78
78
  // const [setHeight, setHeightState] = useState({ height: new Animated.Value(0) })
79
79
  // const [setRotate, setRotateState] = useState({ angle: new Animated.Value(0) })
80
+ const [productQuantity, setProductQuantity] = useState(product.quantity.toString())
80
81
 
81
82
  const productInfo = () => {
82
83
  if (isCartProduct) {
@@ -120,6 +121,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
120
121
 
121
122
  const handleChangeQuantity = (value: string) => {
122
123
  if (!orderState.loading) {
124
+ setProductQuantity(value)
123
125
  if (parseInt(value) === 0) {
124
126
  onDeleteProduct && onDeleteProduct(product)
125
127
  } else {
@@ -209,7 +211,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
209
211
  <RNPickerSelect
210
212
  items={productOptions}
211
213
  onValueChange={handleChangeQuantity}
212
- value={product.quantity.toString()}
214
+ value={productQuantity}
213
215
  style={pickerStyle}
214
216
  useNativeAndroidPickerStyle={false}
215
217
  placeholder={{}}
@@ -3,6 +3,7 @@ import { Pressable, StyleSheet, View, ScrollView, TouchableOpacity, Platform } f
3
3
  import { useTheme } from 'styled-components/native'
4
4
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
5
  import FastImage from 'react-native-fast-image'
6
+ import NavBar from '../NavBar'
6
7
  import {
7
8
  WalletList,
8
9
  useLanguage,
@@ -119,51 +120,29 @@ const WalletsUI = (props: any) => {
119
120
 
120
121
  return (
121
122
  <>
122
- <Container>
123
+ <Container
124
+ pdng={Platform.OS === 'ios' ? '10px' : '0'}
125
+ >
123
126
  <Header>
124
127
  <View style={{
125
128
  ...{
126
129
  width: '100%',
127
130
  display: 'flex',
128
- flexDirection: 'row',
129
- alignItems: 'center',
130
- marginTop: 30,
131
- justifyContent: 'space-between',
132
- alignContent: 'center'
131
+ flexDirection: hideWalletsTheme ? 'column' : 'row',
132
+ justifyContent: hideWalletsTheme ? 'flex-start' : 'space-between',
133
+ alignItems: hideWalletsTheme ? 'flex-start' : 'center',
134
+ marginTop: hideWalletsTheme ? 0 : 10,
133
135
  },
134
136
  }}>
135
- {(!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout && (
136
- <OButton
137
- imgLeftStyle={{ width: 18 }}
138
- imgRightSrc={null}
139
- style={{
140
- borderWidth: 0,
141
- width: 26,
142
- height: 26,
143
- backgroundColor: '#FFF',
144
- borderColor: '#FFF',
145
- shadowColor: '#FFF',
146
- paddingLeft: 0,
147
- paddingRight: 0,
148
- }}
149
- onClick={goToBack}
150
- icon={AntDesignIcon}
151
- iconProps={{
152
- name: 'arrowleft',
153
- size: 26
154
- }}
155
- />
156
- )}
157
- <OText
158
- size={20}
159
- style={{
160
- marginLeft: (!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout ? 40 : 0,
161
- color: theme.colors.textNormal,
162
- }}
163
- weight={Platform.OS === 'ios' ? '600' : 'bold'}
164
- >
165
- {t('WALLETS', 'Wallets')}
166
- </OText>
137
+ <NavBar
138
+ title={t('WALLETS', 'Wallets')}
139
+ titleAlign={'center'}
140
+ onActionLeft={goToBack}
141
+ showCall={false}
142
+ paddingTop={10}
143
+ btnStyle={{ paddingLeft: 0 }}
144
+ hideArrowLeft={!hideWalletsTheme}
145
+ />
167
146
  {isChewLayout && (
168
147
  <OButton
169
148
  text={t('WALLET_HISTORY', 'Wallet history')}
@@ -172,7 +151,7 @@ const WalletsUI = (props: any) => {
172
151
  imgRightSrc={null}
173
152
  textStyle={{ fontSize: 12, color: theme.colors.disabled }}
174
153
  onClick={() => setOpenHistory(true)}
175
- style={{ borderRadius: 8, height: 40 }}
154
+ style={{ borderRadius: 8, height: 40, width: hideWalletsTheme ? '100%' : 150, marginTop: hideWalletsTheme ? 10 : 0 }}
176
155
  />
177
156
  )}
178
157
  </View>
@@ -1,13 +1,12 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- display: flex;
5
- flex-direction: column;
4
+ padding-horizontal: 20px;
5
+ padding-bottom: 20px;
6
+ padding-top: ${(props: any) => props.pdng};
6
7
  `
7
8
  export const Header = styled.View`
8
9
  flex-direction: row;
9
- align-items: center;
10
- justify-content: space-between;
11
10
  `
12
11
  export const SectionContent = styled.View`
13
12
  width: 100%;