ordering-ui-react-native 0.12.18 → 0.12.19

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.
Files changed (91) hide show
  1. package/package.json +1 -1
  2. package/src/config.json +2 -2
  3. package/themes/business/src/components 2/AcceptOrRejectOrder/index.tsx +0 -389
  4. package/themes/business/src/components 2/AcceptOrRejectOrder/styles.tsx +0 -36
  5. package/themes/business/src/components 2/BusinessController/index.tsx +0 -155
  6. package/themes/business/src/components 2/BusinessController/styles.tsx +0 -19
  7. package/themes/business/src/components 2/Chat/index.tsx +0 -1152
  8. package/themes/business/src/components 2/Chat/styles.tsx +0 -12
  9. package/themes/business/src/components 2/Contacts/index.tsx +0 -299
  10. package/themes/business/src/components 2/Contacts/styles.tsx +0 -42
  11. package/themes/business/src/components 2/DriverMap/index.tsx +0 -525
  12. package/themes/business/src/components 2/FloatingButton/index.tsx +0 -141
  13. package/themes/business/src/components 2/FloatingButton/styles.tsx +0 -35
  14. package/themes/business/src/components 2/ForgotPasswordForm/index.tsx +0 -204
  15. package/themes/business/src/components 2/ForgotPasswordForm/styles.tsx +0 -11
  16. package/themes/business/src/components 2/GoogleMap/index.tsx +0 -347
  17. package/themes/business/src/components 2/Home/index.tsx +0 -111
  18. package/themes/business/src/components 2/Home/styles.tsx +0 -27
  19. package/themes/business/src/components 2/LanguageSelector/index.tsx +0 -124
  20. package/themes/business/src/components 2/LanguageSelector/lang_country.json +0 -152
  21. package/themes/business/src/components 2/LanguageSelector/styles.tsx +0 -17
  22. package/themes/business/src/components 2/LoginForm/index.tsx +0 -663
  23. package/themes/business/src/components 2/LoginForm/styles.tsx +0 -48
  24. package/themes/business/src/components 2/LogoutButton/index.tsx +0 -63
  25. package/themes/business/src/components 2/MapView/index.tsx +0 -317
  26. package/themes/business/src/components 2/MessagesOption/index.tsx +0 -337
  27. package/themes/business/src/components 2/MessagesOption/styles.tsx +0 -27
  28. package/themes/business/src/components 2/NewOrderNotification/index.tsx +0 -167
  29. package/themes/business/src/components 2/NewOrderNotification/styles.tsx +0 -8
  30. package/themes/business/src/components 2/NotFoundSource/index.tsx +0 -52
  31. package/themes/business/src/components 2/NotFoundSource/styles.tsx +0 -17
  32. package/themes/business/src/components 2/OrderDetails/Business.tsx +0 -683
  33. package/themes/business/src/components 2/OrderDetails/Delivery.tsx +0 -454
  34. package/themes/business/src/components 2/OrderDetails/OrderContentComponent.tsx +0 -391
  35. package/themes/business/src/components 2/OrderDetails/OrderHeaderComponent.tsx +0 -148
  36. package/themes/business/src/components 2/OrderDetails/styles.tsx +0 -84
  37. package/themes/business/src/components 2/OrderMessage/index.tsx +0 -344
  38. package/themes/business/src/components 2/OrderMessage/styles.tsx +0 -5
  39. package/themes/business/src/components 2/OrderSummary/index.tsx +0 -700
  40. package/themes/business/src/components 2/OrderSummary/styles.tsx +0 -61
  41. package/themes/business/src/components 2/OrdersOption/index.tsx +0 -755
  42. package/themes/business/src/components 2/OrdersOption/styles.tsx +0 -54
  43. package/themes/business/src/components 2/OrdersOptionBusiness/index.tsx +0 -51
  44. package/themes/business/src/components 2/OrdersOptionBusiness/styles.tsx +0 -8
  45. package/themes/business/src/components 2/OrdersOptionCity/index.tsx +0 -52
  46. package/themes/business/src/components 2/OrdersOptionCity/styles.tsx +0 -8
  47. package/themes/business/src/components 2/OrdersOptionDate/index.tsx +0 -52
  48. package/themes/business/src/components 2/OrdersOptionDate/styles.tsx +0 -8
  49. package/themes/business/src/components 2/OrdersOptionDelivery/index.tsx +0 -35
  50. package/themes/business/src/components 2/OrdersOptionDelivery/styles.tsx +0 -8
  51. package/themes/business/src/components 2/OrdersOptionDriver/index.tsx +0 -50
  52. package/themes/business/src/components 2/OrdersOptionDriver/styles.tsx +0 -8
  53. package/themes/business/src/components 2/OrdersOptionPaymethod/index.tsx +0 -49
  54. package/themes/business/src/components 2/OrdersOptionPaymethod/styles.tsx +0 -8
  55. package/themes/business/src/components 2/OrdersOptionStatus/index.tsx +0 -46
  56. package/themes/business/src/components 2/OrdersOptionStatus/styles.tsx +0 -8
  57. package/themes/business/src/components 2/PhoneInputNumber/index.tsx +0 -160
  58. package/themes/business/src/components 2/PhoneInputNumber/styles.tsx +0 -3
  59. package/themes/business/src/components 2/PreviousMessages/index.tsx +0 -304
  60. package/themes/business/src/components 2/PreviousMessages/styles.tsx +0 -32
  61. package/themes/business/src/components 2/PreviousOrders/index.tsx +0 -180
  62. package/themes/business/src/components 2/PreviousOrders/styles.tsx +0 -38
  63. package/themes/business/src/components 2/ProductItemAccordion/index.tsx +0 -301
  64. package/themes/business/src/components 2/ProductItemAccordion/styles.tsx +0 -61
  65. package/themes/business/src/components 2/SearchBar/index.tsx +0 -112
  66. package/themes/business/src/components 2/SignupForm/index.tsx +0 -530
  67. package/themes/business/src/components 2/SignupForm/styles.tsx +0 -16
  68. package/themes/business/src/components 2/StoresList/index.tsx +0 -208
  69. package/themes/business/src/components 2/StoresList/styles.tsx +0 -26
  70. package/themes/business/src/components 2/UserFormDetails/index.tsx +0 -513
  71. package/themes/business/src/components 2/UserFormDetails/styles.tsx +0 -40
  72. package/themes/business/src/components 2/UserProfileForm/index.tsx +0 -496
  73. package/themes/business/src/components 2/UserProfileForm/styles.tsx +0 -36
  74. package/themes/business/src/components 2/VerifyPhone/index.tsx +0 -201
  75. package/themes/business/src/components 2/VerifyPhone/styles.tsx +0 -43
  76. package/themes/business/src/components 2/shared/OAlert.tsx +0 -52
  77. package/themes/business/src/components 2/shared/OButton.tsx +0 -149
  78. package/themes/business/src/components 2/shared/OChatBubble.tsx +0 -100
  79. package/themes/business/src/components 2/shared/ODropDown.tsx +0 -195
  80. package/themes/business/src/components 2/shared/ODropDownCalendar.tsx +0 -328
  81. package/themes/business/src/components 2/shared/OFab.tsx +0 -54
  82. package/themes/business/src/components 2/shared/OIcon.tsx +0 -67
  83. package/themes/business/src/components 2/shared/OIconButton.tsx +0 -127
  84. package/themes/business/src/components 2/shared/OInput.tsx +0 -144
  85. package/themes/business/src/components 2/shared/OLink.tsx +0 -76
  86. package/themes/business/src/components 2/shared/OModal.tsx +0 -275
  87. package/themes/business/src/components 2/shared/OSegment.tsx +0 -86
  88. package/themes/business/src/components 2/shared/OText.tsx +0 -55
  89. package/themes/business/src/components 2/shared/OTextarea.tsx +0 -46
  90. package/themes/business/src/components 2/shared/OToast.tsx +0 -92
  91. package/themes/business/src/components 2/shared/index.tsx +0 -27
@@ -1,54 +0,0 @@
1
- import styled from 'styled-components/native';
2
-
3
- export const FiltersTab = styled.View`
4
- margin-bottom: 20px;
5
- `;
6
-
7
- export const TabsContainer = styled.View`
8
- width: ${({ width }: { width: number }) => `${width-42}px`};
9
- display: flex;
10
- flex-direction: row;
11
- justify-content: space-between;
12
- border-bottom-width: 1px;
13
- border-bottom-color: ${(props: any) => props.theme.colors.tabBar};
14
- `;
15
-
16
- export const Tag = styled.Pressable`
17
- background-color: ${({ isSelected }: { isSelected: string }) => isSelected};
18
- justify-content: center;
19
- align-items: center;
20
- min-height: 34px;
21
- padding: 4px 10px;
22
- border-radius: 50px;
23
- margin-right: 15px;
24
- `;
25
-
26
- export const IconWrapper = styled.View`
27
- flex-direction: row;
28
- align-items: center;
29
- `
30
-
31
- export const ModalContainer = styled.ScrollView`
32
- padding: 20px 40px 10px 40px;
33
- `
34
-
35
- export const ModalTitle = styled.Text`
36
- font-family: Poppins;
37
- font-style: normal;
38
- font-weight: 600;
39
- font-size: 20px;
40
- color: ${(props: any) => props.theme.colors.textGray};
41
- text-transform: capitalize;
42
- margin-bottom: 24px;
43
- `
44
-
45
- export const FilterBtnWrapper = styled.TouchableOpacity`
46
- background-color: ${(props: any) => props.theme.colors.inputDisabled};
47
- border-radius: 7.6px;
48
- margin-vertical: 5px;
49
- padding: 15px 20px;
50
- flex-direction: row;
51
- align-items: center;
52
- justify-content: space-between;
53
- margin-bottom: 24px;
54
- `
@@ -1,51 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useLanguage } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { BusinessList as BusinessListController } from 'ordering-components/native'
7
- import { Platform } from 'react-native'
8
-
9
- export const OrdersOptionBusinessUI = (props: any) => {
10
- const {
11
- search,
12
- onSearch,
13
- businessesList
14
- } = props
15
-
16
- const theme = useTheme();
17
- const [, t] = useLanguage();
18
- const [optionsList, setOptionsList] = useState([])
19
-
20
- useEffect(() => {
21
- const businesses: any = []
22
- for (const business of businessesList?.businesses) {
23
- businesses.push({value: business.id, content: business.name})
24
- }
25
- setOptionsList(businesses)
26
- }, [businessesList?.businesses])
27
-
28
- return (
29
- <Container isIos={Platform.OS === 'ios'}>
30
- <ODropDown
31
- options={optionsList}
32
- defaultValue={search.business}
33
- onSelect={(option: any) => onSearch({ ...search, business: option })}
34
- isModal
35
- bgcolor={theme.colors.inputDisabled}
36
- textcolor={theme.colors.unselectText}
37
- placeholder={t('SELECT_BUSINESS', 'Select Business')}
38
- dropViewMaxHeight={200}
39
- />
40
- </Container>
41
- );
42
- };
43
-
44
- export const OrdersOptionBusiness = (props: any) => {
45
- const ordersOptionBusinessProps = {
46
- ...props,
47
- propsToFetch: ['id', 'name'],
48
- UIComponent: OrdersOptionBusinessUI
49
- };
50
- return <BusinessListController {...ordersOptionBusinessProps} />
51
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 17;
7
- `}
8
- `;
@@ -1,52 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useLanguage } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { MainSearch as MainSearchController } from 'ordering-components/native'
7
- import { Platform } from 'react-native';
8
-
9
- export const OrdersOptionCityUI = (props: any) => {
10
- const {
11
- search,
12
- onSearch,
13
- allListValues
14
- } = props
15
-
16
- const theme = useTheme();
17
- const [, t] = useLanguage();
18
- const [optionsList, setOptionsList] = useState([])
19
-
20
- useEffect(() => {
21
- const cities: any = []
22
- for (const country of allListValues?.countries) {
23
- for (const city of country.cities) {
24
- cities.push({value: city.id, content: city.name})
25
- }
26
- }
27
- setOptionsList(cities)
28
- }, [allListValues?.countries])
29
-
30
- return (
31
- <Container isIos={Platform.OS === 'ios'}>
32
- <ODropDown
33
- options={optionsList}
34
- defaultValue={search.city}
35
- onSelect={(option: any) => onSearch({ ...search, city: option })}
36
- isModal
37
- bgcolor={theme.colors.inputDisabled}
38
- textcolor={theme.colors.unselectText}
39
- placeholder={t('SELECT_CITY', 'Select City')}
40
- dropViewMaxHeight={200}
41
- />
42
- </Container>
43
- );
44
- };
45
-
46
- export const OrdersOptionCity = (props: any) => {
47
- const ordersOptionCityProps = {
48
- ...props,
49
- UIComponent: OrdersOptionCityUI
50
- };
51
- return <MainSearchController {...ordersOptionCityProps} />;
52
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 18;
7
- `}
8
- `;
@@ -1,52 +0,0 @@
1
- import React from 'react';
2
- import { useLanguage } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDownCalendar from '../shared/ODropDownCalendar';
6
- import { Platform } from 'react-native'
7
-
8
- export const OrdersOptionDate = (props: any) => {
9
- const {
10
- search,
11
- onSearch
12
- } = props
13
-
14
- const theme = useTheme();
15
- const [, t] = useLanguage();
16
- const optionsList: any = [
17
- { value: 'today', content: t('TODAY', 'Today') },
18
- { value: 'yesterday', content: t('YESTERDAY', 'Yesterday') },
19
- { value: 'last_7days', content: t('LAST_7_DAYS', 'Last 7 days') },
20
- { value: 'last_30days', content: t('LAST_30_DAYS', 'Last 30 days') }
21
- ]
22
-
23
- const handleChangeOption = (option: any) => {
24
- if (option === 'calendar') {
25
- onSearch({...search, date: {...search.date, type: option}})
26
- } else {
27
- onSearch({...search, date: {from: '', to: '', type: option}})
28
- }
29
- }
30
-
31
- const handleChangeDate = (from: any, to: any) => {
32
- onSearch({...search, date: {...search.date, from: from, to: to}})
33
- }
34
-
35
- return (
36
- <Container isIos={Platform.OS === 'ios'}>
37
- <ODropDownCalendar
38
- options={optionsList}
39
- defaultValue={search.date.type}
40
- onSelect={(option: any) => handleChangeOption(option)}
41
- isModal
42
- bgcolor={theme.colors.inputDisabled}
43
- textcolor={theme.colors.unselectText}
44
- placeholder={t('SELECT_DATE', 'Select Date')}
45
- dropViewMaxHeight={500}
46
- isCalendar
47
- rangeDate={search.date}
48
- handleChangeDate={handleChangeDate}
49
- />
50
- </Container>
51
- );
52
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 20;
7
- `}
8
- `;
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { useLanguage } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { Platform } from 'react-native'
7
-
8
- export const OrdersOptionDelivery = (props: any) => {
9
- const {
10
- search,
11
- onSearch
12
- } = props
13
-
14
- const theme = useTheme();
15
- const [, t] = useLanguage();
16
- const optionsList: any = [
17
- { value: '1', content: t('DELIVERY', 'Delivery') },
18
- { value: '2', content: t('PICKUP', 'Pickup') }
19
- ]
20
-
21
- return (
22
- <Container isIos={Platform.OS === 'ios'}>
23
- <ODropDown
24
- options={optionsList}
25
- defaultValue={search.delivery_type}
26
- onSelect={(option: any) => onSearch({ ...search, delivery_type: option })}
27
- isModal
28
- bgcolor={theme.colors.inputDisabled}
29
- textcolor={theme.colors.unselectText}
30
- placeholder={t('SELECT_DELIVERY_TYPE', 'Select Delivery type')}
31
- dropViewMaxHeight={200}
32
- />
33
- </Container>
34
- );
35
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 16;
7
- `}
8
- `;
@@ -1,50 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useLanguage, DriverList as DriverListControllder } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { Platform } from 'react-native'
7
-
8
- export const OrdersOptionDriverUI = (props: any) => {
9
- const {
10
- search,
11
- onSearch,
12
- driverList
13
- } = props
14
-
15
- const theme = useTheme();
16
- const [, t] = useLanguage();
17
- const [optionsList, setOptionsList] = useState([])
18
-
19
- useEffect(() => {
20
- const drivers: any = []
21
- for (const driver of driverList?.drivers) {
22
- drivers.push({value: driver.id, content: driver.name})
23
- }
24
- setOptionsList(drivers)
25
- }, [driverList?.drivers])
26
-
27
- return (
28
- <Container isIos={Platform.OS === 'ios'}>
29
- <ODropDown
30
- options={optionsList}
31
- defaultValue={search.driver}
32
- onSelect={(option: any) => onSearch({ ...search, driver: option })}
33
- isModal
34
- bgcolor={theme.colors.inputDisabled}
35
- textcolor={theme.colors.unselectText}
36
- placeholder={t('SELECT_DRIVER', 'Select Driver')}
37
- dropViewMaxHeight={165}
38
- />
39
- </Container>
40
- );
41
- };
42
-
43
- export const OrdersOptionDriver = (props: any) => {
44
- const ordersOptionDriverProps = {
45
- ...props,
46
- propsToFetch: ['id', 'name', 'lastname'],
47
- UIComponent: OrdersOptionDriverUI
48
- };
49
- return <DriverListControllder {...ordersOptionDriverProps} />;
50
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 14;
7
- `}
8
- `;
@@ -1,49 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useLanguage, PaymethodList as PyamethodListControllder } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { Platform } from 'react-native'
7
-
8
- export const OrdersOptionPaymethodUI = (props: any) => {
9
- const {
10
- search,
11
- onSearch,
12
- paymethodList
13
- } = props
14
-
15
- const theme = useTheme();
16
- const [, t] = useLanguage();
17
- const [optionsList, setOptionsList] = useState([])
18
-
19
- useEffect(() => {
20
- const paymethods: any = []
21
- for (const paymethod of paymethodList?.paymethods) {
22
- paymethods.push({value: paymethod.id, content: paymethod.name})
23
- }
24
- setOptionsList(paymethods)
25
- }, [paymethodList?.paymethods])
26
-
27
- return (
28
- <Container isIos={Platform.OS === 'ios'}>
29
- <ODropDown
30
- options={optionsList}
31
- defaultValue={search.paymethod}
32
- onSelect={(option: any) => onSearch({ ...search, paymethod: option })}
33
- isModal
34
- bgcolor={theme.colors.inputDisabled}
35
- textcolor={theme.colors.unselectText}
36
- placeholder={t('SELECT_PAYMETHOD', 'Select Paymethod')}
37
- dropViewMaxHeight={200}
38
- />
39
- </Container>
40
- );
41
- };
42
-
43
- export const OrdersOptionPaymethod = (props: any) => {
44
- const ordersOptionPaymethodProps = {
45
- ...props,
46
- UIComponent: OrdersOptionPaymethodUI
47
- };
48
- return <PyamethodListControllder {...ordersOptionPaymethodProps} />;
49
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 15;
7
- `}
8
- `;
@@ -1,46 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
- import { useLanguage } from 'ordering-components/native';
3
- import { useTheme } from 'styled-components/native';
4
- import { Container } from './styles';
5
- import ODropDown from '../shared/ODropDown';
6
- import { Platform } from 'react-native'
7
-
8
- export const OrdersOptionStatus = (props: any) => {
9
- const {
10
- currentTabSelected,
11
- tabs,
12
- orderStatus,
13
- search,
14
- onSearch
15
- } = props
16
-
17
- const theme = useTheme();
18
- const [, t] = useLanguage();
19
- const [optionsList, setOptionsList] = useState([])
20
-
21
- useEffect(() => {
22
- if (!currentTabSelected || tabs?.length === 0 || orderStatus?.length === 0) return
23
- const currentTab = tabs?.find((tab: any) => tab.title === currentTabSelected)
24
- const _optionList: any = []
25
- for (const tag of currentTab?.tags) {
26
- const status = orderStatus.find((status: any) => status.key === tag)
27
- _optionList.push({value: tag, content: status.text})
28
- }
29
- setOptionsList(_optionList)
30
- }, [currentTabSelected, tabs, orderStatus])
31
-
32
- return (
33
- <Container isIos={Platform.OS === 'ios'}>
34
- <ODropDown
35
- options={optionsList}
36
- defaultValue={search.state}
37
- onSelect={(option: any) => onSearch({ ...search, state: option })}
38
- isModal
39
- bgcolor={theme.colors.inputDisabled}
40
- textcolor={theme.colors.unselectText}
41
- placeholder={t('SELECT_STATUS', 'Select Status')}
42
- dropViewMaxHeight={200}
43
- />
44
- </Container>
45
- );
46
- };
@@ -1,8 +0,0 @@
1
- import styled, { css } from 'styled-components/native';
2
-
3
- export const Container = styled.View`
4
- margin-bottom: 24px;
5
- ${(props: any) => props.isIos && css`
6
- z-index: 19;
7
- `}
8
- `;
@@ -1,160 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import { StyleSheet, View } from 'react-native';
3
- import PhoneInput from 'react-native-phone-number-input';
4
- import { useLanguage, useConfig } from 'ordering-components/native';
5
- import { useTheme } from 'styled-components/native';
6
- import { Wrapper } from './styles';
7
- import { OText, OIcon } from '../shared';
8
- import { PhoneInputParams } from '../../types';
9
- import { transformCountryCode } from '../../utils';
10
-
11
- export const PhoneInputNumber = (props: PhoneInputParams) => {
12
- const {
13
- data,
14
- handleData,
15
- defaultValue,
16
- defaultCode,
17
- forwardRef,
18
- textInputProps,
19
- flagProps,
20
- onSubmitEditing,
21
- } = props;
22
-
23
- const theme = useTheme();
24
- const [, t] = useLanguage();
25
- const [{ configs }] = useConfig();
26
- const phoneInput = useRef<PhoneInput>(null);
27
- const [userphoneNumber, setUserphoneNumber] = useState('');
28
-
29
- const handleChangeNumber = (number: any) => {
30
- setUserphoneNumber(number);
31
- };
32
-
33
- useEffect(() => {
34
- if ((defaultValue && userphoneNumber) || !defaultValue) {
35
- if (userphoneNumber === '') return;
36
- if (userphoneNumber) {
37
- const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
38
- const callingCode = phoneInput.current?.getCallingCode();
39
- const formattedNumber =
40
- phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
41
- const regex = /^[0-9]*$/;
42
- const cellphone =
43
- userphoneNumber.slice(0, 0) +
44
- userphoneNumber.slice(1, userphoneNumber.length);
45
- const validNumber = regex.test(cellphone);
46
- if ((!checkValid && formattedNumber?.number) || !validNumber) {
47
- handleData &&
48
- handleData({
49
- ...data,
50
- error: t(
51
- 'INVALID_ERROR_PHONE_NUMBER',
52
- 'The Phone Number field is invalid',
53
- ),
54
- });
55
- return;
56
- }
57
- handleData &&
58
- handleData({
59
- ...data,
60
- error: '',
61
- phone: {
62
- country_phone_code: callingCode,
63
- cellphone: formattedNumber?.number,
64
- },
65
- });
66
- } else {
67
- handleData &&
68
- handleData({
69
- ...data,
70
- error: '',
71
- phone: {
72
- country_phone_code: null,
73
- cellphone: null,
74
- },
75
- });
76
- }
77
- }
78
- }, [userphoneNumber]);
79
-
80
- const style = StyleSheet.create({
81
- input: {
82
- backgroundColor: theme.colors.white,
83
- borderRadius: 7.6,
84
- borderWidth: 1,
85
- borderColor: theme.colors.inputSignup,
86
- paddingVertical: 0,
87
- paddingLeft: 35,
88
- flexGrow: 2,
89
- flex: 1,
90
- height: 50,
91
- },
92
- });
93
-
94
- return (
95
- <Wrapper>
96
- <PhoneInput
97
- containerStyle={{ width: '100%' }}
98
- ref={phoneInput}
99
- defaultValue={userphoneNumber || defaultValue}
100
- defaultCode={
101
- defaultCode
102
- ? transformCountryCode(defaultCode)
103
- : configs?.default_country_code?.value
104
- }
105
- onChangeFormattedText={(text: string) => handleChangeNumber(text)}
106
- countryPickerProps={{
107
- withAlphaFilter: false,
108
- withFilter: false,
109
- closeButtonImageStyle: { width: 15, height: 15 },
110
- closeButtonImage: theme.images.general.close,
111
- }}
112
- textContainerStyle={style.input}
113
- codeTextStyle={{ display: 'none' }}
114
- placeholder={t('PHONE_NUMBER', 'Phone number')}
115
- textInputProps={{
116
- selectionColor: theme.colors.primary,
117
- placeholderTextColor: theme.colors.arrowColor,
118
- blurOnSubmit: true,
119
- onSubmitEditing,
120
- autoCompleteType: 'tel',
121
- // @ts-ignore
122
- ref: forwardRef,
123
- color: theme.colors.textGray,
124
- ...textInputProps,
125
- }}
126
- renderDropdownImage={
127
- <OIcon
128
- src={theme.images.general.chevronDown}
129
- width={16}
130
- height={16}
131
- color={theme.colors.arrowColor}
132
- />
133
- }
134
- flagButtonStyle={flagProps}
135
- />
136
-
137
- {!!data?.error && (
138
- <OText
139
- size={16}
140
- color={theme.colors.error}
141
- style={{ textAlign: 'center', marginTop: 5 }}>
142
- {data.error}
143
- </OText>
144
- )}
145
-
146
- <View
147
- style={{
148
- position: 'absolute',
149
- top: 15,
150
- left: 99,
151
- }}>
152
- <OIcon
153
- src={theme?.images?.general?.inputPhone}
154
- width={20}
155
- height={20}
156
- />
157
- </View>
158
- </Wrapper>
159
- );
160
- };
@@ -1,3 +0,0 @@
1
- import styled from 'styled-components/native';
2
-
3
- export const Wrapper = styled.View``;