@ledvance/base 1.1.13 → 1.1.15
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/.prettierrc.js +0 -0
- package/package.json +1 -1
- package/src/api/native.d.ts +5 -0
- package/src/api/native.ts +193 -160
- package/src/api/nativeEventEmitter.ts +54 -54
- package/src/components/Card.tsx +25 -25
- package/src/components/Cell.tsx +32 -32
- package/src/components/ColorAdjustView.tsx +44 -44
- package/src/components/ColorTempAdjustView.tsx +37 -37
- package/src/components/ColorsLine.d.ts +7 -0
- package/src/components/ColorsLine.tsx +48 -0
- package/src/components/DeleteButton.d.ts +1 -1
- package/src/components/DeleteButton.tsx +27 -27
- package/src/components/Dialog.tsx +28 -28
- package/src/components/FanAdjustView.tsx +115 -105
- package/src/components/InfoText.tsx +29 -29
- package/src/components/LampAdjustView.tsx +52 -52
- package/src/components/LinearGradientLine.tsx +53 -53
- package/src/components/MoodColorsLine.d.ts +9 -0
- package/src/components/MoodColorsLine.tsx +38 -0
- package/src/components/Page.tsx +34 -34
- package/src/components/Popup.tsx +17 -17
- package/src/components/Segmented.d.ts +2 -2
- package/src/components/Segmented.tsx +66 -65
- package/src/components/Spacer.tsx +5 -5
- package/src/components/Tag.tsx +42 -42
- package/src/components/TextButton.d.ts +1 -1
- package/src/components/TextButton.tsx +23 -23
- package/src/components/TextField.tsx +58 -58
- package/src/components/connect.tsx +10 -10
- package/src/components/ldvColorBrightness.tsx +12 -12
- package/src/components/ldvColorSlider.tsx +109 -109
- package/src/components/ldvPickerView.tsx +70 -70
- package/src/components/ldvPresetView.tsx +68 -68
- package/src/components/ldvSaturation.tsx +14 -14
- package/src/components/ldvSlider.d.ts +3 -3
- package/src/components/ldvSlider.tsx +93 -93
- package/src/components/ldvSwitch.tsx +35 -35
- package/src/components/ldvTemperatureSlider.tsx +120 -120
- package/src/components/ldvTopBar.tsx +50 -50
- package/src/components/ldvTopName.tsx +44 -44
- package/src/components/segmentControl.tsx +59 -59
- package/src/components/weekSelect.tsx +76 -76
- package/src/composeLayout.tsx +165 -165
- package/src/i18n/index.ts +12 -12
- package/src/i18n/strings.ts +11004 -11004
- package/src/main.tsx +4 -4
- package/src/models/GlobalParams.ts +7 -7
- package/src/models/TuyaApi.d.ts +3 -3
- package/src/models/TuyaApi.ts +61 -61
- package/src/models/combine.ts +7 -7
- package/src/models/configureStore.ts +14 -14
- package/src/models/index.ts +4 -4
- package/src/models/modules/NativePropsSlice.tsx +170 -169
- package/src/models/modules/Result.ts +8 -8
- package/src/models/modules/common.ts +90 -90
- package/src/res/index.ts +35 -35
- package/src/utils/ColorParser.ts +150 -150
- package/src/utils/ColorUtils.tsx +414 -414
- package/src/utils/Support.d.ts +9 -0
- package/src/utils/Support.ts +85 -0
- package/src/utils/cctUtils.d.ts +1 -0
- package/src/utils/cctUtils.ts +111 -0
- package/src/utils/common.ts +186 -174
- package/src/utils/index.ts +123 -123
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React, {
|
|
3
|
-
import { StyleSheet,
|
|
4
|
-
import {
|
|
1
|
+
import {useReactive} from 'ahooks'
|
|
2
|
+
import React, {useEffect} from 'react'
|
|
3
|
+
import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'
|
|
4
|
+
import {Slider, Utils} from 'tuya-panel-kit'
|
|
5
5
|
|
|
6
|
-
const cx = Utils.RatioUtils.convertX
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
7
|
|
|
8
8
|
interface LdvSliderProps {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
title: string,
|
|
10
|
+
value: number,
|
|
11
|
+
min?: number | undefined,
|
|
12
|
+
max?: number | undefined,
|
|
13
|
+
onValueChange?: (v: number) => void | undefined,
|
|
14
|
+
onSlidingComplete: (v: number) => void,
|
|
15
|
+
style?: StyleProp<ViewStyle> | undefined,
|
|
16
|
+
sliderStyle?: StyleProp<ViewStyle> | undefined
|
|
17
|
+
subTitleStr?: string
|
|
18
|
+
titleStyle?: StyleProp<TextStyle> | undefined
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const LdvSlider = (props: LdvSliderProps) => {
|
|
22
|
-
|
|
22
|
+
const {value, onSlidingComplete, min, max, sliderStyle, subTitleStr, titleStyle, onValueChange} = props
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
24
|
+
const mMax = max || 100
|
|
25
|
+
const mMin = min || 1
|
|
26
|
+
const state = useReactive({
|
|
27
|
+
value: value,
|
|
28
|
+
})
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
state.value = value
|
|
31
|
+
}, [value])
|
|
32
|
+
return (
|
|
33
|
+
<View style={[styles.container, props.style]}>
|
|
34
|
+
<View style={styles.titleBg}>
|
|
35
|
+
<Text style={[styles.title, titleStyle]}>
|
|
36
|
+
{props.title}
|
|
37
|
+
</Text>
|
|
38
|
+
<Text style={styles.valueText}>
|
|
39
|
+
{subTitleStr ? subTitleStr : state.value + '%'}
|
|
40
|
+
</Text>
|
|
41
|
+
</View>
|
|
42
|
+
<Slider.Horizontal
|
|
43
|
+
style={[styles.slider, sliderStyle]}
|
|
44
|
+
styles={{thumb: styles.thumb}}
|
|
45
|
+
maximumValue={mMax}
|
|
46
|
+
minimumValue={mMin}
|
|
47
|
+
value={state.value}
|
|
48
|
+
stepValue={1}
|
|
49
|
+
canTouchTrack={true}
|
|
50
|
+
minimumTrackTintColor={'#666'}
|
|
51
|
+
maximumTrackTintColor={'rgba(120, 120, 128, 0.2)'}
|
|
52
|
+
onValueChange={(value) => {
|
|
53
|
+
state.value = value
|
|
54
|
+
onValueChange && onValueChange(value)
|
|
55
|
+
}}
|
|
56
|
+
onSlidingComplete={onSlidingComplete}
|
|
57
|
+
/>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
61
|
|
|
62
62
|
const styles = StyleSheet.create({
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
container: {
|
|
64
|
+
flexDirection: 'column',
|
|
65
|
+
paddingHorizontal: cx(16),
|
|
66
|
+
},
|
|
67
|
+
titleBg: {
|
|
68
|
+
flexDirection: 'row',
|
|
69
|
+
justifyContent: 'space-between',
|
|
70
|
+
},
|
|
71
|
+
valueText: {
|
|
72
|
+
marginTop: cx(10),
|
|
73
|
+
fontSize: cx(14),
|
|
74
|
+
color: '#000',
|
|
75
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
76
|
+
},
|
|
77
|
+
title: {
|
|
78
|
+
marginTop: cx(10),
|
|
79
|
+
fontSize: cx(14),
|
|
80
|
+
color: '#000',
|
|
81
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
82
|
+
},
|
|
83
|
+
slider: {
|
|
84
|
+
marginTop: cx(8),
|
|
85
|
+
height: cx(28),
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
},
|
|
88
|
+
thumb: {
|
|
89
|
+
backgroundColor: '#fff',
|
|
90
|
+
width: cx(28),
|
|
91
|
+
height: cx(28),
|
|
92
|
+
borderRadius: cx(14),
|
|
93
|
+
shadowColor: '#000000',
|
|
94
|
+
shadowOpacity: 0.2,
|
|
95
|
+
elevation: cx(8),
|
|
96
|
+
shadowRadius: cx(8),
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: 0,
|
|
99
|
+
height: cx(4),
|
|
87
100
|
},
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
width: cx(28),
|
|
91
|
-
height: cx(28),
|
|
92
|
-
borderRadius: cx(14),
|
|
93
|
-
shadowColor: "#000000",
|
|
94
|
-
shadowOpacity: 0.2,
|
|
95
|
-
elevation: cx(8),
|
|
96
|
-
shadowRadius: cx(8),
|
|
97
|
-
shadowOffset: {
|
|
98
|
-
width: 0,
|
|
99
|
-
height: cx(4)
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
});
|
|
101
|
+
},
|
|
102
|
+
})
|
|
103
103
|
|
|
104
|
-
export default LdvSlider
|
|
104
|
+
export default LdvSlider
|
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {StyleSheet, Text, View} from 'react-native'
|
|
3
|
+
import {SwitchButton, Utils} from 'tuya-panel-kit'
|
|
4
4
|
import Spacer from './Spacer'
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
7
7
|
|
|
8
8
|
interface Prop {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
title: string
|
|
10
|
+
color: string
|
|
11
|
+
colorAlpha: number
|
|
12
|
+
enable: boolean
|
|
13
|
+
setEnable: any
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const LdvSwitch = (props: Prop) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
const {title, color, colorAlpha, enable, setEnable} = props
|
|
18
|
+
return (
|
|
19
|
+
<View style={styles.titleBGView}>
|
|
20
|
+
<Text style={styles.title}>{title}</Text>
|
|
21
|
+
<View style={[styles.colorBlock, {backgroundColor: color, opacity: colorAlpha}]}/>
|
|
22
|
+
<Spacer style={{flex: 1}} height={0} width={0}/>
|
|
23
|
+
<SwitchButton value={enable} onValueChange={setEnable}/>
|
|
24
|
+
</View>
|
|
25
|
+
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const styles = StyleSheet.create({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
titleBGView: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
paddingHorizontal: cx(16),
|
|
33
|
+
},
|
|
34
|
+
colorBlock: {
|
|
35
|
+
width: cx(20),
|
|
36
|
+
height: cx(20),
|
|
37
|
+
marginStart: cx(12),
|
|
38
|
+
borderRadius: cx(4),
|
|
39
|
+
},
|
|
40
|
+
title: {
|
|
41
|
+
color: '#000',
|
|
42
|
+
fontSize: cx(16),
|
|
43
|
+
// fontFamily: 'helvetica_neue_lt_std_bd',
|
|
44
|
+
fontWeight: 'bold',
|
|
45
|
+
paddingVertical: cx(16),
|
|
46
|
+
},
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
export default LdvSwitch
|
|
@@ -1,140 +1,140 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import React, {useEffect} from 'react'
|
|
2
|
+
import {StyleProp, StyleSheet, Text, TextProps, View, ViewStyle} from 'react-native'
|
|
3
|
+
import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
|
|
4
|
+
import {Rect} from 'react-native-svg'
|
|
5
|
+
import {useReactive} from 'ahooks'
|
|
6
6
|
|
|
7
7
|
const cx = Utils.RatioUtils.convertX
|
|
8
8
|
|
|
9
9
|
const temperatures = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
'0%': 'rgb(254, 172, 90)',
|
|
11
|
+
'22%': 'rgb(249, 209, 164)',
|
|
12
|
+
'41%': 'rgb(254, 244, 223)',
|
|
13
|
+
'60%': 'rgb(252, 250, 242)',
|
|
14
|
+
'80%': 'rgb(226, 235, 248)',
|
|
15
|
+
'100%': 'rgb(194, 217, 254)',
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface LdvTemperatureSliderProps {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
title: string
|
|
20
|
+
onSlidingComplete: (number) => void
|
|
21
|
+
thumbColor: string
|
|
22
|
+
value: number
|
|
23
|
+
width?: number | undefined
|
|
24
|
+
style?: StyleProp<ViewStyle> | undefined
|
|
25
|
+
titleStyle?: StyleProp<TextProps> | undefined
|
|
26
|
+
subTitleStr?: string | undefined
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
const LdvTemperatureSlider = (props: LdvTemperatureSliderProps) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
const {title, onSlidingComplete, thumbColor, value, titleStyle} = props
|
|
31
|
+
let dataSource = temperatures
|
|
32
|
+
let max = 100
|
|
33
|
+
let min = 0
|
|
34
|
+
const width = props.width || (Utils.RatioUtils.width - cx(80))
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const state = useReactive({
|
|
37
|
+
value: value,
|
|
38
|
+
})
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
state.value = value
|
|
41
|
+
}, [value])
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
return (
|
|
44
|
+
<View style={[styles.container, props.style]}>
|
|
45
|
+
<View style={styles.titleBg}>
|
|
46
|
+
<Text style={[styles.title, titleStyle]}>
|
|
47
|
+
{title}
|
|
48
|
+
</Text>
|
|
49
|
+
</View>
|
|
50
|
+
<Slider.Horizontal
|
|
51
|
+
style={{...styles.shadeSlider, width}}
|
|
52
|
+
styles={{track: styles.sliderTrack, thumb: {...styles.shadeThumb, backgroundColor: thumbColor}}}
|
|
53
|
+
maximumValue={max}
|
|
54
|
+
minimumValue={min}
|
|
55
|
+
value={value}
|
|
56
|
+
stepValue={1}
|
|
57
|
+
canTouchTrack={true}
|
|
58
|
+
theme={{
|
|
59
|
+
trackRadius: cx(15),
|
|
60
|
+
}}
|
|
61
|
+
onlyMaximumTrack={true}
|
|
62
|
+
renderMaximumTrack={() => {
|
|
63
|
+
return (
|
|
64
|
+
<View style={{flex: 1, borderRadius: cx(15)}}>
|
|
65
|
+
<LinearGradient
|
|
66
|
+
style={{...styles.sliderLinearGradient, width}}
|
|
67
|
+
x1="0%"
|
|
68
|
+
y1="0%"
|
|
69
|
+
x2="100%"
|
|
70
|
+
y2="0%"
|
|
71
|
+
stops={dataSource}>
|
|
72
|
+
<Rect {...styles.sliderLinearGradient} width={width}/>
|
|
73
|
+
</LinearGradient>
|
|
49
74
|
</View>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
trackRadius: cx(15),
|
|
60
|
-
}}
|
|
61
|
-
onlyMaximumTrack={true}
|
|
62
|
-
renderMaximumTrack={() => {
|
|
63
|
-
return (
|
|
64
|
-
<View style={{ flex: 1, borderRadius: cx(15) }}>
|
|
65
|
-
<LinearGradient
|
|
66
|
-
style={{ ...styles.sliderLinearGradient, width }}
|
|
67
|
-
x1="0%"
|
|
68
|
-
y1="0%"
|
|
69
|
-
x2="100%"
|
|
70
|
-
y2="0%"
|
|
71
|
-
stops={dataSource}>
|
|
72
|
-
<Rect {...styles.sliderLinearGradient} width={width} />
|
|
73
|
-
</LinearGradient>
|
|
74
|
-
</View>
|
|
75
|
-
)
|
|
76
|
-
}}
|
|
77
|
-
onValueChange={(value) => {
|
|
78
|
-
state.value = value
|
|
79
|
-
}}
|
|
80
|
-
onSlidingComplete={onSlidingComplete}
|
|
81
|
-
/>
|
|
82
|
-
</View>
|
|
83
|
-
)
|
|
75
|
+
)
|
|
76
|
+
}}
|
|
77
|
+
onValueChange={(value) => {
|
|
78
|
+
state.value = value
|
|
79
|
+
}}
|
|
80
|
+
onSlidingComplete={onSlidingComplete}
|
|
81
|
+
/>
|
|
82
|
+
</View>
|
|
83
|
+
)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
const styles = StyleSheet.create({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
sliderLinearGradient: {
|
|
136
|
-
height: cx(12),
|
|
87
|
+
container: {
|
|
88
|
+
height: cx(57),
|
|
89
|
+
flexDirection: 'column',
|
|
90
|
+
paddingHorizontal: cx(16),
|
|
91
|
+
},
|
|
92
|
+
titleBg: {
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
justifyContent: 'space-between',
|
|
95
|
+
},
|
|
96
|
+
valueText: {
|
|
97
|
+
marginTop: cx(10),
|
|
98
|
+
fontSize: cx(14),
|
|
99
|
+
color: '#000',
|
|
100
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
101
|
+
},
|
|
102
|
+
title: {
|
|
103
|
+
marginTop: cx(4),
|
|
104
|
+
fontSize: cx(14),
|
|
105
|
+
color: '#000',
|
|
106
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
107
|
+
},
|
|
108
|
+
shadeSlider: {
|
|
109
|
+
marginTop: cx(8),
|
|
110
|
+
height: cx(28),
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
},
|
|
113
|
+
sliderTrack: {
|
|
114
|
+
marginTop: cx(9),
|
|
115
|
+
marginBottom: cx(9),
|
|
116
|
+
flex: 1,
|
|
117
|
+
borderRadius: cx(15),
|
|
118
|
+
},
|
|
119
|
+
shadeThumb: {
|
|
120
|
+
backgroundColor: 'rgb(0, 249, 255)',
|
|
121
|
+
width: cx(28),
|
|
122
|
+
height: cx(28),
|
|
123
|
+
borderRadius: cx(14),
|
|
124
|
+
borderColor: 'white',
|
|
125
|
+
borderWidth: 1,
|
|
126
|
+
shadowColor: '#000000',
|
|
127
|
+
shadowOpacity: 0.2,
|
|
128
|
+
shadowRadius: cx(8),
|
|
129
|
+
elevation: cx(8),
|
|
130
|
+
shadowOffset: {
|
|
131
|
+
width: 0,
|
|
132
|
+
height: cx(4),
|
|
137
133
|
},
|
|
134
|
+
},
|
|
135
|
+
sliderLinearGradient: {
|
|
136
|
+
height: cx(12),
|
|
137
|
+
},
|
|
138
138
|
})
|
|
139
139
|
|
|
140
140
|
export default LdvTemperatureSlider
|
|
@@ -1,65 +1,65 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {Image, Platform, Text, TouchableOpacity, View} from 'react-native'
|
|
3
|
+
import {IconFont, Utils} from 'tuya-panel-kit'
|
|
4
4
|
|
|
5
5
|
const backIcon = Platform.OS === 'ios' ? 'backIos' : 'backAndroid'
|
|
6
6
|
|
|
7
7
|
const cx = Utils.RatioUtils.convertX
|
|
8
8
|
|
|
9
9
|
interface TopBarProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
title: string,
|
|
11
|
+
onBackPress: () => void,
|
|
12
|
+
rightButtonIcon?: any | {},
|
|
13
|
+
rightButtonStyle?: any | undefined | number,
|
|
14
|
+
onRightButtonPress?: (() => void) | undefined,
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
const LDVTopBar = (props: TopBarProps) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const icon = typeof props.rightButtonIcon === 'number' ? props.rightButtonIcon : {uri: props.rightButtonIcon}
|
|
19
|
+
return (
|
|
20
|
+
<View
|
|
21
|
+
style={{
|
|
22
|
+
flexDirection: 'row',
|
|
23
|
+
height: cx(46),
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
marginTop: Platform.OS === 'ios' ? Utils.RatioUtils.statusBarHeight : 0,
|
|
26
|
+
}}>
|
|
27
|
+
<TouchableOpacity onPress={props.onBackPress}>
|
|
28
|
+
<View style={{flexDirection: 'row', height: cx(46), marginHorizontal: cx(20), alignItems: 'center'}}>
|
|
29
|
+
<IconFont size={cx(16)} color={'#f60'} name={backIcon}/>
|
|
30
|
+
<View style={{width: cx(5)}}/>
|
|
31
|
+
<Text
|
|
21
32
|
style={{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}}>
|
|
27
|
-
<TouchableOpacity onPress={props.onBackPress}>
|
|
28
|
-
<View style={{ flexDirection: 'row', height: cx(46), marginHorizontal: cx(20), alignItems: 'center' }}>
|
|
29
|
-
<IconFont size={cx(16)} color={'#f60'} name={backIcon} />
|
|
30
|
-
<View style={{ width: cx(5) }} />
|
|
31
|
-
<Text
|
|
32
|
-
style={{
|
|
33
|
-
maxWidth: cx(290),
|
|
34
|
-
color: '#f60',
|
|
35
|
-
fontSize: cx(16),
|
|
36
|
-
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
37
|
-
}}>{props.title}</Text>
|
|
38
|
-
</View>
|
|
39
|
-
</TouchableOpacity>
|
|
40
|
-
<View style={{ flex: 1 }} />
|
|
41
|
-
{!!props.rightButtonIcon &&
|
|
42
|
-
<TouchableOpacity
|
|
43
|
-
onPress={props.onRightButtonPress}>
|
|
44
|
-
<View
|
|
45
|
-
style={{
|
|
46
|
-
width: cx(44),
|
|
47
|
-
height: cx(44),
|
|
48
|
-
justifyContent: 'center',
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
}}>
|
|
51
|
-
<Image
|
|
52
|
-
style={[
|
|
53
|
-
{ width: cx(28), height: cx(28) },
|
|
54
|
-
props.rightButtonStyle,
|
|
55
|
-
]}
|
|
56
|
-
source={icon} />
|
|
57
|
-
</View>
|
|
58
|
-
</TouchableOpacity>
|
|
59
|
-
}
|
|
60
|
-
<View style={{ width: cx(12) }} />
|
|
33
|
+
maxWidth: cx(290),
|
|
34
|
+
color: '#f60',
|
|
35
|
+
fontSize: cx(16),
|
|
36
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
37
|
+
}}>{props.title}</Text>
|
|
61
38
|
</View>
|
|
62
|
-
|
|
39
|
+
</TouchableOpacity>
|
|
40
|
+
<View style={{flex: 1}}/>
|
|
41
|
+
{!!props.rightButtonIcon &&
|
|
42
|
+
<TouchableOpacity
|
|
43
|
+
onPress={props.onRightButtonPress}>
|
|
44
|
+
<View
|
|
45
|
+
style={{
|
|
46
|
+
width: cx(44),
|
|
47
|
+
height: cx(44),
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
}}>
|
|
51
|
+
<Image
|
|
52
|
+
style={[
|
|
53
|
+
{width: cx(28), height: cx(28)},
|
|
54
|
+
props.rightButtonStyle,
|
|
55
|
+
]}
|
|
56
|
+
source={icon}/>
|
|
57
|
+
</View>
|
|
58
|
+
</TouchableOpacity>
|
|
59
|
+
}
|
|
60
|
+
<View style={{width: cx(12)}}/>
|
|
61
|
+
</View>
|
|
62
|
+
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export default LDVTopBar
|