ordering-ui-react-native 0.14.83 → 0.14.84

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.14.83",
3
+ "version": "0.14.84",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -117,6 +117,9 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
117
117
  const [featuredBusiness, setFeaturedBusinesses] = useState(Array);
118
118
  const [isFarAway, setIsFarAway] = useState(false)
119
119
 
120
+ const isPreorderEnabled = (configs?.preorder_status_enabled?.value === '1' || configs?.preorder_status_enabled?.value === 'true') &&
121
+ Number(configs?.max_days_preorder?.value) > 0
122
+
120
123
  const timerId = useRef<any>(false)
121
124
  // const panResponder = useRef(
122
125
  // PanResponder.create({
@@ -128,6 +131,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
128
131
  // })
129
132
  // ).current
130
133
 
134
+ const handleMomentClick = () => {
135
+ if (isPreorderEnabled) {
136
+ navigation.navigate('MomentOption')
137
+ }
138
+ }
139
+
131
140
  const configTypes =
132
141
  configs?.order_types_allowed?.value
133
142
  .split('|')
@@ -198,14 +207,12 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
198
207
  }, [orderState?.options?.address?.location])
199
208
 
200
209
  useEffect(() => {
201
- const onFocusApp = (nextAppState : any) => {
210
+ const onFocusApp = (nextAppState: any) => {
202
211
  if (
203
212
  appState.current.match(/inactive|background/) &&
204
213
  nextAppState === "active"
205
214
  ) {
206
- if (!businessesList.loading) {
207
- getBusinesses(true);
208
- }
215
+ getBusinesses(true);
209
216
  }
210
217
  appState.current = nextAppState;
211
218
  setAppStateVisible(appState.current);
@@ -281,7 +288,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
281
288
  />
282
289
  </WrapMomentOption>
283
290
  <WrapMomentOption
284
- onPress={() => navigation.navigate('MomentOption')}>
291
+ onPress={() => handleMomentClick()}>
285
292
  <OText
286
293
  size={12}
287
294
  numberOfLines={1}
@@ -291,11 +298,13 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
291
298
  ? parseDate(orderState.options?.moment, { outputFormat: configs?.dates_moment_format?.value })
292
299
  : t('ASAP_ABBREVIATION', 'ASAP')}
293
300
  </OText>
294
- <OIcon
295
- src={theme.images.general.arrow_down}
296
- width={10}
297
- style={{ marginStart: 8 }}
298
- />
301
+ {isPreorderEnabled && (
302
+ <OIcon
303
+ src={theme.images.general.arrow_down}
304
+ width={10}
305
+ style={{ marginStart: 8 }}
306
+ />
307
+ )}
299
308
  </WrapMomentOption>
300
309
 
301
310
  {!businessId && (