@ledvance/base 1.3.60 → 1.3.61
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 +1 -1
- package/src/components/BatteryPercentageView.tsx +13 -8
- package/src/i18n/strings.ts +774 -774
- package/src/res/index.ts +3 -1
- package/src/components/PressActionView.tsx +0 -159
package/src/res/index.ts
CHANGED
|
@@ -157,7 +157,7 @@ export default {
|
|
|
157
157
|
delay_48h: 'delay_48h_unselect',
|
|
158
158
|
delay_72h: 'delay_72h_unselect',
|
|
159
159
|
start: 'button_start',
|
|
160
|
-
stop: '
|
|
160
|
+
stop: 'button_stop',
|
|
161
161
|
take_photo: 'icon_take_photo',
|
|
162
162
|
record_video: 'icon_record_video',
|
|
163
163
|
clarity_hd: 'icon_clarity_hd',
|
|
@@ -177,4 +177,6 @@ export default {
|
|
|
177
177
|
shutter_open: 'rn_button_open',
|
|
178
178
|
shutter_close: 'rn_button_close',
|
|
179
179
|
ic_checked: 'rn_ic_marked_circleoutline',
|
|
180
|
+
icon_eyes_opens: 'rn_icon_eyes_opens',
|
|
181
|
+
icon_eyes_closed: 'rn_icon_eyes_closed',
|
|
180
182
|
}
|
|
@@ -1,159 +0,0 @@
|
|
|
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
|
-
import I18n from "../i18n/index";
|
|
10
|
-
|
|
11
|
-
const cx = Utils.RatioUtils.convertX;
|
|
12
|
-
const {withTheme} = Utils.ThemeUtils;
|
|
13
|
-
|
|
14
|
-
type PressActionProps = {
|
|
15
|
-
channel: 1 | 2 | 4
|
|
16
|
-
backTitle: string
|
|
17
|
-
deviceId: string
|
|
18
|
-
dpIds: string[]
|
|
19
|
-
dpIndex: number
|
|
20
|
-
routerKey?: string
|
|
21
|
-
theme?: ThemeType
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
enum PressType {
|
|
25
|
-
Single = 'single_click',
|
|
26
|
-
Double = 'double_click',
|
|
27
|
-
Long = 'long_press'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface ActionData {
|
|
31
|
-
title: string
|
|
32
|
-
onPress: () => void
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const PressActionView = (props: PressActionProps) => {
|
|
36
|
-
const navigation = useNavigation()
|
|
37
|
-
const [actionData, setActionData] = useState<ActionData[]>([])
|
|
38
|
-
|
|
39
|
-
const toSettingPage = useCallback((dpIndex: number) => {
|
|
40
|
-
navigation.navigate(props.routerKey ?? 'setting', {
|
|
41
|
-
dpIds: props.dpIds,
|
|
42
|
-
dpIndex: dpIndex
|
|
43
|
-
})
|
|
44
|
-
}, [props.routerKey, props.backTitle, props.deviceId, props.dpIds, props.dpIndex])
|
|
45
|
-
|
|
46
|
-
const toRoutinesPage = useCallback((dpValue: PressType) => {
|
|
47
|
-
NativeApi.toRoutinesPage({
|
|
48
|
-
backTitle: props.backTitle,
|
|
49
|
-
deviceId: props.deviceId,
|
|
50
|
-
type: 'DeviceStatusChange',
|
|
51
|
-
dpId: props.dpIds[props.dpIndex],
|
|
52
|
-
dpValue: dpValue
|
|
53
|
-
})
|
|
54
|
-
}, [props.backTitle, props.deviceId, props.dpIds, props.dpIndex])
|
|
55
|
-
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
let data: ActionData[]
|
|
58
|
-
if (props.channel === 1) {
|
|
59
|
-
data = [
|
|
60
|
-
{
|
|
61
|
-
title: I18n.getLang('switch_singlepress'), onPress: () => toRoutinesPage(PressType.Single)
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
title: I18n.getLang('switch_doublepress'), onPress: () => toRoutinesPage(PressType.Double)
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
title: I18n.getLang('switch_longpress'), onPress: () => toRoutinesPage(PressType.Long)
|
|
68
|
-
},
|
|
69
|
-
]
|
|
70
|
-
} else {
|
|
71
|
-
data = [
|
|
72
|
-
{
|
|
73
|
-
title: I18n.getLang('switch_4channelfunctions1'),
|
|
74
|
-
onPress: () => toSettingPage(0)
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
title: I18n.getLang('switch_4channelfunctions2'),
|
|
78
|
-
onPress: () => toSettingPage(1)
|
|
79
|
-
},
|
|
80
|
-
]
|
|
81
|
-
if (props.channel === 4) {
|
|
82
|
-
data = data.concat(
|
|
83
|
-
{
|
|
84
|
-
title: I18n.getLang('switch_4channelfunctions3'),
|
|
85
|
-
onPress: () => toSettingPage(2)
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
title: I18n.getLang('switch_4channelfunctions4'),
|
|
89
|
-
onPress: () => toSettingPage(3)
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
setActionData(data)
|
|
95
|
-
}, [props.channel, props.backTitle, props.deviceId])
|
|
96
|
-
|
|
97
|
-
const styles = StyleSheet.create({
|
|
98
|
-
container: {
|
|
99
|
-
marginHorizontal: cx(14),
|
|
100
|
-
},
|
|
101
|
-
item: {
|
|
102
|
-
flex: 0.5,
|
|
103
|
-
justifyContent: 'center',
|
|
104
|
-
alignItems: 'center',
|
|
105
|
-
},
|
|
106
|
-
itemContainer: {
|
|
107
|
-
width: cx(154),
|
|
108
|
-
borderRadius: cx(16),
|
|
109
|
-
},
|
|
110
|
-
itemContent: {},
|
|
111
|
-
titleBg: {
|
|
112
|
-
height: cx(118),
|
|
113
|
-
justifyContent: 'center',
|
|
114
|
-
alignItems: 'center',
|
|
115
|
-
},
|
|
116
|
-
title: {
|
|
117
|
-
marginHorizontal: cx(16),
|
|
118
|
-
color: props.theme?.global.fontColor ?? 'black', // 添加默认值
|
|
119
|
-
fontSize: cx(14),
|
|
120
|
-
textAlign: 'center',
|
|
121
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
122
|
-
},
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const renderItem = useCallback(({item}) => (
|
|
126
|
-
<View style={styles.item}>
|
|
127
|
-
<Card
|
|
128
|
-
style={styles.itemContainer}
|
|
129
|
-
containerStyle={styles.itemContent}
|
|
130
|
-
onPress={item.onPress}>
|
|
131
|
-
<View style={styles.titleBg}>
|
|
132
|
-
<Text style={styles.title}>{item.title}</Text>
|
|
133
|
-
<Spacer height={cx(8)}/>
|
|
134
|
-
</View>
|
|
135
|
-
</Card>
|
|
136
|
-
</View>
|
|
137
|
-
), [styles])
|
|
138
|
-
|
|
139
|
-
const keyExtractor = useCallback((_: ActionData, index: number) => `key-${index}`, [])
|
|
140
|
-
const Header = useCallback(() => <Spacer height={cx(10)}/>, [])
|
|
141
|
-
const Separator = useCallback(() => <Spacer/>, [])
|
|
142
|
-
const Footer = useCallback(() => <Spacer height={cx(30)}/>, [])
|
|
143
|
-
|
|
144
|
-
return (
|
|
145
|
-
<FlatList
|
|
146
|
-
scrollEnabled={false}
|
|
147
|
-
numColumns={2}
|
|
148
|
-
style={styles.container}
|
|
149
|
-
data={actionData}
|
|
150
|
-
renderItem={renderItem}
|
|
151
|
-
keyExtractor={keyExtractor}
|
|
152
|
-
ListHeaderComponent={Header}
|
|
153
|
-
ItemSeparatorComponent={Separator}
|
|
154
|
-
ListFooterComponent={Footer}
|
|
155
|
-
/>
|
|
156
|
-
)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export default withTheme(PressActionView)
|