@ledvance/base 1.3.4 → 1.3.6
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/localazy.keys.json +4 -3
- package/package.json +1 -1
- package/src/components/DrawToolView.tsx +136 -132
- package/src/components/FanAdjustView.tsx +22 -20
- package/src/components/Popup.tsx +7 -10
- package/src/components/Segmented.tsx +36 -35
- package/src/components/Stepper.tsx +40 -32
- package/src/components/StripAdjustView.tsx +68 -66
- package/src/components/StripLightView.tsx +6 -2
- package/src/components/Summary.tsx +64 -61
- package/src/components/TextFieldStyleButton.tsx +1 -0
- package/src/components/UATabTitle.tsx +14 -9
- package/src/components/UATabs.tsx +32 -29
- package/src/components/ldvPickerView.tsx +2 -1
- package/src/config/dark-theme.ts +22 -0
- package/src/config/light-theme.ts +22 -0
- package/src/i18n/strings.ts +22056 -22056
package/localazy.keys.json
CHANGED
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import StripLightView from './StripLightView'
|
|
|
15
15
|
import { nativeEventEmitter } from '../api/nativeEventEmitter'
|
|
16
16
|
|
|
17
17
|
const { convertX: cx } = Utils.RatioUtils
|
|
18
|
+
const { withTheme } = Utils.ThemeUtils
|
|
18
19
|
|
|
19
20
|
export type Node = {
|
|
20
21
|
color: string,
|
|
@@ -22,6 +23,7 @@ export type Node = {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
interface DrawToolViewProps extends PropsWithChildren<ViewProps> {
|
|
26
|
+
theme?: any
|
|
25
27
|
title?: string
|
|
26
28
|
switchLed?: boolean
|
|
27
29
|
showEnable?: boolean
|
|
@@ -103,134 +105,157 @@ const DrawToolView = (props: DrawToolViewProps) => {
|
|
|
103
105
|
const s = Math.round(mapFloatToRange(props.s / 100, 30, 100))
|
|
104
106
|
return hsv2Hex(props.h, s, 100)
|
|
105
107
|
}
|
|
106
|
-
return
|
|
108
|
+
return props.theme.card.background
|
|
107
109
|
}, [props.isColorMode, props.h, props.s])
|
|
108
110
|
|
|
109
111
|
const ledNumValidator = (num?: number) => {
|
|
110
112
|
return num && Number.isInteger(num) && num >= 5 && num <= 48;
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
|
|
116
|
+
const styles = StyleSheet.create({
|
|
117
|
+
container: {
|
|
118
|
+
paddingLeft: cx(10),
|
|
119
|
+
flexDirection: 'row',
|
|
120
|
+
alignItems: 'center',
|
|
121
|
+
},
|
|
122
|
+
title: {
|
|
123
|
+
color: props.theme.global.fontColor,
|
|
124
|
+
fontSize: cx(16),
|
|
125
|
+
marginLeft: cx(10),
|
|
126
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
127
|
+
fontWeight: 'bold',
|
|
128
|
+
},
|
|
129
|
+
adjustButtons: {
|
|
130
|
+
width: cx(50),
|
|
131
|
+
},
|
|
132
|
+
adjustButton: {
|
|
133
|
+
width: cx(44),
|
|
134
|
+
height: cx(44),
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
113
138
|
return (
|
|
114
139
|
<Card style={{ marginHorizontal: cx(24) }}>
|
|
115
140
|
<LdvSwitch
|
|
116
141
|
title={props.title || I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
117
|
-
color={
|
|
142
|
+
color={props.theme.card.background}
|
|
118
143
|
colorAlpha={1}
|
|
119
144
|
enable={!!props.switchLed}
|
|
120
145
|
showSwitch={!!props.showEnable}
|
|
121
146
|
setEnable={props.setEnable} />
|
|
122
147
|
{(props.showEnable && props.switchLed || !props.showEnable) && <>
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
<View style={styles.container}>
|
|
149
|
+
<View style={styles.adjustButtons}>
|
|
150
|
+
<TouchableOpacity
|
|
151
|
+
onPress={() => {
|
|
152
|
+
props.setAdjustType(1)
|
|
153
|
+
}}>
|
|
154
|
+
<Image
|
|
155
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 1 ? props.theme.icon.primary : props.theme.icon.normal }]}
|
|
156
|
+
source={res.ic_paint_bucket} />
|
|
157
|
+
</TouchableOpacity>
|
|
158
|
+
{!props.hideDisableLight && <TouchableOpacity
|
|
159
|
+
onPress={() => {
|
|
160
|
+
props.setAdjustType(3)
|
|
161
|
+
}}>
|
|
162
|
+
<Image
|
|
163
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 3 ? props.theme.icon.primary : props.theme.icon.normal }]}
|
|
164
|
+
source={res.ic_disabled_light} />
|
|
165
|
+
</TouchableOpacity>}
|
|
166
|
+
{!props.hideColorize && <TouchableOpacity
|
|
167
|
+
onPress={() => {
|
|
168
|
+
props.setAdjustType(2)
|
|
169
|
+
}}>
|
|
170
|
+
<Image
|
|
171
|
+
style={[styles.adjustButton, { tintColor: props.adjustType === 2 ? props.theme.icon.primary : props.theme.icon.normal }]}
|
|
172
|
+
source={res.ic_colorize} />
|
|
173
|
+
</TouchableOpacity>}
|
|
174
|
+
{!props.hideLedNum && <TouchableOpacity
|
|
175
|
+
onPress={() => {
|
|
176
|
+
state.visible = true
|
|
177
|
+
}}
|
|
178
|
+
style={[styles.adjustButton, {
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
backgroundColor: props.theme.icon.primary,
|
|
182
|
+
borderRadius: cx(5),
|
|
183
|
+
}]}>
|
|
184
|
+
<Text style={{ color: props.theme.global.fontColor, fontSize: cx(18), fontWeight: 'bold' }}>{props.ledNum || 5}</Text>
|
|
185
|
+
</TouchableOpacity>}
|
|
186
|
+
</View>
|
|
187
|
+
<StripLightView
|
|
188
|
+
style={{ height, flex: 1 }}
|
|
189
|
+
nodes={props.nodes}
|
|
190
|
+
fixCount={props.fixCount || 5}
|
|
191
|
+
stripStyle={props.stripStyle || 'WITH_BEAD'}
|
|
192
|
+
touchingMode={props.touchingMode || 'TOUCH'}
|
|
193
|
+
width={state.width}
|
|
194
|
+
onLayout={onLayout} />
|
|
161
195
|
</View>
|
|
162
|
-
<
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
</View>
|
|
171
|
-
<LdvSwitch
|
|
172
|
-
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
173
|
-
color={props.blockColor || getBlockColor()}
|
|
174
|
-
colorAlpha={1}
|
|
175
|
-
enable={false}
|
|
176
|
-
showSwitch={false}
|
|
177
|
-
setEnable={() => {
|
|
178
|
-
}} />
|
|
196
|
+
<LdvSwitch
|
|
197
|
+
title={I18n.getLang('light_sources_tile_tw_lighting_headline')}
|
|
198
|
+
color={props.blockColor || getBlockColor()}
|
|
199
|
+
colorAlpha={1}
|
|
200
|
+
enable={false}
|
|
201
|
+
showSwitch={false}
|
|
202
|
+
setEnable={() => {
|
|
203
|
+
}} />
|
|
179
204
|
{!props.hidLampAdjustView && <LampAdjustView
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
205
|
+
isSupportColor={!!props.isSupportColor}
|
|
206
|
+
isSupportTemperature={!!props.isSupportTemperature}
|
|
207
|
+
isSupportBrightness={!!props.isSupportBrightness}
|
|
208
|
+
isColorMode={!!props.isColorMode}
|
|
209
|
+
reserveSV={true}
|
|
210
|
+
minSaturation={1}
|
|
211
|
+
setIsColorMode={props.setIsColorMode}
|
|
212
|
+
h={props.h} s={props.s} v={props.v}
|
|
213
|
+
onHSVChange={props.onHSVChange}
|
|
214
|
+
onHSVChangeComplete={props.onHSVChangeComplete}
|
|
215
|
+
colorTemp={props.temperature}
|
|
216
|
+
brightness={props.brightness}
|
|
217
|
+
onCCTChange={props.onCCTChange}
|
|
218
|
+
onCCTChangeComplete={props.onCCTChangeComplete}
|
|
219
|
+
onBrightnessChange={props.onBrightnessChange}
|
|
220
|
+
onBrightnessChangeComplete={props.onBrightnessChangeComplete} />}
|
|
196
221
|
{!props.hideLedNum && <Modal
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
222
|
+
visible={state.visible}
|
|
223
|
+
onMaskPress={() => {
|
|
224
|
+
state.visible = false
|
|
225
|
+
}}
|
|
226
|
+
alignContainer="center"
|
|
227
|
+
style={{ width: '100%', height: cx(150) }}>
|
|
228
|
+
<Card
|
|
229
|
+
containerStyle={{ marginHorizontal: cx(16), alignItems: 'center' }}
|
|
230
|
+
style={{ marginHorizontal: cx(16), marginTop: cx(50) }}>
|
|
231
|
+
<Spacer />
|
|
232
|
+
<Text style={{ color: props.theme.global.fontColor, fontSize: cx(14) }}>{I18n.getLang('string_lights_set_bulbs_title')}</Text>
|
|
233
|
+
<Spacer height={cx(10)}/>
|
|
234
|
+
<Text style={{color: props.theme.global.secondFontColor}}>{I18n.getLang('string_lights_set_bulbs_description_text')}</Text>
|
|
235
|
+
<Spacer />
|
|
236
|
+
<Stepper
|
|
237
|
+
min={5}
|
|
238
|
+
max={48}
|
|
239
|
+
isBeyond={true}
|
|
240
|
+
stepValue={1}
|
|
241
|
+
editable={true}
|
|
242
|
+
value={state.ledNum}
|
|
243
|
+
isRealTime={true}
|
|
244
|
+
onValueChange={(v) => {
|
|
245
|
+
state.ledNum = v
|
|
246
|
+
}} />
|
|
247
|
+
<Spacer />
|
|
248
|
+
<DeleteButton
|
|
249
|
+
text={I18n.getLang('auto_scan_system_wifi_confirm')}
|
|
250
|
+
style={{ width: cx(150), height: cx(40), backgroundColor: ledNumValidator(state.ledNum) ? props.theme.button.primary : props.theme.button.disabled }}
|
|
251
|
+
textStyle={{ fontSize: cx(14) }}
|
|
252
|
+
onPress={() => {
|
|
253
|
+
if (!ledNumValidator(state.ledNum)) return
|
|
254
|
+
props.setLedNum(state.ledNum)
|
|
255
|
+
state.visible = false
|
|
256
|
+
}} />
|
|
257
|
+
<Spacer />
|
|
258
|
+
</Card>
|
|
234
259
|
</Modal>}
|
|
235
260
|
{props.children}
|
|
236
261
|
</>}
|
|
@@ -239,26 +264,5 @@ const DrawToolView = (props: DrawToolViewProps) => {
|
|
|
239
264
|
)
|
|
240
265
|
}
|
|
241
266
|
|
|
242
|
-
const styles = StyleSheet.create({
|
|
243
|
-
container: {
|
|
244
|
-
paddingLeft: cx(10),
|
|
245
|
-
flexDirection: 'row',
|
|
246
|
-
alignItems: 'center',
|
|
247
|
-
},
|
|
248
|
-
title: {
|
|
249
|
-
color: '#000',
|
|
250
|
-
fontSize: cx(16),
|
|
251
|
-
marginLeft: cx(10),
|
|
252
|
-
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
253
|
-
fontWeight: 'bold',
|
|
254
|
-
},
|
|
255
|
-
adjustButtons: {
|
|
256
|
-
width: cx(50),
|
|
257
|
-
},
|
|
258
|
-
adjustButton: {
|
|
259
|
-
width: cx(44),
|
|
260
|
-
height: cx(44),
|
|
261
|
-
},
|
|
262
|
-
})
|
|
263
267
|
|
|
264
|
-
export default DrawToolView
|
|
268
|
+
export default withTheme(DrawToolView)
|
|
@@ -11,8 +11,10 @@ import Segmented from './Segmented'
|
|
|
11
11
|
import Popup from './Popup'
|
|
12
12
|
|
|
13
13
|
const {convertX: cx} = Utils.RatioUtils
|
|
14
|
+
const { withTheme } = Utils.ThemeUtils
|
|
14
15
|
|
|
15
16
|
interface FanAdjustViewProps extends ViewProps {
|
|
17
|
+
theme?: any
|
|
16
18
|
hideEnable?: boolean
|
|
17
19
|
fanEnable: boolean
|
|
18
20
|
fanSpeed: number
|
|
@@ -45,11 +47,11 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
|
|
|
45
47
|
return (
|
|
46
48
|
<View>
|
|
47
49
|
{!props.hideEnable && <LdvSwitch
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
title={I18n.getLang('add_new_dynamic_mood_ceiling_fan_field_headline')}
|
|
51
|
+
enable={props.fanEnable}
|
|
52
|
+
setEnable={props.onFanSwitch}
|
|
53
|
+
color={''}
|
|
54
|
+
colorAlpha={1}/>}
|
|
53
55
|
{props.fanEnable && (
|
|
54
56
|
<View>
|
|
55
57
|
<LdvSlider
|
|
@@ -67,7 +69,7 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
|
|
|
67
69
|
<View style={{flexDirection: 'row', marginBottom: cx(2), alignItems: 'center'}}>
|
|
68
70
|
<Text style={{
|
|
69
71
|
marginRight: cx(5),
|
|
70
|
-
color:
|
|
72
|
+
color: props.theme.global.fontColor,
|
|
71
73
|
}}>{I18n.getLang('ceiling_fan_tile_uvc_fan_direction')}</Text>
|
|
72
74
|
<TouchableOpacity onPress={() => Popup({
|
|
73
75
|
title: I18n.getLang('ceiling_fan_direction_info_headline'),
|
|
@@ -75,17 +77,17 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
|
|
|
75
77
|
content: <View>
|
|
76
78
|
<Text style={{
|
|
77
79
|
fontWeight: 'bold',
|
|
78
|
-
color:
|
|
80
|
+
color: props.theme.global.fontColor,
|
|
79
81
|
}}>{I18n.getLang('ceiling_fan_direction_info_description_text')}</Text>
|
|
80
82
|
<Spacer/>
|
|
81
|
-
<Text style={{color:
|
|
82
|
-
<Text style={{color:
|
|
83
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_direction_info_option_1_headline')}</Text>
|
|
84
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_direction_info_option_1_text')}</Text>
|
|
83
85
|
<Spacer/>
|
|
84
|
-
<Text style={{color:
|
|
85
|
-
<Text style={{color:
|
|
86
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_direction_info_option_2_headline')}</Text>
|
|
87
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_direction_info_option_2_text')}</Text>
|
|
86
88
|
</View>,
|
|
87
89
|
})}>
|
|
88
|
-
<Image style={{width: cx(16), height: cx(16), tintColor:
|
|
90
|
+
<Image style={{width: cx(16), height: cx(16), tintColor: props.theme.icon.primary}} source={res.ic_info}/>
|
|
89
91
|
</TouchableOpacity>
|
|
90
92
|
</View>
|
|
91
93
|
<Segmented
|
|
@@ -98,24 +100,24 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
|
|
|
98
100
|
|
|
99
101
|
{props.fanEnable && props.isSupportMode && <View style={{marginHorizontal: cx(16)}}>
|
|
100
102
|
<View style={{flexDirection: 'row', marginBottom: cx(2), alignItems: 'center'}}>
|
|
101
|
-
<Text style={{marginRight: cx(5), color:
|
|
103
|
+
<Text style={{marginRight: cx(5), color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_tile_uvc_fan_mode')}</Text>
|
|
102
104
|
<TouchableOpacity onPress={() => Popup({
|
|
103
105
|
title: I18n.getLang('ceiling_fan_mode_info_headline'),
|
|
104
106
|
confirmText: I18n.getLang('ceiling_fan_direction_info_button_label'),
|
|
105
107
|
content: <View>
|
|
106
108
|
<Text style={{
|
|
107
109
|
fontWeight: 'bold',
|
|
108
|
-
color:
|
|
110
|
+
color: props.theme.global.fontColor,
|
|
109
111
|
}}>{I18n.getLang('ceiling_fan_mode_info_description_text')}</Text>
|
|
110
112
|
<Spacer/>
|
|
111
|
-
<Text style={{color:
|
|
112
|
-
<Text style={{color:
|
|
113
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_mode_info_option_1_headline')}</Text>
|
|
114
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_mode_info_option_1_text')}</Text>
|
|
113
115
|
<Spacer/>
|
|
114
|
-
<Text style={{color:
|
|
115
|
-
<Text style={{color:
|
|
116
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_mode_info_option_2_headline')}</Text>
|
|
117
|
+
<Text style={{color: props.theme.global.fontColor}}>{I18n.getLang('ceiling_fan_mode_info_option_2_text')}</Text>
|
|
116
118
|
</View>,
|
|
117
119
|
})}>
|
|
118
|
-
<Image style={{width: cx(16), height: cx(16), tintColor:
|
|
120
|
+
<Image style={{width: cx(16), height: cx(16), tintColor: props.theme.icon.primary}} source={res.ic_info}/>
|
|
119
121
|
</TouchableOpacity>
|
|
120
122
|
</View>
|
|
121
123
|
<Segmented
|
|
@@ -139,4 +141,4 @@ export function FanAdjustViewContent(props: FanAdjustViewProps) {
|
|
|
139
141
|
)
|
|
140
142
|
}
|
|
141
143
|
|
|
142
|
-
export default FanAdjustView
|
|
144
|
+
export default withTheme(FanAdjustView)
|
package/src/components/Popup.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import {Text, TouchableOpacity, View} from 'react-native'
|
|
|
3
3
|
import {Popup, Utils} from 'tuya-panel-kit'
|
|
4
4
|
|
|
5
5
|
const {convertX: cx, height} = Utils.RatioUtils
|
|
6
|
+
const { withTheme } = Utils.ThemeUtils
|
|
6
7
|
|
|
7
8
|
interface InformationPopupProps {
|
|
8
9
|
title: string
|
|
@@ -11,16 +12,14 @@ interface InformationPopupProps {
|
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
const InformationPopup = (props: InformationPopupProps) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const titleNode = () => {
|
|
15
|
+
const TitleNode = withTheme(({theme}: {theme?: any}) => {
|
|
17
16
|
return (
|
|
18
17
|
<View style={{flexDirection: 'row', height: cx(80), justifyContent: 'space-between'}}>
|
|
19
18
|
<View style={{flexDirection: 'column-reverse', flex: 1, alignItems: 'center', paddingLeft: cx(12)}}>
|
|
20
19
|
<Text style={{
|
|
21
20
|
fontSize: cx(16),
|
|
22
21
|
fontWeight: 'bold',
|
|
23
|
-
color:
|
|
22
|
+
color: theme.global.fontColor,
|
|
24
23
|
paddingBottom: cx(12),
|
|
25
24
|
|
|
26
25
|
}}>{props.title}</Text>
|
|
@@ -37,7 +36,7 @@ const InformationPopup = (props: InformationPopupProps) => {
|
|
|
37
36
|
<Text
|
|
38
37
|
style={{
|
|
39
38
|
fontSize: cx(12),
|
|
40
|
-
color:
|
|
39
|
+
color: theme.button.primary,
|
|
41
40
|
}}
|
|
42
41
|
>
|
|
43
42
|
{props.confirmText}
|
|
@@ -45,13 +44,13 @@ const InformationPopup = (props: InformationPopupProps) => {
|
|
|
45
44
|
</TouchableOpacity>
|
|
46
45
|
</View>
|
|
47
46
|
)
|
|
48
|
-
}
|
|
47
|
+
})
|
|
49
48
|
|
|
50
49
|
Popup.custom({
|
|
51
50
|
content: <View style={{height: height - cx(80), padding: cx(24)}}>
|
|
52
51
|
{props.content}
|
|
53
52
|
</View>,
|
|
54
|
-
title:
|
|
53
|
+
title: <TitleNode />,
|
|
55
54
|
footer: null,
|
|
56
55
|
confirmText: '',
|
|
57
56
|
cancelText: '',
|
|
@@ -65,8 +64,6 @@ const InformationPopup = (props: InformationPopupProps) => {
|
|
|
65
64
|
display: 'none',
|
|
66
65
|
},
|
|
67
66
|
})
|
|
68
|
-
|
|
69
|
-
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
export default InformationPopup
|
|
69
|
+
export default InformationPopup
|
|
@@ -3,6 +3,7 @@ import {StyleSheet, Text, TouchableOpacity, View, ViewStyle} from 'react-native'
|
|
|
3
3
|
import {Utils} from 'tuya-panel-kit'
|
|
4
4
|
|
|
5
5
|
const {convertX: cx} = Utils.RatioUtils
|
|
6
|
+
const { withTheme } = Utils.ThemeUtils
|
|
6
7
|
|
|
7
8
|
interface SegmentedItem {
|
|
8
9
|
label: ReactNode
|
|
@@ -10,6 +11,7 @@ interface SegmentedItem {
|
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
interface SegmentedProps {
|
|
14
|
+
theme?: any
|
|
13
15
|
value?: string | number
|
|
14
16
|
options?: SegmentedItem[]
|
|
15
17
|
onChange?: (v: string | number) => void
|
|
@@ -17,6 +19,39 @@ interface SegmentedProps {
|
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
const Segmented = (props: SegmentedProps) => {
|
|
22
|
+
const styles = StyleSheet.create({
|
|
23
|
+
wrap_container: {
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
height: cx(42),
|
|
26
|
+
backgroundColor: props.theme.segment.background,
|
|
27
|
+
padding: cx(2),
|
|
28
|
+
borderRadius: cx(8),
|
|
29
|
+
},
|
|
30
|
+
segmented_item: {
|
|
31
|
+
flex: 1,
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
justifyContent: 'center',
|
|
34
|
+
backgroundColor: props.theme.container.background,
|
|
35
|
+
},
|
|
36
|
+
segmented_item_first: {
|
|
37
|
+
borderBottomLeftRadius: cx(8),
|
|
38
|
+
borderTopLeftRadius: cx(8),
|
|
39
|
+
},
|
|
40
|
+
segmented_item_last: {
|
|
41
|
+
borderBottomRightRadius: cx(8),
|
|
42
|
+
borderTopRightRadius: cx(8),
|
|
43
|
+
},
|
|
44
|
+
segmented_item_check: {
|
|
45
|
+
backgroundColor: props.theme.button.primary,
|
|
46
|
+
},
|
|
47
|
+
segmented_text: {
|
|
48
|
+
fontSize: cx(16),
|
|
49
|
+
color: props.theme.global.secondFontColor,
|
|
50
|
+
},
|
|
51
|
+
segmented_text_check: {
|
|
52
|
+
color: props.theme.button.fontColor,
|
|
53
|
+
},
|
|
54
|
+
})
|
|
20
55
|
return (
|
|
21
56
|
<View style={[styles.wrap_container, props.style]}>
|
|
22
57
|
{props.options && props.options.map((item, idx) => (
|
|
@@ -40,38 +75,4 @@ const Segmented = (props: SegmentedProps) => {
|
|
|
40
75
|
)
|
|
41
76
|
}
|
|
42
77
|
|
|
43
|
-
export default Segmented
|
|
44
|
-
|
|
45
|
-
const styles = StyleSheet.create({
|
|
46
|
-
wrap_container: {
|
|
47
|
-
flexDirection: 'row',
|
|
48
|
-
height: cx(42),
|
|
49
|
-
backgroundColor: '#f6f6f6',
|
|
50
|
-
padding: cx(2),
|
|
51
|
-
borderRadius: cx(8),
|
|
52
|
-
},
|
|
53
|
-
segmented_item: {
|
|
54
|
-
flex: 1,
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
justifyContent: 'center',
|
|
57
|
-
backgroundColor: '#fff',
|
|
58
|
-
},
|
|
59
|
-
segmented_item_first: {
|
|
60
|
-
borderBottomLeftRadius: cx(8),
|
|
61
|
-
borderTopLeftRadius: cx(8),
|
|
62
|
-
},
|
|
63
|
-
segmented_item_last: {
|
|
64
|
-
borderBottomRightRadius: cx(8),
|
|
65
|
-
borderTopRightRadius: cx(8),
|
|
66
|
-
},
|
|
67
|
-
segmented_item_check: {
|
|
68
|
-
backgroundColor: '#f60',
|
|
69
|
-
},
|
|
70
|
-
segmented_text: {
|
|
71
|
-
fontSize: cx(16),
|
|
72
|
-
color: '#999',
|
|
73
|
-
},
|
|
74
|
-
segmented_text_check: {
|
|
75
|
-
color: '#fff',
|
|
76
|
-
},
|
|
77
|
-
})
|
|
78
|
+
export default withTheme(Segmented)
|