@ledvance/base 1.3.27 → 1.3.29
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/api/nativeEventEmitter.ts +2 -2
- package/src/components/AdvanceList.tsx +1 -1
- package/src/components/BallDirectionView.tsx +1 -1
- package/src/components/Card.tsx +1 -1
- package/src/components/Cell.tsx +67 -59
- package/src/components/MoodStripAdjustView.tsx +1 -1
- package/src/components/Page.tsx +2 -2
- package/src/components/Segmented.tsx +1 -1
- package/src/components/TextField.tsx +3 -1
- package/src/components/ldvSwitch.tsx +1 -1
- package/src/components/ldvTopBar.tsx +1 -1
- package/src/components/weekSelect.tsx +1 -1
- package/src/hooks/Hooks.ts +8 -2
- package/src/i18n/strings.ts +12703 -12703
- package/src/models/modules/NativePropsSlice.tsx +3 -3
- package/src/utils/common.ts +41 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
DeviceInfo,
|
|
4
4
|
GestureControlType,
|
|
5
5
|
NativeProps,
|
|
6
|
-
|
|
6
|
+
setGestureControlValues,
|
|
7
7
|
setGroupDevices,
|
|
8
8
|
setGroupDps,
|
|
9
9
|
setGroupNativeProps,
|
|
@@ -131,7 +131,7 @@ export const addListener = (store) => {
|
|
|
131
131
|
})
|
|
132
132
|
|
|
133
133
|
gestrueControlListener = nativeEventEmitter.addListener('LDV_GESTURE_CONTROL_COMMAND', (event: GestureControlType) => {
|
|
134
|
-
store.dispatch(
|
|
134
|
+
store.dispatch(setGestureControlValues(event))
|
|
135
135
|
})
|
|
136
136
|
}
|
|
137
137
|
|
package/src/components/Card.tsx
CHANGED
package/src/components/Cell.tsx
CHANGED
|
@@ -1,70 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {IconFont, Utils} from 'tuya-panel-kit'
|
|
2
|
+
import {StyleProp, Text, TextStyle, TouchableOpacity, View, ViewStyle} from 'react-native'
|
|
3
3
|
import React from 'react'
|
|
4
|
+
import ThemeType from "../config/themeType";
|
|
4
5
|
|
|
5
6
|
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
const {withTheme} = Utils.ThemeUtils
|
|
6
8
|
|
|
7
9
|
interface CellProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
theme?: ThemeType
|
|
11
|
+
title: string,
|
|
12
|
+
value: string,
|
|
13
|
+
onPress: () => void,
|
|
14
|
+
style?: StyleProp<ViewStyle>
|
|
12
15
|
}
|
|
13
16
|
|
|
14
|
-
export default function Cell(props: CellProps) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
export default withTheme(function Cell(props: CellProps) {
|
|
18
|
+
return (
|
|
19
|
+
<TouchableOpacity
|
|
20
|
+
style={[{
|
|
21
|
+
height: cx(50),
|
|
22
|
+
paddingHorizontal: cx(24),
|
|
23
|
+
justifyContent: 'center',
|
|
24
|
+
backgroundColor: props.theme?.card.background,
|
|
25
|
+
}, props.style]}
|
|
26
|
+
onPress={props.onPress}>
|
|
27
|
+
<CellContent title={props.title} value={props.value}/>
|
|
28
|
+
</TouchableOpacity>
|
|
29
|
+
)
|
|
30
|
+
}) as React.ComponentType<CellProps>
|
|
27
31
|
|
|
28
32
|
interface CellContentProps {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
theme?: ThemeType
|
|
34
|
+
title: string
|
|
35
|
+
value: string
|
|
36
|
+
style?: StyleProp<ViewStyle>
|
|
37
|
+
titleStyle?: StyleProp<TextStyle>
|
|
38
|
+
valueStyle?: StyleProp<TextStyle>
|
|
39
|
+
iconStyle?: { color?: any, size?: number }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const CellContentBase = (props: CellContentProps) => {
|
|
43
|
+
return (
|
|
44
|
+
<View
|
|
45
|
+
style={[
|
|
46
|
+
{flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center'},
|
|
47
|
+
props.style,
|
|
48
|
+
]}>
|
|
49
|
+
<Text
|
|
50
|
+
style={[
|
|
51
|
+
{
|
|
52
|
+
fontSize: cx(14),
|
|
53
|
+
color: props.theme?.global.secondFontColor,
|
|
54
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
55
|
+
},
|
|
56
|
+
props.titleStyle,
|
|
57
|
+
]}>{props.title}</Text>
|
|
58
|
+
<View style={{flexDirection: 'row', alignItems: 'center'}}>
|
|
59
|
+
<Text style={[
|
|
60
|
+
{
|
|
61
|
+
fontSize: cx(14),
|
|
62
|
+
color: props.theme?.global.secondFontColor,
|
|
63
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
64
|
+
},
|
|
65
|
+
props.valueStyle,
|
|
66
|
+
]}>{props.value}</Text>
|
|
67
|
+
<View style={{width: cx(4)}}/>
|
|
68
|
+
<IconFont
|
|
69
|
+
name="arrow"
|
|
70
|
+
color={props.iconStyle?.color || props.theme?.global.secondFontColor}
|
|
71
|
+
size={props.iconStyle?.size || cx(11)}/>
|
|
72
|
+
</View>
|
|
73
|
+
</View>
|
|
74
|
+
)
|
|
35
75
|
}
|
|
76
|
+
const CellContent = withTheme(CellContentBase) as React.ComponentType<CellContentProps>
|
|
36
77
|
|
|
37
|
-
export
|
|
38
|
-
return (
|
|
39
|
-
<View
|
|
40
|
-
style={[
|
|
41
|
-
{ flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' },
|
|
42
|
-
props.style,
|
|
43
|
-
]}>
|
|
44
|
-
<Text
|
|
45
|
-
style={[
|
|
46
|
-
{
|
|
47
|
-
fontSize: cx(14),
|
|
48
|
-
color: '#444',
|
|
49
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
50
|
-
},
|
|
51
|
-
props.titleStyle,
|
|
52
|
-
]}>{props.title}</Text>
|
|
53
|
-
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
|
|
54
|
-
<Text style={[
|
|
55
|
-
{
|
|
56
|
-
fontSize: cx(14),
|
|
57
|
-
color: '#444',
|
|
58
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
59
|
-
},
|
|
60
|
-
props.valueStyle,
|
|
61
|
-
]}>{props.value}</Text>
|
|
62
|
-
<View style={{ width: cx(4) }} />
|
|
63
|
-
<IconFont
|
|
64
|
-
name="arrow"
|
|
65
|
-
color={props.iconStyle?.color || '#444'}
|
|
66
|
-
size={props.iconStyle?.size || cx(11)} />
|
|
67
|
-
</View>
|
|
68
|
-
</View>
|
|
69
|
-
)
|
|
70
|
-
}
|
|
78
|
+
export { CellContent };
|
package/src/components/Page.tsx
CHANGED
|
@@ -70,7 +70,7 @@ const Page = (props: PageProps) => {
|
|
|
70
70
|
|
|
71
71
|
return (
|
|
72
72
|
<>
|
|
73
|
-
<View style={[{ flex: 1, position: 'relative', backgroundColor: props.theme?.global.
|
|
73
|
+
<View style={[{ flex: 1, position: 'relative', backgroundColor: props.theme?.global.background }, props.style]}>
|
|
74
74
|
<LDVTopBar
|
|
75
75
|
title={props.backText}
|
|
76
76
|
onBackPress={
|
|
@@ -106,4 +106,4 @@ const Page = (props: PageProps) => {
|
|
|
106
106
|
)
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
export default withTheme(Page)
|
|
109
|
+
export default withTheme(Page) as React.ComponentType<PageProps>
|
|
@@ -13,11 +13,13 @@ interface TextFieldProps extends TextInputProps {
|
|
|
13
13
|
errorText?: string
|
|
14
14
|
tipIcon?: ImageSourcePropType
|
|
15
15
|
tipColor?: string
|
|
16
|
+
editable?: boolean
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const TextField = (props: TextFieldProps) => {
|
|
19
20
|
const icon = props.tipIcon || res.ic_warning_amber
|
|
20
21
|
const color = props.tipColor || props.theme?.global.warning
|
|
22
|
+
const editable = props.editable ?? !props.editable
|
|
21
23
|
|
|
22
24
|
const styles = StyleSheet.create({
|
|
23
25
|
topTip: {
|
|
@@ -69,7 +71,7 @@ const TextField = (props: TextFieldProps) => {
|
|
|
69
71
|
<Text style={[styles.topTip, { opacity: (!!props.value) ? 1 : 0 }]}>{props.placeholder}</Text>
|
|
70
72
|
<View style={styles.textInputGroup}>
|
|
71
73
|
<TextInput{...props} style={styles.textInput} />
|
|
72
|
-
{!!props.value &&
|
|
74
|
+
{!!props.value && editable &&
|
|
73
75
|
<TouchableOpacity
|
|
74
76
|
style={styles.iconTouchable}
|
|
75
77
|
onPress={() => {
|
package/src/hooks/Hooks.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRoute } from '@react-navigation/core'
|
|
1
|
+
import { useRoute, useNavigation } from '@react-navigation/core'
|
|
2
2
|
|
|
3
3
|
export function createParams<T>(params: T): T {
|
|
4
4
|
return { ...params }
|
|
@@ -6,4 +6,10 @@ export function createParams<T>(params: T): T {
|
|
|
6
6
|
|
|
7
7
|
export function useParams<T extends any>(): T {
|
|
8
8
|
return useRoute().params as T
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function useCurrentPage(routeName: string): boolean {
|
|
12
|
+
const navigation = useNavigation()
|
|
13
|
+
const { index, routes} = navigation.getState()
|
|
14
|
+
return routeName === routes[index].name
|
|
15
|
+
}
|