@ledvance/ui-biz-bundle 1.1.124 → 1.1.126

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
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/ui-biz-bundle",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.124",
7
+ "version": "1.1.126",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@ledvance/base": "^1.x",
@@ -153,10 +153,12 @@ export const useConflictTask = (conflictDps: ConflictDps, isPlug?: boolean): [(v
153
153
  newState[conflictDps.wakeUpDpCode] = newItems
154
154
  }
155
155
  }
156
- if (conflictDps.switchIngCode && switchInching.enable){
157
- newState[conflictDps.switchIngCode] = {
158
- ...switchInching,
159
- enable: false
156
+ if (conflictDps.switchIngCode) {
157
+ const targetItem = switchInching.find(item => item.channel === conflictItem.channel && item.enable);
158
+ if (targetItem) {
159
+ newState[conflictDps.switchIngCode] = switchInching.map(item =>
160
+ item.channel === conflictItem.channel && item.enable ? { ...item, enable: false } : item
161
+ );
160
162
  }
161
163
  }
162
164
  state.conflictTask = cloneDeep(newState)
@@ -213,7 +213,7 @@ const FlagEditPage = (props: { theme?: ThemeType }) => {
213
213
  maxLength={33}
214
214
  showError={state.mood.name.length > 32 || nameRepeat}
215
215
  tipColor={nameRepeat ? props.theme?.global.error : undefined}
216
- tipIcon={nameRepeat ? res.ic_text_field_input_error : undefined}
216
+ tipIcon={nameRepeat ? { uri: res.ic_text_field_input_error } : undefined}
217
217
  errorText={I18n.getLang(nameRepeat ? 'string_light_pp_field_sm_add_error1' : 'add_new_dynamic_mood_alert_text')} />
218
218
  {(params.moduleParams.isSupportMixScene || params.moduleParams.isCeilingLight) && <><Card style={styles.adjustCard}>
219
219
  <Spacer height={cx(16)} />
@@ -387,11 +387,10 @@ const FlagEditPage = (props: { theme?: ThemeType }) => {
387
387
  state.mood.colors = state.mood.colors.map(() => (
388
388
  { h, s, v }
389
389
  ))
390
- } else {
391
- state.currentNode.h = h
392
- state.currentNode.s = s
393
- state.currentNode.v = v
394
390
  }
391
+ state.currentNode.h = h
392
+ state.currentNode.s = s
393
+ state.currentNode.v = v
395
394
  }}
396
395
  onHSVChangeComplete={(h, s, v) => {
397
396
  if (state.colorPaintBucketSelected) {
@@ -399,9 +398,6 @@ const FlagEditPage = (props: { theme?: ThemeType }) => {
399
398
  { h, s, v }
400
399
  ))
401
400
  } else {
402
- state.currentNode.h = h
403
- state.currentNode.s = s
404
- state.currentNode.v = v
405
401
  state.mood.colors = state.mood.colors.map((item, idx) => {
406
402
  if (idx === state.colorPaintBucketIdx) {
407
403
  return { h, s, v }
@@ -409,6 +405,9 @@ const FlagEditPage = (props: { theme?: ThemeType }) => {
409
405
  return item
410
406
  })
411
407
  }
408
+ state.currentNode.h = h
409
+ state.currentNode.s = s
410
+ state.currentNode.v = v
412
411
  }}
413
412
  />
414
413
  <Spacer height={cx(16)} />
@@ -82,11 +82,17 @@ const SwitchHistoryPage = (props: { theme?: ThemeType }) => {
82
82
  }, [state.onRefresh, state.filterTags])
83
83
 
84
84
  const downFile = () => {
85
- const headers = [I18n.getLang('date'), 'Time', 'Status', I18n.getLang('manual_search_button_socket')]
85
+ const headers = [I18n.getLang('date'), 'Time', 'Status']
86
+ if (!!tags) {
87
+ headers.push(I18n.getLang('manual_search_button_socket'))
88
+ }
86
89
  const values = state.data.reduce((acc, item) => {
87
90
  const actions = item.actions.map(action => {
88
- const name = tags ? tags[action.dpId] : action.dpId
89
- return [action.date, action.time, action.action, name]
91
+ const data = [action.date, action.time, action.action];
92
+ if (!!tags) {
93
+ data.push(tags[action.dpId])
94
+ }
95
+ return data
90
96
  });
91
97
  return acc.concat(actions);
92
98
  }, [] as string[][]);
@@ -139,7 +139,7 @@ const getDpResultByDate = async (devId: string, addEleDpCode: string, date: stri
139
139
 
140
140
  export const exportEnergyCsv = (values: any[][], unit: string) => {
141
141
  const headers = [I18n.getLang('date'), `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')} (kWh)`, `Price(${unit})`]
142
- const functionName = `${I18n.getLang('consumption_data_annual_bar_chart_system_back_text')}`
142
+ const functionName = 'EnergyConsumption'
143
143
  exportCsvFile(headers, values, functionName)
144
144
  }
145
145
 
@@ -42,6 +42,10 @@ const BarChartWithTouch = (props: BarChartProps) => {
42
42
  }
43
43
  return max
44
44
  }, [dataKwhY]);
45
+ const gridRight = useMemo(() => {
46
+ const max = Math.max(...dataPriceY.map(it => Number(it)))
47
+ return max > 999 ? '12%' : '10%'
48
+ }, [dataPriceY])
45
49
  const option = {
46
50
  tooltip: {
47
51
  show: true,
@@ -55,6 +59,9 @@ const BarChartWithTouch = (props: BarChartProps) => {
55
59
  color: theme?.global.fontColor,
56
60
  }
57
61
  },
62
+ grid: {
63
+ right: gridRight,
64
+ },
58
65
  xAxis: {
59
66
  data: dataX,
60
67
  axisTick: {
@@ -1,17 +1,18 @@
1
- import React, { useEffect } from "react";
2
- import { StyleSheet, Text, View } from "react-native";
1
+ import React, { useEffect, useMemo, useRef, useState } from "react";
2
+ import { ScrollView, StyleSheet, Text, View } from "react-native";
3
3
  import Page from "@ledvance/base/src/components/Page";
4
4
  import { useDeviceInfo } from "@ledvance/base/src/models/modules/NativePropsSlice";
5
5
  import { useNavigation } from '@react-navigation/native'
6
6
  import { SwitchButton, Utils, Dialog } from "tuya-panel-kit";
7
7
  import LdvPickerView from "@ledvance/base/src/components/ldvPickerView";
8
8
  import I18n from '@ledvance/base/src/i18n'
9
- import { useReactive, useUpdateEffect } from "ahooks";
10
- import { SwitchInchingPageParams, useCountdown1, useSwitchInching } from "./SwithInchingAction";
9
+ import { SwitchInchingItem, SwitchInchingPageParams, useSwitchInching, defSwitchInching, useCountdowns } from "./SwithInchingAction";
11
10
  import { useParams } from "@ledvance/base/src/hooks/Hooks";
12
11
  import ThemeType from '@ledvance/base/src/config/themeType'
13
12
  import { useConflictTask } from "../../hooks/DeviceDpStateHooks";
14
13
  import { showDialog } from "@ledvance/base/src/utils/common";
14
+ import Segmented from "@ledvance/base/src/components/Segmented";
15
+ import Spacer from "@ledvance/base/src/components/Spacer";
15
16
 
16
17
  const { convertX: cx } = Utils.RatioUtils
17
18
  const { withTheme } = Utils.ThemeUtils
@@ -21,48 +22,66 @@ const SwitchInching = (props: { theme?: ThemeType }) => {
21
22
  const deviceInfo = useDeviceInfo()
22
23
  const navigation = useNavigation()
23
24
  const [switchInching, setSwitchInching] = useSwitchInching(params.switchIngCode)
24
- const [countdown1, setCountDown1] = useCountdown1(params.countdownCode)
25
25
  const [checkConflict, resolveConflict] = useConflictTask(params.conflictDps, true)
26
- const state = useReactive({
27
- enable: false,
26
+ const [countdowns, setCountdowns] = useCountdowns(params.countdownCode || params.channelConfig.map(item => item.countdownCode))
27
+ const timeRef = useRef({
28
28
  minute: '00',
29
29
  second: '00',
30
- loading: false
30
+ })
31
+ const [state, setState] = useState({
32
+ loading: false,
33
+ channel: 0,
34
+ switchInchingItem: defSwitchInching[0]
31
35
  })
32
36
 
33
- useEffect(() => {
34
- state.enable = switchInching.enable
35
- state.minute = formateValue('minute')
36
- state.second = formateValue('second')
37
- }, [JSON.stringify(switchInching)])
38
-
39
- const requestSwitchInching = async () => {
40
- const enable = state.enable
41
- const time = Number(state.minute) * 60 + Number(state.second)
42
- if (enable && countdown1){
43
- setCountDown1(0)
44
- }
45
- await setSwitchInching({ enable, time })
46
- }
37
+ const updateState = (newState: Partial<typeof state>) => {
38
+ setState(prev => ({ ...prev, ...newState }));
39
+ };
47
40
 
48
- useUpdateEffect(() => {
49
- if (!!!Number(state.minute) && Number(state.second) < 2) {
50
- state.second = '02'
41
+ const updateTime = (minute?: string, second?: string) => {
42
+ if (minute !== undefined) timeRef.current.minute = minute;
43
+ if (second !== undefined) timeRef.current.second = second;
44
+
45
+ if (!Number(timeRef.current.minute) && Number(timeRef.current.second) < 1) {
46
+ timeRef.current.second = '01';
51
47
  }
52
- if (Number(state.minute) === 60) {
53
- state.second = '00'
48
+
49
+ if (Number(timeRef.current.minute) === 60) {
50
+ timeRef.current.second = '00';
54
51
  }
55
- }, [state.minute, state.second])
52
+
53
+ const time = Number(timeRef.current.minute) * 60 + Number(timeRef.current.second);
54
+ const newSwitchInchingItem = {
55
+ ...state.switchInchingItem,
56
+ time
57
+ };
58
+
59
+ updateState({ switchInchingItem: newSwitchInchingItem });
60
+
61
+ };
56
62
 
57
- const formateValue = (type: string) => {
58
- const m = parseInt(String((switchInching?.time || 0) / 60))
59
- if (type === 'minute') {
60
- return m.toString().padStart(2, '0')
61
- } else {
62
- const s = switchInching.time - 60 * m
63
- const v: string = s === 0 ? '00' : s < 10 ? '0' + s : String(s)
64
- return v
65
- }
63
+ const switchInchingItem = useMemo(() => {
64
+ return switchInching.find(item => item.channel === state.channel) ?? { ...defSwitchInching[0], channel: state.channel }
65
+ }, [state.channel, JSON.stringify(switchInching)])
66
+
67
+ useEffect(() => {
68
+ const { minute, second } = formateValue(switchInchingItem)
69
+ timeRef.current = { minute, second }
70
+ updateState({ switchInchingItem })
71
+ }, [switchInchingItem])
72
+
73
+ const saveInchingConfig = async (item: SwitchInchingItem) => {
74
+ const updatedSwitchInching = [...switchInching];
75
+ const existingItemIndex = updatedSwitchInching.findIndex(item => item.channel === state.channel);
76
+ updatedSwitchInching[existingItemIndex] = item;
77
+ console.log('updatedSwitchInching', updatedSwitchInching)
78
+ await setSwitchInching(updatedSwitchInching)
79
+ }
80
+
81
+ const formateValue = (switchInchingItem: SwitchInchingItem) => {
82
+ const minute = Math.floor((switchInchingItem.time || 0) / 60).toString().padStart(2, '0')
83
+ const second = ((switchInchingItem.time || 0) % 60).toString().padStart(2, '0')
84
+ return { minute, second }
66
85
  }
67
86
 
68
87
  const styles = StyleSheet.create({
@@ -120,71 +139,95 @@ const SwitchInching = (props: { theme?: ThemeType }) => {
120
139
  <Page
121
140
  backText={deviceInfo.name}
122
141
  onBackClick={navigation.goBack}
123
- headlineText={I18n.getLang('socket_settings_switch_off_firstbox_text')}
142
+ headlineText={I18n.getLang('sockets_specific_settings_switch_inching')}
124
143
  >
125
- <View style={styles.switchContainer}>
126
- <View style={styles.switchCardContainer}>
127
- <Text style={styles.switchCardTitle}>
128
- {I18n.getLang('socket_settings_switch_off_firstbox_text')}
129
- </Text>
130
- <SwitchButton
131
- value={switchInching.enable}
132
- onValueChange={async v => {
133
- if (v) {
134
- const switchingTask = {
144
+ <ScrollView nestedScrollEnabled={true}>
145
+ {params.channelConfig && params.channelConfig.length > 1 && <>
146
+ <Segmented
147
+ style={{ marginHorizontal: cx(24) }}
148
+ options={params.channelConfig.map(item => ({
149
+ label: item.channelTitle,
150
+ value: item.channel
151
+ }))}
152
+ value={state.channel}
153
+ onChange={v => {
154
+ updateState({ channel: Number(v) })
155
+ }}
156
+ />
157
+ <Spacer />
158
+ </>}
159
+ <View style={styles.switchContainer}>
160
+ <View style={styles.switchCardContainer}>
161
+ <Text style={styles.switchCardTitle}>
162
+ {I18n.getLang('socket_settings_switch_off_firstbox_text')}
163
+ </Text>
164
+ <SwitchButton
165
+ value={state.switchInchingItem.enable}
166
+ onValueChange={async v => {
167
+ const time = Number(timeRef.current.minute) * 60 + Number(timeRef.current.second)
168
+ const newSwitchInchingItem = {
169
+ ...state.switchInchingItem,
135
170
  enable: v,
136
- startTime: 0,
137
- endTime: 1440,
138
- weeks: [1, 1, 1, 1, 1, 1, 1],
171
+ time
139
172
  }
140
- if (checkConflict(switchingTask)) {
141
- return showDialog({
142
- method: 'confirm',
143
- title: I18n.getLang('conflict_dialog_save_item_inching_titel'),
144
- subTitle: I18n.getLang('conflict_dialog_save_item_inching_description'),
145
- onConfirm: async (_, { close }) => {
146
- resolveConflict()
147
- close()
148
- state.loading = true
149
- state.enable = v;
150
- await requestSwitchInching()
151
- },
152
- onCancel: () => {
153
- Dialog.close()
154
- }
155
- })
173
+ if (v) {
174
+ const switchingTask = {
175
+ enable: v,
176
+ startTime: 0,
177
+ endTime: 1440,
178
+ weeks: [1, 1, 1, 1, 1, 1, 1],
179
+ }
180
+ const countdown = params.countdownCode ? countdowns[params.countdownCode] : countdowns[params.channelConfig[state.channel].countdownCode]
181
+ if (countdown) {
182
+ setCountdowns(params.countdownCode || params.channelConfig[state.channel].countdownCode, 0).then()
183
+ }
184
+ if (checkConflict(switchingTask)) {
185
+ return showDialog({
186
+ method: 'confirm',
187
+ title: I18n.getLang('conflict_dialog_save_item_inching_titel'),
188
+ subTitle: I18n.getLang('conflict_dialog_save_item_inching_description'),
189
+ onConfirm: async (_, { close }) => {
190
+ resolveConflict()
191
+ close()
192
+ state.loading = true
193
+ updateState({ switchInchingItem: newSwitchInchingItem })
194
+ setTimeout(async () => {
195
+ await saveInchingConfig(newSwitchInchingItem)
196
+ }, 0)
197
+ },
198
+ onCancel: () => {
199
+ Dialog.close()
200
+ }
201
+ })
202
+ }
156
203
  }
157
- }
158
- state.enable = v;
159
- await requestSwitchInching()
160
- }}
161
- />
204
+ updateState({ switchInchingItem: newSwitchInchingItem })
205
+ await saveInchingConfig(newSwitchInchingItem)
206
+ }}
207
+ />
208
+ </View>
209
+ <Text style={styles.switchDescription}>
210
+ {I18n.getLang('switchinching_overview_description_text')}
211
+ </Text>
162
212
  </View>
163
- <Text style={styles.switchDescription}>
164
- {I18n.getLang('switchinching_overview_description_text')}
213
+ <Text style={styles.secondTopic}>
214
+ {I18n.getLang('socket_settings_switch_off_secondtopic')}
165
215
  </Text>
166
- </View>
167
- <Text style={styles.secondTopic}>
168
- {I18n.getLang('socket_settings_switch_off_secondtopic')}
169
- </Text>
170
- <View style={styles.pickContainer}>
171
- {switchInching.enable && <View style={styles.disabledCover} />}
172
- <LdvPickerView
173
- hour={state.minute}
174
- minute={state.second}
175
- unit={[
176
- I18n.getLang('socket_settings_switch_off_min'),
177
- I18n.getLang('socket_settings_switch_off_s'),
178
- ]}
179
- setHour={m => {
180
- state.minute = m;
181
- }}
182
- setMinute={s => {
183
- state.second = s;
184
- }}
185
- maxHour={61}
186
- />
187
- </View>
216
+ <View style={styles.pickContainer}>
217
+ {state.switchInchingItem.enable && <View style={styles.disabledCover} />}
218
+ <LdvPickerView
219
+ hour={timeRef.current.minute}
220
+ minute={timeRef.current.second}
221
+ unit={[
222
+ I18n.getLang('socket_settings_switch_off_min'),
223
+ I18n.getLang('socket_settings_switch_off_s'),
224
+ ]}
225
+ setHour={m => updateTime(m, undefined)}
226
+ setMinute={s => updateTime(undefined, s)}
227
+ maxHour={61}
228
+ />
229
+ </View>
230
+ </ScrollView>
188
231
  </Page>
189
232
  );
190
233
  };
@@ -1,61 +1,82 @@
1
- import {Buffer} from 'buffer'
2
- import {Result} from "@ledvance/base/src/models/modules/Result"
3
- import {useDp} from "@ledvance/base/src/models/modules/NativePropsSlice";
1
+ import { Buffer } from 'buffer'
2
+ import { Result } from "@ledvance/base/src/models/modules/Result"
3
+ import { useDp } from "@ledvance/base/src/models/modules/NativePropsSlice";
4
+ import { spliceByStep } from '@ledvance/base/src/utils/common';
5
+ import { Utils } from '@tuya/tuya-panel-lamp-sdk'
4
6
 
7
+ const { to16 } = Utils
5
8
  export interface SwitchInchingPageParams {
6
9
  switchIngCode: string
7
- countdownCode: string
10
+ countdownCode?: string
11
+ channelConfig: {
12
+ countdownCode: string
13
+ channelTitle: string
14
+ channel: number
15
+ }[]
8
16
  conflictDps: {
9
17
  randomTimeDpCode?: string
10
18
  fixedTimeDpCode?: string
11
19
  }
12
20
  }
13
21
 
14
- interface SwitchInchingModel {
22
+ export interface SwitchInchingItem {
23
+ channel: number,
15
24
  enable: boolean,
16
25
  time: number
17
26
  }
18
27
 
19
- function format(number: string, code: number) {
20
- const l = number.length; //获取要格式化数字的长度,如二进制1的话长度为1
21
- if (l < code) { //补全位数 0000,这里我要显示4位
22
- for (let i = 0; i < code - l; i++) {
23
- number = "0" + number; //不够的就在前面补0
24
- }
25
- }
26
- return number;
27
- }
28
28
 
29
- type SwitchInchingResult = (switchInchingCode: string) => [SwitchInchingModel, (v: SwitchInchingModel) => Promise<Result<any>>]
30
29
 
31
- export function useCountdown1(countdownCode: string): [number, (countdown1: number) => Promise<Result<any>>] {
32
- return useDp(countdownCode);
30
+ export function useCountdowns(countdownCodes: string | string[]): [Record<string, number>, (countdownCode: string, value: number) => Promise<Result<any>>] {
31
+ const codes = Array.isArray(countdownCodes) ? countdownCodes : [countdownCodes];
32
+ const countdownValues: Record<string, number> = {};
33
+ const dpSetters: Record<string, (value: number) => Promise<Result<any>>> = {};
34
+
35
+ for (const code of codes) {
36
+ const [value, setDp] = useDp<number, any>(code);
37
+ countdownValues[code] = value;
38
+ dpSetters[code] = setDp;
39
+ }
40
+
41
+ const setCountdown = async (countdownCode: string, value: number) => {
42
+ if (dpSetters[countdownCode]) {
43
+ return await dpSetters[countdownCode](value);
44
+ }
45
+ return { success: false, msg: 'Countdown code not found' } as Result<any>;
46
+ };
47
+
48
+ return [countdownValues, setCountdown];
33
49
  }
34
50
 
35
51
  export function useSwitchInchingHex(switchInchingCode: string): [string, (switchInching: string) => Promise<Result<any>>] {
36
52
  return useDp(switchInchingCode)
37
53
  }
38
54
 
39
- export const useSwitchInching: SwitchInchingResult = (switchInchingCode: string) => {
55
+ export const defSwitchInching = [{ enable: false, channel: 0, time: 1 }]
56
+
57
+ export const useSwitchInching = (switchInchingCode: string) => {
40
58
  const [hex, setHex] = useSwitchInchingHex(switchInchingCode)
41
- let enable = false
42
- let time = 0
43
- if (switchInchingCode && hex){
44
- const inching = Buffer.from(hex, 'base64')
45
- enable = !!inching[0]
46
- time = inching[1] * 256 + inching[2]
47
- }
48
- const setSwitchInching = ({enable, time}) => {
49
- const enableHex = enable ? '01' : '00'
50
- const timeHex = format(time?.toString(16), 4)
51
- const inchingString = enableHex + timeHex
52
- const inchingHex = hexToBase64(inchingString)
59
+ const switching = hex ? spliceByStep(Buffer.from(hex, 'base64').toString('hex'), 6).map(item => {
60
+ const powerInfo = parseInt(`${item.slice(0, 2)}`, 16).toString(2).padStart(8, '0');
61
+ const powerBits = powerInfo.split('');
62
+ const enable = !!Number(powerBits[powerBits.length - 1]);
63
+ // 通道号
64
+ const channel = parseInt(powerBits.slice(1, powerBits.length - 1).join(''), 2);
65
+ const time = parseInt(item.slice(2, 6), 16)
66
+ return { enable, channel, time }
67
+ }) : defSwitchInching
68
+
69
+ const setSwitchInching = (switching: SwitchInchingItem[]) => {
70
+ const inchingString = switching.map(item => {
71
+ const channelStr = item.channel.toString(2).padStart(7, '0')
72
+ const powerChannel = parseInt(`${channelStr}${item.enable ? 1 : 0}`, 2);
73
+ const powerChannelStr = to16(powerChannel, 2);
74
+ const timeHex = item.time?.toString(16).padStart(4, '0')
75
+ return powerChannelStr + timeHex
76
+ }).join('')
77
+ const inchingHex = Buffer.from(inchingString, 'hex').toString('base64')
53
78
  return setHex(inchingHex)
54
79
  }
55
- return [{enable, time}, setSwitchInching]
80
+ return [switching, setSwitchInching] as const
56
81
  }
57
82
 
58
- const hexToBase64 = (hex: string) => {
59
- const buffer = Buffer.from(hex, 'hex');
60
- return buffer.toString('base64');
61
- }
@@ -40,7 +40,6 @@ const ScheduleCard = (props: ScheduleCardProps) => {
40
40
  infoContainer: {
41
41
  flex: 1,
42
42
  marginTop: cx(16),
43
- marginBottom: cx(16),
44
43
  flexDirection: 'column',
45
44
  marginLeft: cx(16),
46
45
  },
@@ -65,20 +64,22 @@ const ScheduleCard = (props: ScheduleCardProps) => {
65
64
  },
66
65
  switchContainer: {
67
66
  marginRight: cx(16),
68
- // backgroundColor: 'red',
69
67
  marginTop: cx(16),
70
68
  },
71
69
  switch: {},
72
70
  typeContainer: {
73
71
  flexDirection: 'row',
74
- marginTop: cx(8),
72
+ flexWrap: 'wrap',
73
+ marginVertical: cx(8),
74
+ marginHorizontal: cx(16),
75
75
  },
76
76
  tag: {
77
77
  borderRadius: cx(16),
78
78
  height: cx(16),
79
79
  backgroundColor: '#E6E7E8',
80
80
  marginRight: cx(10),
81
- paddingHorizontal: cx(12)
81
+ marginBottom: cx(6),
82
+ paddingHorizontal: cx(10)
82
83
  },
83
84
  tagTitle: {
84
85
  fontSize: cx(10),
@@ -90,7 +91,7 @@ const ScheduleCard = (props: ScheduleCardProps) => {
90
91
  return (
91
92
  <Card
92
93
  style={styles.card}
93
- containerStyle={[styles.container, style]}
94
+ containerStyle={[style]}
94
95
  onPress={() => {
95
96
  onPress(item);
96
97
  }}
@@ -98,31 +99,33 @@ const ScheduleCard = (props: ScheduleCardProps) => {
98
99
  onLongPress && onLongPress(item)
99
100
  }}
100
101
  >
101
- <View style={styles.infoContainer}>
102
- <Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
103
- <Text style={styles.loop}>
104
- {loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
105
- </Text>
106
- <Text style={styles.name}>{item.name}</Text>
107
- {showTag && <View style={styles.typeContainer}>
108
- {showTags.map(tag => (
109
- <View style={styles.tag} key={tag.dp}>
110
- <Text style={styles.tagTitle}>
111
- {tag.key}
112
- </Text>
113
- </View>
114
- ))}
115
- </View>}
116
- </View>
117
- <View style={styles.switchContainer}>
118
- <SwitchButton
119
- value={item.enable}
120
- thumbStyle={{ elevation: 0 }}
121
- onValueChange={() => {
122
- onEnableChange(!item.enable);
123
- }}
124
- />
102
+ <View style={styles.container}>
103
+ <View style={styles.infoContainer}>
104
+ <Text style={styles.time}>{is24HourClock ? item.time : convertTo12HourFormat(item.time)}</Text>
105
+ <Text style={styles.loop}>
106
+ {loopText(item.loops.split('').map(loop => parseInt(loop)), item.time)}
107
+ </Text>
108
+ <Text style={styles.name}>{item.name}</Text>
109
+ </View>
110
+ <View style={styles.switchContainer}>
111
+ <SwitchButton
112
+ value={item.enable}
113
+ thumbStyle={{ elevation: 0 }}
114
+ onValueChange={() => {
115
+ onEnableChange(!item.enable);
116
+ }}
117
+ />
118
+ </View>
125
119
  </View>
120
+ {showTag && <View style={styles.typeContainer}>
121
+ {showTags.map(tag => (
122
+ <View style={styles.tag} key={tag.dp}>
123
+ <Text style={styles.tagTitle}>
124
+ {tag.key}
125
+ </Text>
126
+ </View>
127
+ ))}
128
+ </View>}
126
129
  </Card>
127
130
  )
128
131