@ledvance/base 1.3.44 → 1.3.46

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.
Files changed (164) hide show
  1. package/localazy.json +12 -7
  2. package/package.json +1 -1
  3. package/src/api/native.ts +4 -3
  4. package/src/components/AdvanceList.tsx +1 -1
  5. package/src/components/ApplyForDeviceItem.tsx +1 -1
  6. package/src/components/ApplyForText.tsx +1 -1
  7. package/src/components/BallDirectionView.tsx +5 -5
  8. package/src/components/BatteryPercentageView.tsx +75 -0
  9. package/src/components/DiySceneNodeView.tsx +2 -2
  10. package/src/components/DrawToolView.tsx +3 -3
  11. package/src/components/FanAdjustView.tsx +2 -2
  12. package/src/components/MoodStripAdjustView.tsx +2 -2
  13. package/src/components/PressActionView.tsx +158 -0
  14. package/src/components/ShowSelect.tsx +2 -2
  15. package/src/components/SocketItem.tsx +1 -1
  16. package/src/components/Stepper.tsx +2 -2
  17. package/src/components/Tag.tsx +1 -1
  18. package/src/components/TextField.tsx +1 -1
  19. package/src/components/TextFieldStyleButton.tsx +1 -1
  20. package/src/components/UATabTitle.tsx +1 -1
  21. package/src/i18n/strings.ts +310 -175
  22. package/src/res/index.ts +137 -56
  23. package/src/utils/common.ts +0 -69
  24. package/translateKey.txt +11 -6
  25. package/src/res/arrow_temp_down.png +0 -0
  26. package/src/res/arrow_temp_down@2x.png +0 -0
  27. package/src/res/arrow_temp_down@3x.png +0 -0
  28. package/src/res/arrow_temp_up.png +0 -0
  29. package/src/res/arrow_temp_up@2x.png +0 -0
  30. package/src/res/arrow_temp_up@3x.png +0 -0
  31. package/src/res/cash.png +0 -0
  32. package/src/res/cash@2x.png +0 -0
  33. package/src/res/cash@3x.png +0 -0
  34. package/src/res/componentsIOsButtonsButtonAdd.png +0 -0
  35. package/src/res/componentsIOsButtonsButtonAdd@2x.png +0 -0
  36. package/src/res/componentsIOsButtonsButtonAdd@3x.png +0 -0
  37. package/src/res/device_panel_schedule_add.png +0 -0
  38. package/src/res/device_panel_schedule_alert.png +0 -0
  39. package/src/res/flag_icon.png +0 -0
  40. package/src/res/football_icon.png +0 -0
  41. package/src/res/ic_colorize.png +0 -0
  42. package/src/res/ic_colorize@2x.png +0 -0
  43. package/src/res/ic_colorize@3x.png +0 -0
  44. package/src/res/ic_disabled_light.png +0 -0
  45. package/src/res/ic_disabled_light@2x.png +0 -0
  46. package/src/res/ic_disabled_light@3x.png +0 -0
  47. package/src/res/ic_minus.png +0 -0
  48. package/src/res/ic_minus@2x.png +0 -0
  49. package/src/res/ic_minus@3x.png +0 -0
  50. package/src/res/ic_mood_del.png +0 -0
  51. package/src/res/ic_mood_del@2x.png +0 -0
  52. package/src/res/ic_mood_del@3x.png +0 -0
  53. package/src/res/ic_paint_bucket.png +0 -0
  54. package/src/res/ic_paint_bucket@2x.png +0 -0
  55. package/src/res/ic_paint_bucket@3x.png +0 -0
  56. package/src/res/ic_plus.png +0 -0
  57. package/src/res/ic_plus@2x.png +0 -0
  58. package/src/res/ic_plus@3x.png +0 -0
  59. package/src/res/ic_text_field_input_error.png +0 -0
  60. package/src/res/ic_text_field_input_error@2x.png +0 -0
  61. package/src/res/ic_text_field_input_error@3x.png +0 -0
  62. package/src/res/ic_top_arrow.png +0 -0
  63. package/src/res/ic_top_arrow@2x.png +0 -0
  64. package/src/res/ic_top_arrow@3x.png +0 -0
  65. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos.png +0 -0
  66. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@2x.png +0 -0
  67. package/src/res/iconsMaterialOutlinedArrowsNavArrowForwardIos@3x.png +0 -0
  68. package/src/res/iconsMaterialOutlinedArrowsNavCheck.png +0 -0
  69. package/src/res/iconsMaterialOutlinedArrowsNavCheck@2x.png +0 -0
  70. package/src/res/iconsMaterialOutlinedArrowsNavCheck@3x.png +0 -0
  71. package/src/res/iconsMaterialOutlinedCalendarCalendarToday.png +0 -0
  72. package/src/res/iconsMaterialOutlinedCalendarCalendarToday@2x.png +0 -0
  73. package/src/res/iconsMaterialOutlinedCalendarCalendarToday@3x.png +0 -0
  74. package/src/res/iconsMaterialOutlinedCommunicationInfo.png +0 -0
  75. package/src/res/iconsMaterialOutlinedCommunicationInfo@2x.png +0 -0
  76. package/src/res/iconsMaterialOutlinedCommunicationInfo@3x.png +0 -0
  77. package/src/res/iconsMaterialOutlinedEditorFileDownload.png +0 -0
  78. package/src/res/iconsMaterialOutlinedEditorFileDownload@2x.png +0 -0
  79. package/src/res/iconsMaterialOutlinedEditorFileDownload@3x.png +0 -0
  80. package/src/res/iconsMaterialOutlinedEditorInventory.png +0 -0
  81. package/src/res/iconsMaterialOutlinedEditorInventory@2x.png +0 -0
  82. package/src/res/iconsMaterialOutlinedEditorInventory@3x.png +0 -0
  83. package/src/res/iconsMaterialOutlinedOtherBarChart.png +0 -0
  84. package/src/res/iconsMaterialOutlinedOtherBarChart@2x.png +0 -0
  85. package/src/res/iconsMaterialOutlinedOtherBarChart@3x.png +0 -0
  86. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf.png +0 -0
  87. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf@2x.png +0 -0
  88. package/src/res/iconsMaterialOutlinedOtherEnergySavingsLeaf@3x.png +0 -0
  89. package/src/res/iconsMaterialOutlinedOtherJoin.png +0 -0
  90. package/src/res/iconsMaterialOutlinedOtherJoin@2x.png +0 -0
  91. package/src/res/iconsMaterialOutlinedOtherJoin@3x.png +0 -0
  92. package/src/res/iconsMaterialOutlinedTimeAccessTime.png +0 -0
  93. package/src/res/iconsMaterialOutlinedTimeAccessTime@2x.png +0 -0
  94. package/src/res/iconsMaterialOutlinedTimeAccessTime@3x.png +0 -0
  95. package/src/res/iconsMaterialOutlinedWheatherWbCloudy.png +0 -0
  96. package/src/res/iconsMaterialOutlinedWheatherWbCloudy@2x.png +0 -0
  97. package/src/res/iconsMaterialOutlinedWheatherWbCloudy@3x.png +0 -0
  98. package/src/res/illustrationsFeaturesLogs.png +0 -0
  99. package/src/res/illustrationsFeaturesLogs@2x.png +0 -0
  100. package/src/res/illustrationsFeaturesLogs@3x.png +0 -0
  101. package/src/res/illustrationsHomeRoutines.png +0 -0
  102. package/src/res/illustrationsHomeRoutines@2x.png +0 -0
  103. package/src/res/illustrationsHomeRoutines@3x.png +0 -0
  104. package/src/res/leverkusen_icon.png +0 -0
  105. package/src/res/light_off.png +0 -0
  106. package/src/res/light_off@2x.png +0 -0
  107. package/src/res/light_off@3x.png +0 -0
  108. package/src/res/light_on.png +0 -0
  109. package/src/res/light_on@2x.png +0 -0
  110. package/src/res/light_on@3x.png +0 -0
  111. package/src/res/materialiconsFilledCancel.png +0 -0
  112. package/src/res/materialiconsFilledCancel@2x.png +0 -0
  113. package/src/res/materialiconsFilledCancel@3x.png +0 -0
  114. package/src/res/materialiconsOutlinedArrowsNavAddBox.png +0 -0
  115. package/src/res/materialiconsOutlinedArrowsNavAddBox@2x.png +0 -0
  116. package/src/res/materialiconsOutlinedArrowsNavAddBox@3x.png +0 -0
  117. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft.png +0 -0
  118. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft@2x.png +0 -0
  119. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowLeft@3x.png +0 -0
  120. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight.png +0 -0
  121. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight@2x.png +0 -0
  122. package/src/res/materialiconsOutlinedArrowsNavKeyboardArrowRight@3x.png +0 -0
  123. package/src/res/materialiconsOutlinedArrowsNavRemove.png +0 -0
  124. package/src/res/materialiconsOutlinedArrowsNavRemove@2x.png +0 -0
  125. package/src/res/materialiconsOutlinedArrowsNavRemove@3x.png +0 -0
  126. package/src/res/materialiconsOutlinedArrowsNavWarningAmber.png +0 -0
  127. package/src/res/materialiconsOutlinedArrowsNavWarningAmber@2x.png +0 -0
  128. package/src/res/materialiconsOutlinedArrowsNavWarningAmber@3x.png +0 -0
  129. package/src/res/offlineWifi.png +0 -0
  130. package/src/res/offlineWifi@2x.png +0 -0
  131. package/src/res/offlineWifi@3x.png +0 -0
  132. package/src/res/olympic.png +0 -0
  133. package/src/res/pic_co_alert_effect.png +0 -0
  134. package/src/res/pic_co_alert_effect@2x.png +0 -0
  135. package/src/res/pic_co_alert_effect@3x.png +0 -0
  136. package/src/res/pic_co_alert_free.png +0 -0
  137. package/src/res/pic_co_alert_free@2x.png +0 -0
  138. package/src/res/pic_co_alert_free@3x.png +0 -0
  139. package/src/res/pic_smoke_alert_effct.png +0 -0
  140. package/src/res/pic_smoke_alert_effct@2x.png +0 -0
  141. package/src/res/pic_smoke_alert_effct@3x.png +0 -0
  142. package/src/res/pic_smoke_alert_free.png +0 -0
  143. package/src/res/pic_smoke_alert_free@2x.png +0 -0
  144. package/src/res/pic_smoke_alert_free@3x.png +0 -0
  145. package/src/res/pic_water_alert_effct.png +0 -0
  146. package/src/res/pic_water_alert_effct@2x.png +0 -0
  147. package/src/res/pic_water_alert_effct@3x.png +0 -0
  148. package/src/res/pic_water_alert_free.png +0 -0
  149. package/src/res/pic_water_alert_free@2x.png +0 -0
  150. package/src/res/pic_water_alert_free@3x.png +0 -0
  151. package/src/res/refresh.png +0 -0
  152. package/src/res/refresh@2x.png +0 -0
  153. package/src/res/refresh@3x.png +0 -0
  154. package/src/res/src_res_all.png +0 -0
  155. package/src/res/src_res_colorring@2x.png +0 -0
  156. package/src/res/src_res_colorring@3x.png +0 -0
  157. package/src/res/src_res_cycle.png +0 -0
  158. package/src/res/src_res_half.png +0 -0
  159. package/src/res/src_res_halfborder.png +0 -0
  160. package/src/res/src_res_like.png +0 -0
  161. package/src/res/src_res_minus.png +0 -0
  162. package/src/res/src_res_ringdown@2x.png +0 -0
  163. package/src/res/src_res_ringdown@3x.png +0 -0
  164. package/src/res/src_res_unlike.png +0 -0
package/localazy.json CHANGED
@@ -147,11 +147,6 @@
147
147
  "MATCH:fixedTimeCycle_socket_headline",
148
148
  "MATCH:randomtimecycle_sockets_headline_text",
149
149
  "MATCH:history_socket_headline_text",
150
- "MATCH:feature_summary_action_component_5",
151
- "MATCH:feature_summary_action_component_6",
152
- "MATCH:feature_summary_action_component_7",
153
- "MATCH:feature_summary_action_component_8",
154
- "MATCH:feature_summary_action_component_9",
155
150
  "MATCH:sockets_feature_2_socket_text_min_off",
156
151
  "MATCH:sockets_feature_2_socket_text_min_on",
157
152
  "MATCH:timer_powerstrip_socket1_switched_off_text",
@@ -163,7 +158,6 @@
163
158
  "MATCH:timer_nightplug_active_timer_subheadline2_text",
164
159
  "MATCH:addTimeCycle_settings_sec_text",
165
160
  "MATCH:addTimeCycle_settings_sec_text2",
166
- "MATCH:power_strip_tile_socket_4_headline",
167
161
  "MATCH:conflict_dialog_active_item_fixedtimecycle_description",
168
162
  "MATCH:conflict_dialog_active_item_randomtimecycle_description",
169
163
  "MATCH:timeschedule_add_schedule_Lighting_applyfor_selection2_text",
@@ -378,6 +372,10 @@
378
372
  "MATCH:power_strip_feature_2_socket_2_text_min_off",
379
373
  "MATCH:power_strip_feature_2_socket_3_text_min_on",
380
374
  "MATCH:power_strip_feature_2_socket_3_text_min_off",
375
+ "MATCH:power_strip_feature_2_socket_4_text_min_on",
376
+ "MATCH:power_strip_feature_2_socket_4_text_min_off",
377
+ "MATCH:power_strip_feature_2_socket_5_text_min_on",
378
+ "MATCH:power_strip_feature_2_socket_5_text_min_off",
381
379
  "MATCH:power_strip_feature_2_socket_usb_text_min_off",
382
380
  "MATCH:power_strip_feature_2_socket_usb_text_min_on",
383
381
  "MATCH:generation_data_description_text",
@@ -1041,7 +1039,14 @@
1041
1039
  "MATCH:offline",
1042
1040
  "MATCH:consumption_data_field4_button_text",
1043
1041
  "MATCH:consumption_data_price_per_l_headline_text",
1044
- "MATCH:consumption_data_price_per_l_description_text"
1042
+ "MATCH:consumption_data_price_per_l_description_text",
1043
+ "MATCH:power_strip_tile_socket_1_headline",
1044
+ "MATCH:power_strip_tile_socket_2_headline",
1045
+ "MATCH:power_strip_tile_socket_3_headline",
1046
+ "MATCH:power_strip_tile_socket_4_headline",
1047
+ "MATCH:power_strip_tile_socket_5_headline",
1048
+ "MATCH:power_strip_tile_socket_usb_headline",
1049
+ "MATCH:manual_search_button_socket"
1045
1050
  ],
1046
1051
  "replacements": {
1047
1052
  "REGEX:% %1\\$s.*?\\)%": "{0}",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.3.44",
7
+ "version": "1.3.46",
8
8
  "scripts": {
9
9
  "prepublishOnly": "python update-localazy.py"
10
10
  },
package/src/api/native.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import {NativeModules, Platform} from 'react-native'
2
2
  import {NativeResult, Result} from '../models/modules/Result'
3
- import { TYSdk } from 'tuya-panel-kit'
3
+ import {DpSchema, TYSdk} from 'tuya-panel-kit'
4
4
  interface LDVDevicePanelManager {
5
5
  back: () => void
6
6
  control: (params: any, callback: (result: any) => void) => void
@@ -64,6 +64,7 @@ export interface DeviceInfo {
64
64
  status: number
65
65
  dps: string
66
66
  tuyaDeviceId: string
67
+ tuyaSchema?: DpSchema[]
67
68
  }
68
69
 
69
70
  const devicePanel: LDVDevicePanelManager = NativeModules.LDVDevicePanelManager
@@ -213,7 +214,7 @@ function toDeviceSettingsPage(tuyaDeviceId: string, isGroup: boolean = false) {
213
214
  devicePanel.toDeviceSettingsPage(tuyaDeviceId, isGroup)
214
215
  }
215
216
 
216
- function toRoutinesPage(params: {backTitle:string, deviceId:string}) {
217
+ function toRoutinesPage(params: {backTitle:string, deviceId:string, type?: 'DeviceStatusChange', dpId?: string, dpValue?: any}) {
217
218
  devicePanel.toRoutinesPage(params)
218
219
  }
219
220
 
@@ -298,7 +299,7 @@ export class NativeApi {
298
299
  toDeviceSettingsPage(deviceId, isGroup)
299
300
  }
300
301
 
301
- static toRoutinesPage(params: {backTitle:string, deviceId:string}): void{
302
+ static toRoutinesPage(params: {backTitle:string, deviceId:string, type?: 'DeviceStatusChange', dpId?: string, dpValue?: any}): void{
302
303
  toRoutinesPage(params)
303
304
  }
304
305
 
@@ -41,7 +41,7 @@ function AdvanceList(props: AdvanceListProps) {
41
41
  justifyContent: 'center',
42
42
  alignItems: 'center',
43
43
  }}>
44
- <Image source={item.icons} style={{ width: cx(80), height: cx(80) }} />
44
+ <Image source={{ uri: item.icons }} style={{ width: cx(80), height: cx(80) }} />
45
45
  </View>}
46
46
  </AdvanceCard>
47
47
  </View>
@@ -92,7 +92,7 @@ const ApplyForDeviceItem = (props: ApplyForDeviceItemProps) => {
92
92
  <Spacer height={cx(6)} />
93
93
  </View>
94
94
  <View style={[styles.offlineIcon, { marginHorizontal: cx(5) }]}>
95
- {!props.deviceInfo.status && <Image style={styles.offlineIcon} source={res.offline_wifi} />}
95
+ {!props.deviceInfo.status && <Image style={styles.offlineIcon} source={{ uri: res.offline_wifi }} />}
96
96
  {!!props.deviceInfo.status && isNumber(curPower) && <View style={{ alignItems: 'flex-end' }}>
97
97
  <Text style={styles.onlineText}>{`${curPower / 10} W`}</Text>
98
98
  <Text style={[styles.onlineText, { fontSize: cx(12), marginTop: cx(5) }]}>{I18n.getLang('consumption_data_field1_headline_text')}</Text>
@@ -47,7 +47,7 @@ const ApplyForText = (props: ApplyForTextProps) => {
47
47
  transform: [{ rotate: props.expand ? '0deg' : '180deg' }],
48
48
  },
49
49
  ]}
50
- source={res.ic_top_arrow}/>
50
+ source={{ uri: res.ic_top_arrow}}/>
51
51
  </View>
52
52
  </TouchableOpacity>
53
53
  )
@@ -132,24 +132,24 @@ const BallDirectionView = (props: BallDirectionProps) => {
132
132
  <TouchableOpacity style={{width: cx(40), height: cx(40)}} onPress={() => {
133
133
  onPaintModeChanged(PaintMode.Top);
134
134
  }}>
135
- <Image source={res.half} style={styles.paintModeHalf}/>
135
+ <Image source={{ uri: res.half}} style={styles.paintModeHalf}/>
136
136
  </TouchableOpacity>}
137
137
  <TouchableOpacity
138
138
  style={{width: cx(40), height: cx(40), marginTop: cx(10),}}
139
139
  onPress={() => {
140
140
  onPaintModeChanged(PaintMode.ALL);
141
141
  }}>
142
- <Image source={res.all} style={styles.paintModeAll}/>
142
+ <Image source={{ uri: res.all }} style={styles.paintModeAll}/>
143
143
  </TouchableOpacity>
144
144
  </View>
145
145
  <View style={styles.circleLayout}>
146
146
  <View style={styles.circleBorder}/>
147
147
  {state.paintMode === PaintMode.ALL &&
148
- <Image source={res.coloring} style={styles.coloring}/>}
148
+ <Image source={{ uri: res.coloring}} style={styles.coloring}/>}
149
149
  {state.paintMode === PaintMode.Top &&
150
- <Image source={res.ringdown} style={styles.ringUp}/>}
150
+ <Image source={{ uri: res.ringdown}} style={styles.ringUp}/>}
151
151
  {state.paintMode === PaintMode.Bottom &&
152
- <Image source={res.ringdown} style={styles.ringDown}/>}
152
+ <Image source={{ uri: res.ringdown}} style={styles.ringDown}/>}
153
153
  <TouchableOpacity
154
154
  style={styles.halfCircleUp}
155
155
  disabled={state.paintMode === PaintMode.ALL}
@@ -0,0 +1,75 @@
1
+ import React from 'react'
2
+ import Card from './Card'
3
+ import {Battery, Utils} from 'tuya-panel-kit'
4
+ import {StyleSheet, Text, View} from 'react-native'
5
+ import I18n from '../i18n'
6
+ import Spacer from './Spacer'
7
+ import ThemeType from '../config/themeType'
8
+
9
+ const cx = Utils.RatioUtils.convertX
10
+ const {withTheme} = Utils.ThemeUtils
11
+ type BatteryProps = {
12
+ value: number
13
+ lowValue?: number
14
+ middleValue?: number
15
+ highValue?: number
16
+ theme?: ThemeType
17
+ }
18
+
19
+ const BatteryPercentageView = (props: BatteryProps) => {
20
+ const {value, middleValue = 30, highValue = 70} = props
21
+ const calcColor = (_: any, normalColor: string, lowColor: string, emptyColor: string) => {
22
+ if (value >= highValue) {
23
+ return normalColor
24
+ } else if (props.value >= middleValue) {
25
+ return lowColor
26
+ } else {
27
+ return emptyColor
28
+ }
29
+ }
30
+
31
+ const styles = StyleSheet.create({
32
+ title: {
33
+ marginStart: cx(16),
34
+ marginVertical: cx(18),
35
+ color: props.theme?.global.fontColor,
36
+ fontSize: cx(16),
37
+ fontFamily: 'helvetica_neue_lt_std_bd',
38
+ },
39
+ batteryRotate: {
40
+ transform: [{rotate: '90deg'}],
41
+ position: 'relative',
42
+ right: cx(30),
43
+ },
44
+ content: {
45
+ marginEnd: cx(16),
46
+ color: props.theme?.global.fontColor,
47
+ fontSize: cx(14),
48
+ fontFamily: 'helvetica_neue_lt_std_roman',
49
+ },
50
+ low: {
51
+ color: props.theme?.global.error
52
+ }
53
+ })
54
+
55
+ return (
56
+ <Card
57
+ style={{marginHorizontal: cx(24), marginTop: cx(10)}}
58
+ containerStyle={{flexDirection: 'row', alignItems: 'center'}}
59
+ >
60
+ <Text style={styles.title}>{I18n.getLang('motion_detector_battery__state4')}</Text>
61
+ <Spacer height={0} style={{flex: 1}}/>
62
+ <View style={styles.batteryRotate}>
63
+ <Battery
64
+ value={props.value}
65
+ onCalcColor={calcColor}
66
+ size={cx(30)}
67
+ theme={{batteryColor: props.theme?.global.secondFontColor || '#000'}}
68
+ />
69
+ </View>
70
+ <Text style={[styles.content, value < middleValue ? styles.low : null]}>{value}%</Text>
71
+ </Card>
72
+ )
73
+ }
74
+
75
+ export default withTheme(BatteryPercentageView)
@@ -81,7 +81,7 @@ const DiySceneNodeView = (props: DiySceneNodeProps) => {
81
81
  resizeMode: 'contain',
82
82
  tintColor: state.halfCircleTopColor
83
83
  }}/>
84
- { (isCurrent && position === 'Top') && <Image source={res.halfborder} style={styles.borderTop} />}
84
+ { (isCurrent && position === 'Top') && <Image source={{uri: res.halfborder}} style={styles.borderTop} />}
85
85
  </TouchableOpacity>
86
86
  <TouchableOpacity
87
87
  style={styles.halfCircleDown}
@@ -95,7 +95,7 @@ const DiySceneNodeView = (props: DiySceneNodeProps) => {
95
95
  transform: [{rotate: '180deg'}],
96
96
  tintColor: state.halfCircleBottomColor
97
97
  }}/>
98
- {(isCurrent && position === 'Bottom') && <Image source={res.halfborder} style={styles.borderBottom} />}
98
+ {(isCurrent && position === 'Bottom') && <Image source={{uri: res.halfborder}} style={styles.borderBottom} />}
99
99
  </TouchableOpacity>
100
100
  </View>)
101
101
  }
@@ -154,7 +154,7 @@ const DrawToolView = (props: DrawToolViewProps) => {
154
154
  }}>
155
155
  <Image
156
156
  style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? props.theme?.icon.primary : props.theme?.icon.normal }]}
157
- source={res.ic_paint_bucket} />
157
+ source={{ uri: res.ic_paint_bucket}} />
158
158
  </TouchableOpacity>
159
159
  {!props.hideDisableLight && <TouchableOpacity
160
160
  onPress={() => {
@@ -162,7 +162,7 @@ const DrawToolView = (props: DrawToolViewProps) => {
162
162
  }}>
163
163
  <Image
164
164
  style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? props.theme?.icon.primary : props.theme?.icon.normal }]}
165
- source={res.ic_disabled_light} />
165
+ source={{uri: res.ic_disabled_light}} />
166
166
  </TouchableOpacity>}
167
167
  {!props.hideColorize && <TouchableOpacity
168
168
  onPress={() => {
@@ -170,7 +170,7 @@ const DrawToolView = (props: DrawToolViewProps) => {
170
170
  }}>
171
171
  <Image
172
172
  style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? props.theme?.icon.primary : props.theme?.icon.normal }]}
173
- source={res.ic_colorize} />
173
+ source={{uri: res.ic_colorize}} />
174
174
  </TouchableOpacity>}
175
175
  {!props.hideLedNum && <TouchableOpacity
176
176
  onPress={() => {
@@ -88,7 +88,7 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
88
88
  <Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('ceiling_fan_direction_info_option_2_text')}</Text>
89
89
  </View>,
90
90
  })}>
91
- <Image style={{width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary}} source={res.ic_info}/>
91
+ <Image style={{width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary}} source={{uri: res.ic_info}}/>
92
92
  </TouchableOpacity>
93
93
  </View>
94
94
  <Segmented
@@ -118,7 +118,7 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
118
118
  <Text style={{color: props.theme?.global.fontColor}}>{I18n.getLang('ceiling_fan_mode_info_option_2_text')}</Text>
119
119
  </View>,
120
120
  })}>
121
- <Image style={{width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary}} source={res.ic_info}/>
121
+ <Image style={{width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary}} source={{uri: res.ic_info}}/>
122
122
  </TouchableOpacity>
123
123
  </View>
124
124
  <Segmented
@@ -100,7 +100,7 @@ const MoodStripAdjustView = (props: MoodStripAdjustViewProps) => {
100
100
  }}>
101
101
  {
102
102
  sceneInfo.id === -1 ?
103
- <Image source={res.cycle} style={{width: cx(50), height: cx(50)}}/> :
103
+ <Image source={{ uri: res.cycle}} style={{width: cx(50), height: cx(50)}}/> :
104
104
  <View style={{justifyContent: 'center', alignItems: 'center', width: '100%', height: '100%'}}>
105
105
  {props.favoriteScenes.length > 3 &&
106
106
  <TouchableOpacity
@@ -108,7 +108,7 @@ const MoodStripAdjustView = (props: MoodStripAdjustViewProps) => {
108
108
  onPress={() => {
109
109
  props.onFavoriteSceneRemove && props.onFavoriteSceneRemove(sceneInfo)
110
110
  }}>
111
- <Image source={res.minus} style={{width: cx(10), height: cx(10), tintColor: props.theme?.icon.primary}}/>
111
+ <Image source={{uri: res.minus}} style={{width: cx(10), height: cx(10), tintColor: props.theme?.icon.primary}}/>
112
112
  </TouchableOpacity>
113
113
  }
114
114
  <Text style={{fontSize: cx(8), color: props.theme?.global.fontColor}}>{sceneInfo.name}</Text>
@@ -0,0 +1,158 @@
1
+ import React, {useCallback, useEffect, useState} from 'react';
2
+ import Card from './Card';
3
+ import {Utils} from 'tuya-panel-kit';
4
+ import {FlatList, StyleSheet, Text, View} from 'react-native';
5
+ import Spacer from './Spacer';
6
+ import ThemeType from '../config/themeType';
7
+ import {useNavigation} from '@react-navigation/core';
8
+ import {NativeApi} from "../api/native";
9
+
10
+ const cx = Utils.RatioUtils.convertX;
11
+ const {withTheme} = Utils.ThemeUtils;
12
+
13
+ type PressActionProps = {
14
+ channel: 1 | 2 | 4
15
+ backTitle: string
16
+ deviceId: string
17
+ dpIds: string[]
18
+ dpIndex: number
19
+ routerKey?: string
20
+ theme?: ThemeType
21
+ };
22
+
23
+ enum PressType {
24
+ Single = 'single_click',
25
+ Double = 'double_click',
26
+ Long = 'long_press'
27
+ }
28
+
29
+ interface ActionData {
30
+ title: string
31
+ onPress: () => void
32
+ }
33
+
34
+ const PressActionView = (props: PressActionProps) => {
35
+ const navigation = useNavigation()
36
+ const [actionData, setActionData] = useState<ActionData[]>([])
37
+
38
+ const toSettingPage = useCallback((dpIndex: number) => {
39
+ navigation.navigate(props.routerKey ?? 'setting', {
40
+ dpIds: props.dpIds,
41
+ dpIndex: dpIndex
42
+ })
43
+ }, [props.routerKey, props.backTitle, props.deviceId, props.dpIds, props.dpIndex])
44
+
45
+ const toRoutinesPage = useCallback((dpValue: PressType) => {
46
+ NativeApi.toRoutinesPage({
47
+ backTitle: props.backTitle,
48
+ deviceId: props.deviceId,
49
+ type: 'DeviceStatusChange',
50
+ dpId: props.dpIds[props.dpIndex],
51
+ dpValue: dpValue
52
+ })
53
+ }, [props.backTitle, props.deviceId, props.dpIds, props.dpIndex])
54
+
55
+ useEffect(() => {
56
+ let data: ActionData[]
57
+ if (props.channel === 1) {
58
+ data = [
59
+ {
60
+ title: 'Single Press', onPress: () => toRoutinesPage(PressType.Single)
61
+ },
62
+ {
63
+ title: 'Double Press', onPress: () => toRoutinesPage(PressType.Double)
64
+ },
65
+ {
66
+ title: 'Long Press', onPress: () => toRoutinesPage(PressType.Long)
67
+ },
68
+ ]
69
+ } else {
70
+ data = [
71
+ {
72
+ title: 'Switch 1',
73
+ onPress: () => toSettingPage(0)
74
+ },
75
+ {
76
+ title: 'Switch 2',
77
+ onPress: () => toSettingPage(1)
78
+ },
79
+ ]
80
+ if (props.channel === 4) {
81
+ data = data.concat(
82
+ {
83
+ title: 'Switch 3',
84
+ onPress: () => toSettingPage(2)
85
+ },
86
+ {
87
+ title: 'Switch 4',
88
+ onPress: () => toSettingPage(3)
89
+ }
90
+ )
91
+ }
92
+ }
93
+ setActionData(data)
94
+ }, [props.channel, props.backTitle, props.deviceId])
95
+
96
+ const styles = StyleSheet.create({
97
+ container: {
98
+ marginHorizontal: cx(14),
99
+ },
100
+ item: {
101
+ flex: 0.5,
102
+ justifyContent: 'center',
103
+ alignItems: 'center',
104
+ },
105
+ itemContainer: {
106
+ width: cx(154),
107
+ borderRadius: cx(16),
108
+ },
109
+ itemContent: {},
110
+ titleBg: {
111
+ height: cx(118),
112
+ justifyContent: 'center',
113
+ alignItems: 'center',
114
+ },
115
+ title: {
116
+ marginHorizontal: cx(16),
117
+ color: props.theme?.global.fontColor ?? 'black', // 添加默认值
118
+ fontSize: cx(14),
119
+ textAlign: 'center',
120
+ fontFamily: 'helvetica_neue_lt_std_roman',
121
+ },
122
+ })
123
+
124
+ const renderItem = useCallback(({item}) => (
125
+ <View style={styles.item}>
126
+ <Card
127
+ style={styles.itemContainer}
128
+ containerStyle={styles.itemContent}
129
+ onPress={item.onPress}>
130
+ <View style={styles.titleBg}>
131
+ <Text style={styles.title}>{item.title}</Text>
132
+ <Spacer height={cx(8)}/>
133
+ </View>
134
+ </Card>
135
+ </View>
136
+ ), [styles])
137
+
138
+ const keyExtractor = useCallback((_: ActionData, index: number) => `key-${index}`, [])
139
+ const Header = useCallback(() => <Spacer height={cx(10)}/>, [])
140
+ const Separator = useCallback(() => <Spacer/>, [])
141
+ const Footer = useCallback(() => <Spacer height={cx(30)}/>, [])
142
+
143
+ return (
144
+ <FlatList
145
+ scrollEnabled={false}
146
+ numColumns={2}
147
+ style={styles.container}
148
+ data={actionData}
149
+ renderItem={renderItem}
150
+ keyExtractor={keyExtractor}
151
+ ListHeaderComponent={Header}
152
+ ItemSeparatorComponent={Separator}
153
+ ListFooterComponent={Footer}
154
+ />
155
+ )
156
+ }
157
+
158
+ export default withTheme(PressActionView)
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { View, Text, TouchableOpacity, Image } from 'react-native'
3
3
  import { Utils, Popup } from 'tuya-panel-kit'
4
- import Img from '@res'
4
+ import res from '@res'
5
5
  import Strings from '@i18n'
6
6
 
7
7
  const { convertX, height } = Utils.RatioUtils
@@ -83,7 +83,7 @@ export const ShowSelectView = (title, data, defaultValue, callback) => {
83
83
  {defaultValue === title &&
84
84
  <Image
85
85
  style={{ width: convertX(16), height: convertX(16) }}
86
- source={Img.app_music_check}
86
+ source={{ uri: res.app_music_check}}
87
87
  resizeMode="contain"
88
88
  />}
89
89
  </TouchableOpacity>)
@@ -35,7 +35,7 @@ function SocketItem(props: SocketItemProps) {
35
35
  fontWeight: 'bold',
36
36
  },
37
37
  icon: {
38
- width: cx(60),
38
+ width: cx(80),
39
39
  height: cx(20),
40
40
  },
41
41
  nameLine: {
@@ -114,7 +114,7 @@ const Stepper = (props: StepperProps) => {
114
114
  style={[styles.stepperButton, props.buttonStyle]}
115
115
  onPress={() => handlePress(false)}
116
116
  >
117
- <Image style={styles.stepperIcon} source={res.ic_minus} />
117
+ <Image style={styles.stepperIcon} source={{uri: res.ic_minus}} />
118
118
  </TouchableOpacity>
119
119
  <TextInput
120
120
  style={[styles.stepperInput, props.inputStyle]}
@@ -130,7 +130,7 @@ const Stepper = (props: StepperProps) => {
130
130
  style={[styles.stepperButton, props.buttonStyle]}
131
131
  onPress={() => handlePress(true)}
132
132
  >
133
- <Image style={styles.stepperIcon} source={res.ic_plus} />
133
+ <Image style={styles.stepperIcon} source={{uri: res.ic_plus}} />
134
134
  </TouchableOpacity>
135
135
  </View>
136
136
  )
@@ -54,7 +54,7 @@ const Tag = (props: TagProps) => {
54
54
  {
55
55
  props.checked &&
56
56
  <Image
57
- source={res.ic_arrows_nav_clear}
57
+ source={{uri: res.ic_arrows_nav_clear}}
58
58
  style={styles.icon}/>
59
59
  }
60
60
  </View>
@@ -17,7 +17,7 @@ interface TextFieldProps extends TextInputProps {
17
17
  }
18
18
 
19
19
  const TextField = (props: TextFieldProps) => {
20
- const icon = props.tipIcon || res.ic_warning_amber
20
+ const icon = props.tipIcon || { uri: res.ic_warning_amber}
21
21
  const color = props.tipColor || props.theme?.global.warning
22
22
  const editable = props.editable ?? !props.editable
23
23
 
@@ -68,7 +68,7 @@ const TextFieldStyleButton = (props: TextFieldStyleButtonProps) => {
68
68
  <View style={styles.tipParent}>
69
69
  <Text style={styles.topTip}>{props.placeholder}</Text>
70
70
  {props.showTipIcon && <TouchableOpacity onPress={props.onTipIconPress}>
71
- <Image source={res.ic_info} style={styles.tipIcon}/>
71
+ <Image source={{uri: res.ic_info}} style={styles.tipIcon}/>
72
72
  </TouchableOpacity>}
73
73
  </View>
74
74
  <TouchableOpacity onPress={props.onPress}>
@@ -28,7 +28,7 @@ const UATabTitle = (props: UATabTitleProps) => {
28
28
  <Text style={styles.tabsTitle}>{props.text}</Text>
29
29
  <Spacer height={cx(0)} width={cx(4)}/>
30
30
  <TouchableOpacity onPress={props.onIconClick}>
31
- <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary }} source={res.ic_info}/>
31
+ <Image style={{ width: cx(16), height: cx(16), tintColor: props.theme?.icon.primary }} source={{ uri: res.ic_info}}/>
32
32
  </TouchableOpacity>
33
33
  </View>
34
34
  )