ordering-ui-react-native 0.18.93 → 0.18.95

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.18.93",
3
+ "version": "0.18.95",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react';
2
- import { StyleSheet, View, RefreshControl, ScrollView, Pressable } from 'react-native';
2
+ import { StyleSheet, View, Pressable, TouchableOpacity } from 'react-native';
3
3
  import { useLanguage } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
 
@@ -9,6 +9,7 @@ import OButton from '../../components/shared/OButton';
9
9
  import { LanguageSelector } from '../../components/LanguageSelector';
10
10
  import { LogoutPopup } from '../../components/LogoutPopup';
11
11
  import { PORTRAIT, LANDSCAPE, useDeviceOrientation } from "../../../../../src/hooks/DeviceOrientation";
12
+ import { OIcon } from '../../components/shared';
12
13
 
13
14
  const Intro = (props: any): React.ReactElement => {
14
15
  const { navigation } = props;
@@ -41,6 +42,19 @@ const Intro = (props: any): React.ReactElement => {
41
42
  // />
42
43
  // }
43
44
  // >
45
+ <>
46
+ <View style={{ position: 'absolute', top: 25, right: 20, zIndex: 1000 }}>
47
+ <TouchableOpacity
48
+ onPress={() => setShowLogoutPopup(true)}
49
+ >
50
+ <OIcon
51
+ src={theme.images.general.menulogout}
52
+ width={24}
53
+ height={24}
54
+ color={theme.colors.disabledContrast}
55
+ />
56
+ </TouchableOpacity>
57
+ </View>
44
58
  <Pressable onPress={goBusiness}>
45
59
  <View style={{ height: orientationState?.dimensions?.height }}>
46
60
  {orientationState.orientation === PORTRAIT ? (
@@ -134,6 +148,7 @@ const Intro = (props: any): React.ReactElement => {
134
148
  />
135
149
  </View>
136
150
  </Pressable>
151
+ </>
137
152
  // </ScrollView>
138
153
  );
139
154
  };
@@ -146,7 +146,7 @@ export const BusinessBasicInformation = (
146
146
  }
147
147
 
148
148
  const getBusinessType = () => {
149
- if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
149
+ if (Object.keys(business || {}).length <= 0) return t('GENERAL', 'General');
150
150
  const _types: any = [];
151
151
  types.forEach(
152
152
  (type) =>
@@ -229,7 +229,10 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
229
229
  )}
230
230
  {(!isCustomLayout) && !hideBusinessOffer && (
231
231
  getBusinessOffer((business?.offers)) &&
232
- <OfferBox isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}>
232
+ <OfferBox
233
+ isClosed={!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1')}
234
+ isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}
235
+ >
233
236
  <OText
234
237
  size={10}
235
238
  weight={'400'}
@@ -240,7 +243,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
240
243
  >{getBusinessOffer((business?.offers)) || parsePrice(0)}</OText>
241
244
  </OfferBox>
242
245
  )}
243
- <BusinessState>
246
+ <BusinessState isRibbon={business?.ribbon?.enabled && !!business?.ribbon?.text}>
244
247
  {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
245
248
  <View style={styles.businessStateView}>
246
249
  <OText
@@ -34,7 +34,7 @@ export const Metadata = styled.View`
34
34
 
35
35
  export const BusinessState = styled.View`
36
36
  position: absolute;
37
- top: 15px;
37
+ top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
38
38
  right: 15px;
39
39
  `
40
40
 
@@ -86,7 +86,7 @@ export const OfferBox = styled.View`
86
86
  position: absolute;
87
87
  z-index: 1;
88
88
  border-radius: 50px;
89
- top: 15px;
89
+ top: ${(props: any) => props.isRibbon ? '32px' : '15px'};
90
90
  right: ${(props: any) => props.isClosed ? '110px' : '15px'};
91
91
  background: ${(props: any) => props.theme.colors.inputBorderColor};
92
92
  padding: 3px 8px;
@@ -1,4 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react'
2
+ import { useFocusEffect } from '@react-navigation/native'
2
3
  import { TouchableOpacity, StyleSheet, View, Dimensions, Platform } from 'react-native'
3
4
  import { useLanguage, useUtils, useConfig, useOrder, MomentOption } from 'ordering-components/native'
4
5
  import { OButton, OIcon, OText } from '../shared'
@@ -310,9 +311,11 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
310
311
  }
311
312
  }, [dateSelected])
312
313
 
313
- useEffect(() => {
314
- handleAsap && handleAsap()
315
- }, [])
314
+ useFocusEffect(
315
+ React.useCallback(() => {
316
+ handleAsap && handleAsap()
317
+ }, [])
318
+ )
316
319
 
317
320
  return (
318
321
  <>
@@ -691,8 +691,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
691
691
  <ServiceForm
692
692
  navigation={navigation}
693
693
  product={currentProduct}
694
- businessSlug={business.slug}
695
- businessId={business.id}
694
+ businessSlug={business?.slug}
695
+ businessId={business?.id}
696
696
  professionalList={business?.professionals}
697
697
  professionalSelected={professionalSelected}
698
698
  handleChangeProfessional={handleChangeProfessionalSelected}
@@ -108,14 +108,14 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
108
108
  /* const toggleAccordion = () => {
109
109
  if ((!product?.valid_menu && isCartProduct)) return
110
110
  if (isActive) {
111
- Animated.timing(setHeight.height, {
111
+ Animated.timing(setHeight.height, {
112
112
  toValue: 100,
113
113
  duration: 500,
114
114
  easing: Easing.linear,
115
115
  useNativeDriver: false,
116
- }).start()
116
+ }).start()
117
117
  } else {
118
- setHeightState({height: new Animated.Value(0)})
118
+ setHeightState({height: new Animated.Value(0)})
119
119
  }
120
120
  }*/
121
121
 
@@ -136,7 +136,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
136
136
  }
137
137
 
138
138
  /*useEffect(() => {
139
- toggleAccordion()
139
+ toggleAccordion()
140
140
  }, [isActive])*/
141
141
 
142
142
  const productOptions = getProductMax && [...Array(getProductMax(product) + 1),].map((_: any, opt: number) => {
@@ -289,7 +289,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
289
289
  )}
290
290
  {productInfo().options.length > 0 && (
291
291
  <ProductOptionsList>
292
- {productInfo().options.map((option: any, i: number) => (
292
+ {productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => (
293
293
  <ProductOption key={option.id + i}>
294
294
  <OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
295
295
  {option.suboptions.map((suboption: any) => (