ordering-ui-react-native 0.18.66 → 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,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
|
-
{
|
|
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
|
-
{
|
|
482
|
-
<
|
|
483
|
-
<
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
|