ordering-ui-react-native 0.17.24 → 0.17.26

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.17.24",
3
+ "version": "0.17.26",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,7 +1,7 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
  import { LanguageSelector as LanguageSelectorController, useOrder, useLanguage } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
- import { Platform, StyleSheet, View } from 'react-native'
4
+ import { StyleSheet, View } from 'react-native'
5
5
 
6
6
  import RNPickerSelect from 'react-native-picker-select'
7
7
  import { Container, DummyContainer } from './styles'
@@ -9,10 +9,17 @@ import { LanguageSelectorParams } from '../../types'
9
9
  import { OIcon } from '../shared'
10
10
 
11
11
  const LanguageSelectorUI = (props: LanguageSelectorParams) => {
12
+ const {
13
+ languagesState,
14
+ currentLanguage,
15
+ handleChangeLanguage,
16
+ iconColor,
17
+ pickerStyle
18
+ } = props
12
19
 
13
20
  const [orderState] = useOrder()
14
21
  const [state] = useLanguage()
15
-
22
+ const [languagePressed, setLanguagePressed] = useState(currentLanguage)
16
23
  const theme = useTheme();
17
24
 
18
25
  const _pickerStyle = StyleSheet.create({
@@ -42,14 +49,11 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
42
49
  color: theme.colors.secundaryContrast
43
50
  }
44
51
  })
45
-
46
- const {
47
- languagesState,
48
- currentLanguage,
49
- handleChangeLanguage,
50
- iconColor,
51
- pickerStyle
52
- } = props
52
+
53
+ const changeLanguage = (lang : string) => {
54
+ setLanguagePressed(lang)
55
+ handleChangeLanguage(lang)
56
+ }
53
57
 
54
58
  const _languages = languagesState?.languages?.map((language: any) => {
55
59
  return {
@@ -68,14 +72,14 @@ const LanguageSelectorUI = (props: LanguageSelectorParams) => {
68
72
  <>
69
73
  {iconColor && <OIcon src={theme.images.general.language} color={iconColor} style={{ marginEnd: 14 }} width={16} />}
70
74
  <RNPickerSelect
71
- onValueChange={handleChangeLanguage}
75
+ onValueChange={changeLanguage}
72
76
  items={_languages || []}
73
77
  value={currentLanguage}
74
78
  style={pickerStyle ? pickerStyle : _pickerStyle}
75
79
  useNativeAndroidPickerStyle={false}
76
80
  placeholder={{}}
77
81
  Icon={() => <View style={pickerStyle ? pickerStyle.icon : _pickerStyle.icon}><OIcon src={theme.images.general.arrow_down} color={theme.colors.white} style={{ width: '100%' }} /></View>}
78
- disabled={orderState.loading || state.loading}
82
+ disabled={orderState.loading || state.loading || state?.language?.code !== languagePressed}
79
83
  />
80
84
  </>
81
85
  ) : <DummyContainer />}
@@ -10,6 +10,7 @@ import {
10
10
  useConfig
11
11
  } from 'ordering-components/native';
12
12
  import { useTheme } from 'styled-components/native';
13
+ import { showLocation } from 'react-native-map-link';
13
14
  import {
14
15
  OrderDetailsContainer,
15
16
  Header,
@@ -116,6 +117,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
116
117
  const { order, businessData } = props.order;
117
118
  const mapValidStatuses = [9, 19, 23]
118
119
  const placeSpotTypes = [3, 4, 5]
120
+ const directionTypes = [2, 3, 4, 5]
119
121
 
120
122
  const walletName: any = {
121
123
  cash: {
@@ -743,6 +745,26 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
743
745
  {order?.business?.address}
744
746
  </OText>
745
747
  </View>
748
+ {directionTypes.includes(order?.delivery_type) && (
749
+ <OButton
750
+ text={t('GET_DIRECTIONS', 'Get Directions')}
751
+ imgRightSrc=''
752
+ textStyle={{ color: theme.colors.white }}
753
+ style={{
754
+ alignSelf: 'center',
755
+ borderRadius: 10,
756
+ marginTop: 30
757
+ }}
758
+ onClick={() => showLocation({
759
+ latitude: order?.business?.location?.lat,
760
+ longitude: order?.business?.location?.lng,
761
+ naverCallerName: 'com.reactnativeappstemplate5',
762
+ dialogTitle: t('GET_DIRECTIONS', 'Get Directions'),
763
+ dialogMessage: t('WHAT_APP_WOULD_YOU_USE', 'What app would you like to use?'),
764
+ cancelText: t('CANCEL', 'Cancel'),
765
+ })}
766
+ />
767
+ )}
746
768
  </OrderBusiness>
747
769
 
748
770
  {placeSpotTypes.includes(order?.delivery_type) && (