ordering-ui-react-native 0.18.66 → 0.18.68

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.66",
3
+ "version": "0.18.68",
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
 
@@ -161,7 +161,7 @@ const ProfileListUI = (props: ProfileParams) => {
161
161
  }, [removeAccountState])
162
162
 
163
163
  return (
164
- <View style={{ flex: 1, height: height - top - bottom, paddingTop: 20 }}>
164
+ <View style={{ flex: 1, height: '100%', paddingTop: 20 }}>
165
165
  <CenterView style={styles.pagePadding}>
166
166
  {user?.photo && !hideProfileImage && (
167
167
  <View style={styles.photo}>
@@ -261,7 +261,7 @@ const ProfileListUI = (props: ProfileParams) => {
261
261
  )}
262
262
  </Actions>
263
263
 
264
- <Actions>
264
+ <Actions style={{ paddingTop: height * .02 }}>
265
265
  {!showLanguages && (
266
266
  <LanguageSelector iconColor={theme.colors.textNormal} pickerStyle={langPickerStyle} />
267
267
  )}