ordering-ui-react-native 0.24.8 → 0.24.10

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.24.8",
3
+ "version": "0.24.10",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,18 +1,26 @@
1
- import React from 'react'
1
+ import React, { useMemo } from 'react'
2
2
  import { Dimensions, Platform } from 'react-native'
3
3
  import { WebView } from 'react-native-webview'
4
4
  import { useLanguage } from 'ordering-components/native'
5
-
5
+ import { useSafeAreaInsets } from 'react-native-safe-area-context'
6
6
  import { Container } from '../../layouts/Container'
7
7
  import { NotFoundSource } from '../NotFoundSource'
8
8
  import NavBar from '../NavBar'
9
9
 
10
- const HEIGHT_SCREEN = Dimensions.get('screen').height
11
-
12
10
  export const HelpOptions = (props: any) => {
13
11
  const { item, goToBack } = props
14
12
  const [, t] = useLanguage()
15
13
 
14
+ const insets = useSafeAreaInsets()
15
+
16
+ const containerHeight = useMemo(() => {
17
+ const windowHeight = Dimensions.get('window').height
18
+ const bottomPadding = Platform.OS === 'ios' ? insets.bottom : 0
19
+ const navigationBarHeight = Platform.OS === 'android' ? 48 : 0
20
+ const topPadding = (Platform.OS === 'ios' ? 20 : 10) + 48
21
+ return windowHeight - bottomPadding - navigationBarHeight - topPadding
22
+ }, [insets.bottom])
23
+
16
24
  return (
17
25
  <Container
18
26
  pt={Platform.OS === 'ios' ? 20 : 10}
@@ -30,7 +38,8 @@ export const HelpOptions = (props: any) => {
30
38
  originWhitelist={['*']}
31
39
  automaticallyAdjustContentInsets={false}
32
40
  source={{ html: item.body }}
33
- style={{ flex: 1, height: HEIGHT_SCREEN }}
41
+ style={{ flex: 1, height: containerHeight }}
42
+ nestedScrollEnabled
34
43
  />
35
44
  )}
36
45
  {!item?.body && (
@@ -112,7 +112,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
112
112
  orders.map((order: any) =>
113
113
  <ItemWrap imageStyle={{ opacity: 0.7 }} source={order.business?.header ? { uri: order.business?.header } : theme.images.dummies.product} key={order.id}>
114
114
  <OText color={theme.colors.white} size={12} lineHeight={18} weight={'600'}>{order?.business?.name}</OText>
115
- <OText color={theme.colors.white} size={10} lineHeight={15}>{`${getOrderStatus(order.status)?.value} on ${formatDate(order?.created_at)}`}</OText>
115
+ <OText color={theme.colors.white} size={10} lineHeight={15}>{`${getOrderStatus(order.status, t)?.value} on ${formatDate(order?.created_at)}`}</OText>
116
116
  </ItemWrap>)
117
117
  )}
118
118
  </>
@@ -143,7 +143,7 @@ const SingleOrderCardUI = (props: any) => {
143
143
  <LinearGradient
144
144
  start={{ x: 0.0, y: 0.0 }}
145
145
  end={{
146
- x: getOrderStatus(order?.status)?.percentage || 0,
146
+ x: getOrderStatus(order?.status, t)?.percentage || 0,
147
147
  y: 0,
148
148
  }}
149
149
  locations={[0.9999, 0.9999]}
@@ -152,7 +152,7 @@ const SingleOrderCardUI = (props: any) => {
152
152
  />
153
153
  </StaturBar>
154
154
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
155
- {getOrderStatus(order?.status)?.value}
155
+ {getOrderStatus(order?.status, t)?.value}
156
156
  </OText>
157
157
  </>
158
158
  )}
@@ -208,7 +208,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
208
208
  <LinearGradient
209
209
  start={{ x: 0.0, y: 0.0 }}
210
210
  end={{
211
- x: getOrderStatus(orders[0]?.status)?.percentage || 0,
211
+ x: getOrderStatus(orders[0]?.status, t)?.percentage || 0,
212
212
  y: 0,
213
213
  }}
214
214
  locations={[0.9999, 0.9999]}
@@ -218,7 +218,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
218
218
  </StaturBar>
219
219
  )}
220
220
  <OText size={14} lineHeight={18} weight={'400'} color={theme.colors.textNormal} mBottom={10}>
221
- {getOrderStatus(orders[0]?.status)?.value}
221
+ {getOrderStatus(orders[0]?.status, t)?.value}
222
222
  </OText>
223
223
  {orders.map((order: any) => (
224
224
  <Row key={order.id}>
@@ -114,7 +114,7 @@ const OrderProgressUI = (props: any) => {
114
114
  setInitialLoaded(true)
115
115
  }, [orderList.loading, initialLoaded])
116
116
 
117
- const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s, t) : getOrderStatus(s, t)
117
+ const progressBarObjt = (s: any) => lastOrder?.delivery_type && lastOrder?.delivery_type === 2 ? getOrderStatuPickUp(s) : getOrderStatus(s, t)
118
118
 
119
119
  return (
120
120
  <>
@@ -370,7 +370,7 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
370
370
  size={10}
371
371
  lineHeight={15}
372
372
  numberOfLines={1}>
373
- {getOrderStatus(order.status)?.value}
373
+ {getOrderStatus(order.status, t)?.value}
374
374
  </OText>
375
375
  )}
376
376
  </View>