ordering-ui-react-native 0.18.65 → 0.18.67

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.65",
3
+ "version": "0.18.67",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React, { useEffect, useState } from 'react'
2
2
  import { RefreshControl, ScrollView, View } from 'react-native'
3
3
  import { OText } from '../shared'
4
4
  import { useLanguage, useSession } from 'ordering-components/native'
@@ -10,6 +10,7 @@ export const DriverSchedule = (props: any) => {
10
10
  const theme = useTheme()
11
11
  const [, { refreshUserInfo }] = useSession()
12
12
  const [refreshing] = useState(false);
13
+ const [driverSchedule, setDriverSchedule] = useState([]);
13
14
 
14
15
  const daysOfWeek = [
15
16
  t('SUNDAY_ABBREVIATION', 'Sun'),
@@ -26,6 +27,32 @@ export const DriverSchedule = (props: any) => {
26
27
  return `${checkTime(hour)}:${checkTime(minute)}`
27
28
  }
28
29
 
30
+ useEffect(() => {
31
+ if (schedule) {
32
+ setDriverSchedule(schedule)
33
+ } else {
34
+ const _schedule: any = []
35
+ for (let i = 0; i < 7; i++) {
36
+ _schedule.push({
37
+ enabled: true,
38
+ lapses: [
39
+ {
40
+ open: {
41
+ hour: 0,
42
+ minute: 0
43
+ },
44
+ close: {
45
+ hour: 23,
46
+ minute: 59
47
+ }
48
+ }
49
+ ]
50
+ })
51
+ }
52
+ setDriverSchedule(_schedule)
53
+ }
54
+ }, [schedule])
55
+
29
56
  return (
30
57
  <ScrollView
31
58
  refreshControl={<RefreshControl
@@ -37,7 +64,7 @@ export const DriverSchedule = (props: any) => {
37
64
  {t('SCHEDULE', 'Schedule')}
38
65
  </OText>
39
66
  <View style={{ padding: 30 }}>
40
- {schedule.map((item: any, i: number) => (
67
+ {driverSchedule.map((item: any, i: number) => (
41
68
  <DayContainer key={daysOfWeek[i]}>
42
69
  <OText style={{ width: '20%' }} size={22} weight={700}>{daysOfWeek[i]}</OText>
43
70
  <View style={{ width: '80%', alignItems: 'center' }}>
@@ -478,19 +478,17 @@ const ProfileUI = (props: ProfileParams) => {
478
478
  />
479
479
  </EditButton>
480
480
  )}
481
- {!!user?.schedule && (
482
- <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
483
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
484
- <OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
485
- <AntDesignIcon size={18} name='right' />
486
- </View>
487
- <View style={{
488
- borderBottomColor: theme.colors.tabBar,
489
- borderBottomWidth: 1,
490
- marginTop: 10
491
- }} />
492
- </Pressable>
493
- )}
481
+ <Pressable style={{ marginBottom: 10 }} onPress={() => setOpenModal(true)}>
482
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
483
+ <OText size={16}>{t('SCHEDULE', 'Schedule')}</OText>
484
+ <AntDesignIcon size={18} name='right' />
485
+ </View>
486
+ <View style={{
487
+ borderBottomColor: theme.colors.tabBar,
488
+ borderBottomWidth: 1,
489
+ marginTop: 10
490
+ }} />
491
+ </Pressable>
494
492
  <Actions>
495
493
  <LanguageSelector />
496
494
 
@@ -121,17 +121,17 @@ const WalletsUI = (props: any) => {
121
121
  <>
122
122
  <Container>
123
123
  <Header>
124
- <View style={{
125
- ...{
126
- width: '100%',
127
- display: 'flex',
128
- flexDirection: 'row',
129
- alignItems: 'center',
130
- marginTop: 30,
131
- justifyContent: 'space-between',
132
- alignContent: 'center'
133
- },
134
- }}>
124
+ <View style={{
125
+ ...{
126
+ width: '100%',
127
+ display: 'flex',
128
+ flexDirection: 'row',
129
+ alignItems: 'center',
130
+ marginTop: 30,
131
+ justifyContent: 'space-between',
132
+ alignContent: 'center'
133
+ },
134
+ }}>
135
135
  {(!props.hideBackBtn || !hideWalletsTheme) && !isChewLayout && (
136
136
  <OButton
137
137
  imgLeftStyle={{ width: 18 }}
@@ -145,7 +145,6 @@ const WalletsUI = (props: any) => {
145
145
  shadowColor: '#FFF',
146
146
  paddingLeft: 0,
147
147
  paddingRight: 0,
148
- marginTop: 30,
149
148
  }}
150
149
  onClick={goToBack}
151
150
  icon={AntDesignIcon}