ordering-ui-react-native 0.12.35 → 0.12.36

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.35",
3
+ "version": "0.12.36",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -2,6 +2,7 @@ import React 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'
5
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
5
6
 
6
7
  import RNPickerSelect from 'react-native-picker-select'
7
8
  import { Container } from './styles'
@@ -10,83 +11,99 @@ import { OIcon } from '../shared'
10
11
 
11
12
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
12
13
 
13
- const [orderState] = useOrder()
14
+ const [orderState] = useOrder()
14
15
 
15
- const theme = useTheme();
16
+ const theme = useTheme();
16
17
 
17
- const _pickerStyle = StyleSheet.create({
18
- inputAndroid: {
19
- color: theme.colors.white,
20
- borderWidth: 1,
21
- borderColor: theme.colors.clear,
22
- paddingHorizontal: 10,
23
- paddingEnd: 24,
24
- height: 40,
25
- backgroundColor: theme.colors.clear,
26
- },
27
- inputIOS: {
28
- color: theme.colors.white,
29
- paddingEnd: 24,
30
- height: 40,
31
- borderWidth: 1,
32
- borderColor: theme.colors.clear,
33
- backgroundColor: theme.colors.clear
34
- },
35
- icon: {
36
- width: 10,
37
- marginTop: 9,
38
- marginEnd: 10
39
- },
40
- placeholder: {
41
- color: theme.colors.secundaryContrast
42
- }
43
- })
18
+ const _pickerStyle = StyleSheet.create({
19
+ inputAndroid: {
20
+ color: theme.colors.white,
21
+ borderWidth: 1,
22
+ borderColor: theme.colors.clear,
23
+ paddingHorizontal: 10,
24
+ paddingEnd: 24,
25
+ height: 40,
26
+ backgroundColor: theme.colors.clear,
27
+ },
28
+ inputIOS: {
29
+ color: theme.colors.white,
30
+ paddingEnd: 24,
31
+ height: 40,
32
+ borderWidth: 1,
33
+ borderColor: theme.colors.clear,
34
+ backgroundColor: theme.colors.clear
35
+ },
36
+ icon: {
37
+ width: 10,
38
+ marginTop: 9,
39
+ marginEnd: 10
40
+ },
41
+ placeholder: {
42
+ color: theme.colors.secundaryContrast
43
+ }
44
+ })
44
45
 
45
- const {
46
- languagesState,
47
- currentLanguage,
48
- handleChangeLanguage,
49
- iconColor,
50
- pickerStyle
51
- } = props
46
+ const {
47
+ languagesState,
48
+ currentLanguage,
49
+ handleChangeLanguage,
50
+ iconColor,
51
+ pickerStyle
52
+ } = props
52
53
 
53
- const _languages = languagesState?.languages?.map((language: any) => {
54
- return {
55
- value: language?.code,
56
- label: language?.name,
57
- inputLabel: language?.name
58
- }
59
- })
60
- _languages && _languages.sort((a: any, b: any) =>
61
- (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
62
- )
54
+ const _languages = languagesState?.languages?.map((language: any) => {
55
+ return {
56
+ value: language?.code,
57
+ label: language?.name,
58
+ inputLabel: language?.name
59
+ }
60
+ })
61
+ _languages && _languages.sort((a: any, b: any) =>
62
+ (a.content > b.content) ? 1 : ((b.content > a.content) ? -1 : 0)
63
+ )
63
64
 
64
- return (
65
- <Container>
66
- {languagesState?.languages && (
67
- <>
68
- {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
69
- <RNPickerSelect
70
- onValueChange={handleChangeLanguage}
71
- items={_languages || []}
72
- value={currentLanguage}
73
- style={pickerStyle ? pickerStyle : _pickerStyle}
74
- useNativeAndroidPickerStyle={false}
75
- placeholder={{}}
76
- Icon={() => <View style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} /></View>}
77
- disabled={orderState.loading}
78
- />
79
- </>
80
- )}
81
- </Container>
82
- )
65
+ return (
66
+ languagesState?.loading && props.allowLoading ? (
67
+ <Container>
68
+ <Placeholder style={{ width: 100, paddingTop: 10 }} Animation={Fade}>
69
+ <PlaceholderLine height={20} style={{ paddingBottom: 0, marginBottom: 0 }} />
70
+ </Placeholder>
71
+ </Container>
72
+ ) : (
73
+ <Container>
74
+ {languagesState?.languages ? (
75
+ <>
76
+ {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
77
+ <RNPickerSelect
78
+ onValueChange={handleChangeLanguage}
79
+ items={_languages || []}
80
+ value={currentLanguage}
81
+ style={pickerStyle ? pickerStyle : _pickerStyle}
82
+ useNativeAndroidPickerStyle={false}
83
+ placeholder={{}}
84
+ Icon={() => (
85
+ <View
86
+ style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}
87
+ >
88
+ <OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} />
89
+ </View>
90
+ )}
91
+ disabled={orderState.loading}
92
+ />
93
+ </>
94
+ ) : (
95
+ <View style={{ height: 40 }} />
96
+ )}
97
+ </Container>
98
+ )
99
+ )
83
100
  }
84
101
 
85
102
  export const LanguageSelector = (props: LanguageSelectorParams) => {
86
- const LanguageProps = {
87
- ...props,
88
- UIComponent: LanguageSelectorUI
89
- }
103
+ const LanguageProps = {
104
+ ...props,
105
+ UIComponent: LanguageSelectorUI
106
+ }
90
107
 
91
- return <LanguageSelectorController {...LanguageProps} />
108
+ return <LanguageSelectorController {...LanguageProps} />
92
109
  }
@@ -36,7 +36,7 @@ import {
36
36
  OrderDriver,
37
37
  Map,
38
38
  } from './styles';
39
- import { OButton, OIcon, OModal, OText } from '../shared';
39
+ import { OButton, OIcon, OModal, OText, OLink } from '../shared';
40
40
  import { ProductItemAccordion } from '../ProductItemAccordion';
41
41
  import { TouchableOpacity } from 'react-native-gesture-handler';
42
42
  import { OrderDetailsParams } from '../../types';
@@ -487,19 +487,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
487
487
  {order?.business?.name}
488
488
  </OText>
489
489
  <Icons>
490
- <TouchableOpacity
491
- onPress={() =>
492
- props.navigation.navigate('Business', {
493
- store: businessData?.slug,
494
- })
495
- }
496
- style={{ paddingEnd: 5 }}>
497
- <OIcon
498
- src={theme.images.general.phone}
499
- width={16}
500
- color={theme.colors.disabled}
501
- />
502
- </TouchableOpacity>
490
+ {(!!order?.business?.cellphone || !!order?.business?.phone) && (
491
+ <View style={{ paddingEnd: 5 }}>
492
+ <OLink
493
+ url={`tel:${order?.business?.cellphone ?? order?.business?.phone}`}
494
+ >
495
+ <OIcon
496
+ src={theme.images.general.phone}
497
+ width={16}
498
+ color={theme.colors.disabled}
499
+ />
500
+ </OLink>
501
+ </View>
502
+ )}
503
503
  <TouchableOpacity
504
504
  style={{ paddingStart: 5 }}
505
505
  onPress={() => handleOpenMessagesForBusiness()}>