ordering-ui-react-native 0.12.4 → 0.12.5

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.4",
3
+ "version": "0.12.5",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -96,7 +96,7 @@ const CheckoutUI = (props: any) => {
96
96
  }
97
97
  })
98
98
 
99
- const { showToast } = useToast();
99
+ const [, { showToast }] = useToast();
100
100
  const [, t] = useLanguage();
101
101
  const [{ user }] = useSession();
102
102
  const [{ configs }] = useConfig();
@@ -514,7 +514,7 @@ export const Checkout = (props: any) => {
514
514
  onNavigationRedirect,
515
515
  } = props
516
516
 
517
- const { showToast } = useToast();
517
+ const [, { showToast }] = useToast();
518
518
  const [, t] = useLanguage();
519
519
  const [{ token }] = useSession();
520
520
  const [ordering] = useApi();
@@ -22,7 +22,7 @@ const ForgotPasswordUI = (props: any) => {
22
22
  handleButtonForgotPasswordClick,
23
23
  } = props;
24
24
  const [, t] = useLanguage();
25
- const { showToast } = useToast();
25
+ const [, { showToast }] = useToast();
26
26
  const { control, handleSubmit, errors } = useForm();
27
27
 
28
28
  const theme = useTheme();
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useCallback } from 'react'
2
2
  import { LanguageSelector as LanguageSelectorController, useOrder } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { Platform, StyleSheet, View } from 'react-native'
@@ -61,13 +61,19 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
61
61
  (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
62
62
  )
63
63
 
64
+ const changeLang = useCallback((lang) => {
65
+ if (lang !== currentLanguage || orderState.loading) {
66
+ handleChangeLanguage(lang);
67
+ }
68
+ }, []);
69
+
64
70
  return (
65
71
  <Container>
66
72
  {languagesState?.languages && (
67
73
  <>
68
74
  {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
69
75
  <RNPickerSelect
70
- onValueChange={handleChangeLanguage}
76
+ onValueChange={changeLang}
71
77
  items={_languages || []}
72
78
  value={currentLanguage}
73
79
  style={pickerStyle ? pickerStyle : _pickerStyle}
@@ -58,7 +58,7 @@ const LoginFormUI = (props: LoginParams) => {
58
58
  onNavigationRedirect,
59
59
  } = props;
60
60
 
61
- const { showToast } = useToast();
61
+ const [, { showToast }] = useToast();
62
62
  const [, t] = useLanguage();
63
63
  const [{ configs }] = useConfig();
64
64
  const [, { login }] = useSession();
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useState } from 'react';
2
- import { FlatList, TouchableOpacity, View, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
2
+ import { View, StyleSheet, KeyboardAvoidingView, Platform } from 'react-native';
3
3
  import {
4
4
  Placeholder,
5
5
  PlaceholderLine,
@@ -24,12 +24,10 @@ import { OText, OIcon, OModal, OButton } from '../shared';
24
24
  import {
25
25
  PMContainer,
26
26
  PMItem,
27
- PMCardSelected,
28
- PMCardItemContent,
29
27
  PMDropDownWrapper,
30
28
  PMDropDownCont
31
29
  } from './styles'
32
- import { getIconCard, flatArray } from '../../utils';
30
+ import { TouchableOpacity } from 'react-native-gesture-handler';
33
31
 
34
32
  const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
35
33
  // const stripeRedirectOptions = [
@@ -134,7 +132,7 @@ const PaymentOptionsUI = (props: any) => {
134
132
  />
135
133
  <OText
136
134
  size={10}
137
- style={{ marginStart: 12 }}
135
+ style={{ marginLeft: 12, marginRight: 12 }}
138
136
  color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
139
137
  >
140
138
  {t(item.gateway.toUpperCase(), item.name)}
@@ -151,8 +149,8 @@ const PaymentOptionsUI = (props: any) => {
151
149
  return (
152
150
  <PMContainer>
153
151
  {paymethodsList.paymethods.length > 0 && (
154
- <PMDropDownWrapper onPress={() => setShowMethods(true)}>
155
- <OText color={theme.colors.textSecondary} style={{marginStart: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
152
+ <PMDropDownWrapper onPress={() => setShowMethods(!isShowMethods)}>
153
+ <OText color={theme.colors.textSecondary} style={{marginLeft: 14, marginRight: 14}}>{paymethodSelected?.paymethod?.name || t('SELECT_PAYMENT_METHOD', 'Select Paymethod')}</OText>
156
154
  <OIcon color={theme.colors.textSecondary} width={16} src={theme.images.general.chevron_right} style={{transform: [{rotate: '90deg'}], marginEnd: 14}} />
157
155
  {isShowMethods && <PMDropDownCont>
158
156
  {
@@ -73,4 +73,5 @@ export const PMDropDownCont = styled.View`
73
73
  width: 100%;
74
74
  padding: 10px 16px;
75
75
  box-shadow: 0 2px 3px #0000004D;
76
- `;
76
+ border: 1px solid #EEE;
77
+ `;
@@ -142,7 +142,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
142
142
  activeOpacity={1}
143
143
  >
144
144
  <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
145
- <ContentInfo>
145
+ <ContentInfo style={{alignItems: 'center'}}>
146
146
  {product?.images && (
147
147
  <ProductImage>
148
148
  {isFromCheckout ? (
@@ -95,7 +95,7 @@ const SignupFormUI = (props: SignupParams) => {
95
95
  const showInputPhoneNumber =
96
96
  validationFields?.fields?.checkout?.cellphone?.enabled ?? false;
97
97
 
98
- const { showToast } = useToast();
98
+ const [, { showToast }] = useToast();
99
99
  const [, t] = useLanguage();
100
100
  const [, { login }] = useSession();
101
101
  const [{ configs }] = useConfig();
@@ -26,7 +26,7 @@ const StripeRedirectFormUI = (props: any) => {
26
26
  // // androidPayMode: 'test', // Android only
27
27
  // })
28
28
 
29
- const { showToast } = useToast();
29
+ const [, { showToast }] = useToast();
30
30
  const { control, handleSubmit, errors } = useForm();
31
31
 
32
32
  const [{ user }] = useSession();
@@ -62,7 +62,7 @@ export const UserFormDetailsUI = (props: any) => {
62
62
  });
63
63
 
64
64
  const [, t] = useLanguage();
65
- const { showToast } = useToast();
65
+ const [, { showToast }] = useToast();
66
66
  const { handleSubmit, control, errors, setValue } = useForm();
67
67
 
68
68
  const [{ user }] = useSession();
@@ -84,7 +84,7 @@ const ProfileListUI = (props: ProfileParams) => {
84
84
 
85
85
  const [{ user }] = useSession();
86
86
  const [, t] = useLanguage();
87
- const { showToast } = useToast();
87
+ const [, { showToast }] = useToast();
88
88
  const { errors } = useForm();
89
89
 
90
90
  const { height } = useWindowDimensions();
@@ -52,7 +52,7 @@ const ProfileUI = (props: ProfileParams) => {
52
52
 
53
53
  const [{ user }] = useSession();
54
54
  const [, t] = useLanguage();
55
- const { showToast } = useToast();
55
+ const [, { showToast }] = useToast();
56
56
  const { handleSubmit, errors, setValue, control } = useForm();
57
57
 
58
58
  const [phoneInputData, setPhoneInputData] = useState({
@@ -9,7 +9,7 @@ const bottomPosition = 20;
9
9
  export const Toast: React.FC = () => {
10
10
  const theme = useTheme();
11
11
  // const insets = useSafeAreaInsets();
12
- const { toastConfig, hideToast } = useToast();
12
+ const [, { toastConfig, hideToast }] = useToast();
13
13
  const opacity = React.useRef(new Animated.Value(0)).current;
14
14
 
15
15
  const fadeIn = React.useCallback(() => {