@ledvance/base 1.3.7 → 1.3.9

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 (45) hide show
  1. package/localazy.json +12 -1
  2. package/package.json +1 -1
  3. package/src/components/AdvanceCard.tsx +4 -3
  4. package/src/components/ApplyForDeviceItem.tsx +6 -5
  5. package/src/components/ApplyForDeviceList.tsx +4 -3
  6. package/src/components/ApplyForText.tsx +4 -3
  7. package/src/components/Card.tsx +4 -3
  8. package/src/components/ColorTempAdjustView.tsx +2 -1
  9. package/src/components/CustomListDialog.tsx +4 -3
  10. package/src/components/DeleteButton.tsx +4 -3
  11. package/src/components/DrawToolView.tsx +13 -12
  12. package/src/components/FanAdjustView.tsx +16 -15
  13. package/src/components/InfoText.tsx +3 -2
  14. package/src/components/Page.tsx +3 -2
  15. package/src/components/Popup.tsx +4 -3
  16. package/src/components/Segmented.tsx +7 -6
  17. package/src/components/SocketItem.tsx +4 -3
  18. package/src/components/Stepper.tsx +6 -5
  19. package/src/components/StripAdjustView.tsx +6 -6
  20. package/src/components/StripLightView.tsx +3 -2
  21. package/src/components/Summary.tsx +7 -6
  22. package/src/components/Tag.tsx +6 -5
  23. package/src/components/TextField.tsx +7 -6
  24. package/src/components/TextFieldStyleButton.tsx +7 -6
  25. package/src/components/UATabTitle.tsx +4 -3
  26. package/src/components/UATabs.tsx +5 -4
  27. package/src/components/ldvColorSlider.tsx +3 -2
  28. package/src/components/ldvPickerView.tsx +5 -4
  29. package/src/components/ldvSlider.tsx +4 -3
  30. package/src/components/ldvSwitch.tsx +4 -4
  31. package/src/components/ldvTopBar.tsx +4 -3
  32. package/src/components/ldvTopName.tsx +4 -3
  33. package/src/components/segmentControl.tsx +7 -7
  34. package/src/components/weekSelect.tsx +3 -3
  35. package/src/config/dark-theme.ts +1 -0
  36. package/src/config/light-theme.ts +2 -1
  37. package/src/i18n/strings.ts +354 -35
  38. package/src/res/arrow_temp_down.png +0 -0
  39. package/src/res/arrow_temp_down@2x.png +0 -0
  40. package/src/res/arrow_temp_down@3x.png +0 -0
  41. package/src/res/arrow_temp_up.png +0 -0
  42. package/src/res/arrow_temp_up@2x.png +0 -0
  43. package/src/res/arrow_temp_up@3x.png +0 -0
  44. package/src/res/index.ts +3 -1
  45. package/translateKey.txt +11 -0
@@ -4,6 +4,7 @@ import { useReactive } from "ahooks";
4
4
  import React, { memo, useCallback } from "react";
5
5
  import { TouchableOpacity, View, Image, TextInput, StyleSheet, StyleProp, ViewStyle } from "react-native";
6
6
  import { Utils } from "tuya-panel-kit";
7
+ import ThemeType from '../config/themeType'
7
8
 
8
9
  const { add, subtract, inMaxMin } = Utils.NumberUtils
9
10
 
@@ -11,7 +12,7 @@ const { convertX: cx } = Utils.RatioUtils
11
12
  const { withTheme } = Utils.ThemeUtils
12
13
 
13
14
  export interface StepperProps {
14
- theme?: any
15
+ theme?: ThemeType
15
16
  value: number | string
16
17
  stepValue?: number // 1
17
18
  min?: number // 0
@@ -77,7 +78,7 @@ const Stepper = (props: StepperProps) => {
77
78
  stepperContainer: {
78
79
  flexDirection: 'row',
79
80
  alignItems: 'center',
80
- backgroundColor: props.theme.container.background,
81
+ backgroundColor: props.theme?.container.background,
81
82
  padding: cx(2),
82
83
  borderRadius: cx(12),
83
84
  width: cx(150),
@@ -85,7 +86,7 @@ const Stepper = (props: StepperProps) => {
85
86
  stepperButton: {
86
87
  width: cx(52),
87
88
  height: cx(28),
88
- backgroundColor: props.theme.global.background,
89
+ backgroundColor: props.theme?.global.background,
89
90
  borderRadius: cx(10),
90
91
  alignItems: 'center',
91
92
  justifyContent: 'center',
@@ -93,12 +94,12 @@ const Stepper = (props: StepperProps) => {
93
94
  stepperIcon: {
94
95
  width: cx(20),
95
96
  height: cx(20),
96
- tintColor: props.theme.global.fontColor
97
+ tintColor: props.theme?.global.fontColor
97
98
  },
98
99
  stepperInput: {
99
100
  width: cx(42),
100
101
  height: cx(22),
101
- color: props.theme.global.secondFontColor,
102
+ color: props.theme?.global.secondFontColor,
102
103
  fontSize: cx(16),
103
104
  padding: 0,
104
105
  alignItems: 'center',
@@ -27,10 +27,10 @@ const StripAdjustView = (props: StripAdjustViewProps) => {
27
27
  <TabBar
28
28
  type='radio'
29
29
  tabs={props.lampTabs}
30
- style={{ borderRadius: cx(8), backgroundColor: props.theme.segment.background, height: cx(40), marginHorizontal: cx(16) }}
31
- tabTextStyle={{ color: props.theme.segment.fontColor }}
32
- tabActiveTextStyle={{ color: props.theme.segment.fontColor, fontWeight: 'bold' }}
33
- activeColor={props.theme.segment.active}
30
+ style={{ borderRadius: cx(8), backgroundColor: props.theme?.segment.background, height: cx(40), marginHorizontal: cx(16) }}
31
+ tabTextStyle={{ color: props.theme?.segment.fontColor }}
32
+ tabActiveTextStyle={{ color: props.theme?.segment.fontColor, fontWeight: 'bold' }}
33
+ activeColor={props.theme?.segment.active}
34
34
  activeKey={props.activeKey}
35
35
  onChange={props.onActiveKeyChange}
36
36
  />
@@ -88,8 +88,8 @@ const StripAdjustView = (props: StripAdjustViewProps) => {
88
88
  radius={cx(20)}
89
89
  colors={item}
90
90
  />
91
- {props.colorDiskActiveKey === index && <View style={{ width: cx(44), height: cx(44), borderRadius: cx(44), borderColor: props.theme.button.primary, borderWidth: cx(2), alignItems: 'center', justifyContent: 'center', position: 'absolute' }}>
92
- <Image source={{ uri: res.ic_check }} style={{ width: cx(40), height: cx(40), tintColor: props.theme.button.fontColor }} />
91
+ {props.colorDiskActiveKey === index && <View style={{ width: cx(44), height: cx(44), borderRadius: cx(44), borderColor: props.theme?.button.primary, borderWidth: cx(2), alignItems: 'center', justifyContent: 'center', position: 'absolute' }}>
92
+ <Image source={{ uri: res.ic_check }} style={{ width: cx(40), height: cx(40), tintColor: props.theme?.button.fontColor }} />
93
93
  </View>}
94
94
  </TouchableOpacity>
95
95
  )
@@ -1,6 +1,7 @@
1
1
  import { requireNativeComponent, ViewProps } from 'react-native'
2
2
  import React from 'react'
3
3
  import { Utils } from 'tuya-panel-kit'
4
+ import ThemeType from '../config/themeType'
4
5
 
5
6
  const { withTheme } = Utils.ThemeUtils
6
7
  const NativeStripLightView = requireNativeComponent('StripLightView')
@@ -11,7 +12,7 @@ export interface LightNode {
11
12
  }
12
13
 
13
14
  export interface StripLightViewProps extends ViewProps {
14
- theme?: any
15
+ theme?: ThemeType
15
16
  nodes: LightNode[]
16
17
  fixCount: number
17
18
  stripStyle: 'ONLY_LINE' | 'WITH_BEAD'
@@ -20,7 +21,7 @@ export interface StripLightViewProps extends ViewProps {
20
21
  }
21
22
 
22
23
  const StripLightView = (props: StripLightViewProps) => {
23
- const newNodes = props.nodes.map(node => ({...node, backgroundColor: props.theme.card.background}))
24
+ const newNodes = props.nodes.map(node => ({...node, backgroundColor: props.theme?.card.background}))
24
25
  return (
25
26
  <NativeStripLightView {...props} nodes={JSON.stringify(newNodes)}/>
26
27
  )
@@ -5,12 +5,13 @@ import I18n from "../i18n";
5
5
  import { Utils } from "tuya-panel-kit";
6
6
  import Spacer from "../components/Spacer";
7
7
  import InfoText from "../components/InfoText";
8
+ import ThemeType from '../config/themeType'
8
9
 
9
10
  const { convertX: cx } = Utils.RatioUtils;
10
11
  const { withTheme } = Utils.ThemeUtils
11
12
 
12
13
  interface SummaryProps {
13
- theme?: any
14
+ theme?: ThemeType
14
15
  style?: ViewStyle
15
16
  frequency?: string | ReactElement
16
17
  time?: string | ReactElement
@@ -25,7 +26,7 @@ const Summary = (props: SummaryProps) => {
25
26
  marginHorizontal: cx(24),
26
27
  },
27
28
  itemTitle: {
28
- color: props.theme.global.fontColor,
29
+ color: props.theme?.global.fontColor,
29
30
  fontSize: cx(16),
30
31
  fontWeight: 'bold',
31
32
  fontFamily: 'helvetica_neue_lt_std_bd',
@@ -41,14 +42,14 @@ const Summary = (props: SummaryProps) => {
41
42
  minWidth: cx(100)
42
43
  },
43
44
  summaryImg: {
44
- tintColor: props.theme.global.fontColor,
45
+ tintColor: props.theme?.global.fontColor,
45
46
  width: cx(12),
46
47
  height: cx(12),
47
48
  marginRight: cx(6)
48
49
  },
49
50
  leftTitle: {
50
51
  fontSize: cx(14),
51
- color: props.theme.global.fontColor
52
+ color: props.theme?.global.fontColor
52
53
  },
53
54
  summaryRight: {
54
55
  flex: 1,
@@ -60,10 +61,10 @@ const Summary = (props: SummaryProps) => {
60
61
  borderRadius: cx(16),
61
62
  paddingHorizontal: cx(12),
62
63
  alignSelf: 'flex-start',
63
- backgroundColor: props.theme.tag.background,
64
+ backgroundColor: props.theme?.tag.background,
64
65
  },
65
66
  rightItem: {
66
- color: props.theme.tag.fontColor,
67
+ color: props.theme?.tag.fontColor,
67
68
  },
68
69
  })
69
70
  return (
@@ -2,12 +2,13 @@ import {Image, StyleSheet, Text, TouchableOpacity, View, ViewProps} from 'react-
2
2
  import React from 'react'
3
3
  import {Utils} from 'tuya-panel-kit'
4
4
  import res from '../res'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  interface TagProps extends ViewProps {
10
- theme?: any
11
+ theme?: ThemeType
11
12
  checked: boolean
12
13
  text: string
13
14
  onCheckedChange: (boolean) => void
@@ -22,12 +23,12 @@ const Tag = (props: TagProps) => {
22
23
  justifyContent: 'center',
23
24
  alignItems: 'center',
24
25
  borderWidth: cx(1),
25
- borderColor: props.theme.global.brand,
26
+ borderColor: props.theme?.global.brand,
26
27
  borderRadius: cx(12),
27
28
  },
28
29
  text: {
29
30
  marginStart: cx(12),
30
- color: props.theme.global.brand,
31
+ color: props.theme?.global.brand,
31
32
  fontSize: cx(14),
32
33
  fontFamily: 'helvetica_neue_lt_std_roman',
33
34
  },
@@ -35,7 +36,7 @@ const Tag = (props: TagProps) => {
35
36
  width: cx(12),
36
37
  height: cx(12),
37
38
  marginEnd: cx(6),
38
- tintColor: props.theme.global.brand,
39
+ tintColor: props.theme?.global.brand,
39
40
  },
40
41
  })
41
42
 
@@ -44,7 +45,7 @@ const Tag = (props: TagProps) => {
44
45
  onPress={() => {
45
46
  props.onCheckedChange(!props.checked)
46
47
  }}>
47
- <View style={[styles.root, props.checked ? {backgroundColor: props.theme.global.thirdBrand} : {}, props.style]}>
48
+ <View style={[styles.root, props.checked ? {backgroundColor: props.theme?.global.thirdBrand} : {}, props.style]}>
48
49
  <Text style={[styles.text, {marginEnd: cx(props.checked ? 4 : 12)}]}>{props.text}</Text>
49
50
  {
50
51
  props.checked &&
@@ -2,12 +2,13 @@ import {Image, StyleSheet, Text, TextInput, TextInputProps, ImageSourcePropType,
2
2
  import React from 'react'
3
3
  import {Utils} from 'tuya-panel-kit'
4
4
  import res from '../res'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  interface TextFieldProps extends TextInputProps {
10
- theme?: any
11
+ theme?: ThemeType
11
12
  showError?: boolean
12
13
  errorText?: string
13
14
  tipIcon?: ImageSourcePropType
@@ -16,20 +17,20 @@ interface TextFieldProps extends TextInputProps {
16
17
 
17
18
  const TextField = (props: TextFieldProps) => {
18
19
  const icon = props.tipIcon || res.ic_warning_amber
19
- const color = props.tipColor || props.theme.global.warning
20
+ const color = props.tipColor || props.theme?.global.warning
20
21
 
21
22
  const styles = StyleSheet.create({
22
23
  topTip: {
23
24
  marginTop: cx(5),
24
25
  fontSize: cx(12),
25
26
  marginStart: cx(13),
26
- color: props.theme.global.secondFontColor,
27
+ color: props.theme?.global.secondFontColor,
27
28
  fontFamily: 'helvetica_neue_lt_std_bd',
28
29
  },
29
30
  textInputGroup: {
30
31
  flexDirection: 'row',
31
32
  borderRadius: cx(4),
32
- backgroundColor: props.theme.textInput.background,
33
+ backgroundColor: props.theme?.textInput.background,
33
34
  alignItems: 'center',
34
35
  },
35
36
  textInput: {
@@ -38,7 +39,7 @@ const TextField = (props: TextFieldProps) => {
38
39
  marginStart: cx(16),
39
40
  marginEnd: cx(6),
40
41
  fontSize: cx(16),
41
- color: props.theme.textInput.fontColor,
42
+ color: props.theme?.textInput.fontColor,
42
43
  fontFamily: 'helvetica_neue_lt_std_roman',
43
44
  },
44
45
  iconTouchable: {
@@ -55,7 +56,7 @@ const TextField = (props: TextFieldProps) => {
55
56
  start: cx(4),
56
57
  end: cx(4),
57
58
  bottom: 0,
58
- backgroundColor: props.theme.textInput.line,
59
+ backgroundColor: props.theme?.textInput.line,
59
60
  },
60
61
  errorContainer: {
61
62
  flexDirection: 'row',
@@ -2,12 +2,13 @@ import {StyleSheet, Text, TouchableOpacity, View, ViewProps, Image} from 'react-
2
2
  import {Utils} from 'tuya-panel-kit'
3
3
  import React from 'react'
4
4
  import res from "../res/index";
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  interface TextFieldStyleButtonProps extends ViewProps {
10
- theme?: any
11
+ theme?: ThemeType
11
12
  placeholder: string
12
13
  text: string
13
14
  onPress: () => void,
@@ -21,13 +22,13 @@ const TextFieldStyleButton = (props: TextFieldStyleButtonProps) => {
21
22
  marginTop: cx(5),
22
23
  fontSize: cx(12),
23
24
  marginStart: cx(13),
24
- color: props.theme.global.secondFontColor,
25
+ color: props.theme?.global.secondFontColor,
25
26
  fontFamily: 'helvetica_neue_lt_std_bd',
26
27
  },
27
28
  textGroup: {
28
29
  flexDirection: 'row',
29
30
  borderRadius: cx(4),
30
- backgroundColor: props.theme.textInput.background,
31
+ backgroundColor: props.theme?.textInput.background,
31
32
  alignItems: 'center',
32
33
  },
33
34
  textParent: {
@@ -39,7 +40,7 @@ const TextFieldStyleButton = (props: TextFieldStyleButtonProps) => {
39
40
  marginStart: cx(16),
40
41
  marginEnd: cx(6),
41
42
  fontSize: cx(16),
42
- color: props.theme.textInput.fontColor,
43
+ color: props.theme?.textInput.fontColor,
43
44
  fontFamily: 'helvetica_neue_lt_std_roman',
44
45
  },
45
46
  line: {
@@ -48,7 +49,7 @@ const TextFieldStyleButton = (props: TextFieldStyleButtonProps) => {
48
49
  start: cx(4),
49
50
  end: cx(4),
50
51
  bottom: 0,
51
- backgroundColor: props.theme.textInput.line,
52
+ backgroundColor: props.theme?.textInput.line,
52
53
  },
53
54
  tipParent: {
54
55
  flexDirection: 'row',
@@ -58,7 +59,7 @@ const TextFieldStyleButton = (props: TextFieldStyleButtonProps) => {
58
59
  width: cx(16),
59
60
  height: cx(16),
60
61
  marginStart: cx(4),
61
- tintColor: props.theme.icon.primary
62
+ tintColor: props.theme?.icon.primary
62
63
  }
63
64
  })
64
65
 
@@ -3,12 +3,13 @@ import Spacer from './Spacer'
3
3
  import React from 'react'
4
4
  import { Utils } from 'tuya-panel-kit'
5
5
  import res from '../res/index'
6
+ import ThemeType from '../config/themeType'
6
7
 
7
8
  const cx = Utils.RatioUtils.convertX
8
9
  const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  export interface UATabTitleProps extends ViewProps {
11
- theme?: any
12
+ theme?: ThemeType
12
13
  text: string
13
14
  onIconClick: () => void
14
15
  }
@@ -16,7 +17,7 @@ export interface UATabTitleProps extends ViewProps {
16
17
  const UATabTitle = (props: UATabTitleProps) => {
17
18
  const styles = StyleSheet.create({
18
19
  tabsTitle: {
19
- color: props.theme.global.fontColor,
20
+ color: props.theme?.global.fontColor,
20
21
  fontSize: cx(14),
21
22
  fontFamily: 'helvetica_neue_lt_std_roman',
22
23
  },
@@ -27,7 +28,7 @@ const UATabTitle = (props: UATabTitleProps) => {
27
28
  <Text style={styles.tabsTitle}>{props.text}</Text>
28
29
  <Spacer height={cx(0)} width={cx(4)}/>
29
30
  <TouchableOpacity onPress={props.onIconClick}>
30
- <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={res.ic_info}/>
31
32
  </TouchableOpacity>
32
33
  </View>
33
34
  )
@@ -1,12 +1,13 @@
1
1
  import React from 'react'
2
2
  import { StyleSheet, Text, TouchableOpacity, View, ViewProps } from 'react-native'
3
3
  import { Utils } from 'tuya-panel-kit'
4
+ import ThemeType from '../config/themeType'
4
5
 
5
6
  const cx = Utils.RatioUtils.convertX
6
7
  const { withTheme } = Utils.ThemeUtils
7
8
 
8
9
  export interface UATabsProps extends ViewProps {
9
- theme?: any
10
+ theme?: ThemeType
10
11
  active: any
11
12
  data: UATabData[]
12
13
  onSelectChange: (value: UATabData, index: number) => void
@@ -25,7 +26,7 @@ const UATabs = (props: UATabsProps) => {
25
26
  height: cx(32),
26
27
  paddingVertical: cx(2),
27
28
  paddingHorizontal: cx(3),
28
- backgroundColor: props.theme.segment.background,
29
+ backgroundColor: props.theme?.segment.background,
29
30
  borderRadius: cx(9),
30
31
  },
31
32
  tabs: {
@@ -61,13 +62,13 @@ const UATabs = (props: UATabsProps) => {
61
62
  <View style={[
62
63
  styles.tab,
63
64
  {
64
- backgroundColor: active ? props.theme.button.primary : props.theme.container.background,
65
+ backgroundColor: active ? props.theme?.button.primary : props.theme?.container.background,
65
66
  },
66
67
  ]}>
67
68
  <Text style={[
68
69
  styles.tabText,
69
70
  {
70
- color: active ? props.theme.button.fontColor : props.theme.global.secondFontColor,
71
+ color: active ? props.theme?.button.fontColor : props.theme?.global.secondFontColor,
71
72
  },
72
73
  ]}>{item.title}</Text>
73
74
  </View>
@@ -2,6 +2,7 @@ import React from 'react'
2
2
  import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
3
3
  import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
4
4
  import {Rect} from 'react-native-svg'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
@@ -28,7 +29,7 @@ const colors = {
28
29
  export const TEMP_KEY = 'temperature'
29
30
 
30
31
  interface LdvColorSliderProps {
31
- theme?: any
32
+ theme?: ThemeType
32
33
  title: string,
33
34
  type: string,
34
35
  onValueChange?: (number) => void | undefined,
@@ -55,7 +56,7 @@ const LdvColorSlider = (props: LdvColorSliderProps) => {
55
56
  title: {
56
57
  marginTop: cx(4),
57
58
  fontSize: cx(14),
58
- color: props.theme.global.fontColor,
59
+ color: props.theme?.global.fontColor,
59
60
  fontFamily: 'helvetica_neue_lt_std_roman',
60
61
  },
61
62
  shadeSlider: {
@@ -2,6 +2,7 @@ import React, { useMemo } from 'react'
2
2
  import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
3
3
  import {Picker, Utils} from 'tuya-panel-kit'
4
4
  import _ from 'lodash'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const {convertX} = Utils.RatioUtils
7
8
  const { withTheme } = Utils.ThemeUtils
@@ -11,7 +12,7 @@ const pickerTheme = {
11
12
  }
12
13
 
13
14
  interface LdvPickerViewProps {
14
- theme?: any
15
+ theme?: ThemeType
15
16
  hour: string,
16
17
  minute: string,
17
18
  setHour: (string) => void,
@@ -35,7 +36,7 @@ const LdvPickerView = (props: LdvPickerViewProps) => {
35
36
  },
36
37
  picker: {
37
38
  flex: 1,
38
- backgroundColor: props.theme.card.background,
39
+ backgroundColor: props.theme?.card.background,
39
40
  },
40
41
  pickerLeft: {},
41
42
  pickerItem: {},
@@ -67,7 +68,7 @@ const LdvPickerView = (props: LdvPickerViewProps) => {
67
68
  ))}
68
69
  </Picker>
69
70
  {unit ? <View style={styles.pickerUnit}>
70
- <Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
71
+ <Text style={{color: props.theme?.global.fontColor, fontSize: convertX(18)}}>
71
72
  {unit[0]}
72
73
  </Text>
73
74
  </View> : null}
@@ -86,7 +87,7 @@ const LdvPickerView = (props: LdvPickerViewProps) => {
86
87
  ))}
87
88
  </Picker>
88
89
  {unit ? <View style={styles.pickerUnit}>
89
- <Text style={{color: props.theme.global.fontColor, fontSize: convertX(18)}}>
90
+ <Text style={{color: props.theme?.global.fontColor, fontSize: convertX(18)}}>
90
91
  {unit[1]}
91
92
  </Text>
92
93
  </View> : null}
@@ -2,12 +2,13 @@ import {useReactive} from 'ahooks'
2
2
  import React, {useEffect} from 'react'
3
3
  import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'
4
4
  import {Slider, Utils} from 'tuya-panel-kit'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  interface LdvSliderProps {
10
- theme?: any
11
+ theme?: ThemeType
11
12
  title: string,
12
13
  value: number,
13
14
  min?: number | undefined,
@@ -44,13 +45,13 @@ const LdvSlider = (props: LdvSliderProps) => {
44
45
  valueText: {
45
46
  marginTop: cx(10),
46
47
  fontSize: cx(14),
47
- color: props.theme.global.fontColor,
48
+ color: props.theme?.global.fontColor,
48
49
  fontFamily: 'helvetica_neue_lt_std_roman',
49
50
  },
50
51
  title: {
51
52
  marginTop: cx(10),
52
53
  fontSize: cx(14),
53
- color: props.theme.global.fontColor,
54
+ color: props.theme?.global.fontColor,
54
55
  fontFamily: 'helvetica_neue_lt_std_roman',
55
56
  },
56
57
  slider: {
@@ -1,13 +1,13 @@
1
1
  import React from 'react'
2
2
  import {StyleSheet, Text, View} from 'react-native'
3
3
  import {SwitchButton, Utils} from 'tuya-panel-kit'
4
- import Spacer from './Spacer'
4
+ import ThemeType from '../config/themeType'
5
5
 
6
6
  const {convertX: cx} = Utils.RatioUtils
7
7
  const { withTheme } = Utils.ThemeUtils
8
8
 
9
9
  interface Prop {
10
- theme?: any
10
+ theme?: ThemeType
11
11
  title: string
12
12
  color: string
13
13
  colorAlpha: number
@@ -23,10 +23,10 @@ const LdvSwitch = (props: Prop) => {
23
23
  <View style={styles.titleBGView}>
24
24
  <View style={{flexDirection: 'column', flex: 1}}>
25
25
  <View style={{flexDirection: 'row', alignItems: 'center'}}>
26
- <Text style={{...styles.title, color: props.theme.global.fontColor}}>{title}</Text>
26
+ <Text style={{...styles.title, color: props.theme?.global.fontColor}}>{title}</Text>
27
27
  <View style={[styles.colorBlock, {backgroundColor: color, opacity: colorAlpha}]}/>
28
28
  </View>
29
- {description && <Text style={{color: props.theme.global.fontColor}}>{description}</Text>}
29
+ {description && <Text style={{color: props.theme?.global.fontColor}}>{description}</Text>}
30
30
  </View>
31
31
  {showSwitch && <SwitchButton value={enable} onValueChange={setEnable}/>}
32
32
  </View>
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
  import {Image, Platform, Text, TouchableOpacity, View} from 'react-native'
3
3
  import {IconFont, Utils} from 'tuya-panel-kit'
4
+ import ThemeType from '../config/themeType'
4
5
 
5
6
  const backIcon = Platform.OS === 'ios' ? 'backIos' : 'backAndroid'
6
7
 
@@ -8,7 +9,7 @@ const cx = Utils.RatioUtils.convertX
8
9
  const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  interface TopBarProps {
11
- theme?: any
12
+ theme?: ThemeType
12
13
  title: string
13
14
  onBackPress: () => void
14
15
  rightButtonIcon?: any | {}
@@ -37,13 +38,13 @@ const LDVTopBar = (props: TopBarProps) => {
37
38
  alignItems: 'center',
38
39
  flex: 1,
39
40
  }}>
40
- <IconFont size={cx(16)} color={props.theme.global.brand} name={backIcon}/>
41
+ <IconFont size={cx(16)} color={props.theme?.global.brand} name={backIcon}/>
41
42
  <View style={{width: cx(10)}}/>
42
43
  <Text
43
44
  numberOfLines={1}
44
45
  style={{
45
46
  maxWidth: cx(290),
46
- color: props.theme.global.brand,
47
+ color: props.theme?.global.brand,
47
48
  fontSize: cx(16),
48
49
  fontFamily: 'helvetica_neue_lt_std_roman',
49
50
  }}>{props.title}</Text>
@@ -2,12 +2,13 @@ import Spacer from '@ledvance/base/src/components/Spacer'
2
2
  import React from 'react'
3
3
  import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
4
4
  import { Utils } from 'tuya-panel-kit'
5
+ import ThemeType from '../config/themeType'
5
6
 
6
7
  const cx = Utils.RatioUtils.convertX
7
8
  const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  interface LdvTopNameProps {
10
- theme?: any
11
+ theme?: ThemeType
11
12
  title?: string,
12
13
  rightIcon?: string | undefined | number,
13
14
  rightIconClick?: () => void
@@ -28,7 +29,7 @@ const LdvTopName = (props: LdvTopNameProps) => {
28
29
  marginBottom: cx(12),
29
30
  },
30
31
  title: {
31
- color: props.theme.global.brand,
32
+ color: props.theme?.global.brand,
32
33
  fontSize: cx(24),
33
34
  },
34
35
  })
@@ -55,7 +56,7 @@ const LdvTopName = (props: LdvTopNameProps) => {
55
56
  {props.rightIcon && <TouchableOpacity
56
57
  onPress={props.rightIconClick}>
57
58
  <Image
58
- style={{ width: cx(24), height: cx(24), tintColor: props.theme.global.brand }}
59
+ style={{ width: cx(24), height: cx(24), tintColor: props.theme?.global.brand }}
59
60
  source={rightIcon} />
60
61
  </TouchableOpacity>}
61
62
  {props.headlineIconContent && props.headlineIconContent}
@@ -11,7 +11,7 @@ const SegmentControl = (props) => {
11
11
 
12
12
  return (<View style={{}}>
13
13
  <View style={[{
14
- backgroundColor: props.theme.segment.background,
14
+ backgroundColor: props.theme?.segment.background,
15
15
  marginHorizontal: convertX(24),
16
16
  marginVertical: convertX(0),
17
17
  borderRadius: convertX(8.9),
@@ -25,12 +25,12 @@ const SegmentControl = (props) => {
25
25
  margin: convertX(2),
26
26
  borderRadius: convertX(6.9),
27
27
  }, isFirst ?
28
- {backgroundColor: props.theme.segment.active, margin: convertX(2), borderRadius: 6.9} :
29
- {backgroundColor: props.theme.segment.background}, tabStyle]
28
+ {backgroundColor: props.theme?.segment.active, margin: convertX(2), borderRadius: 6.9} :
29
+ {backgroundColor: props.theme?.segment.background}, tabStyle]
30
30
  } onPress={() => setIsFirst(true)}>
31
31
  <Text
32
32
  style={{
33
- color: props.theme.segment.fontColor,
33
+ color: props.theme?.segment.fontColor,
34
34
  fontSize: convertX(12),
35
35
  fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
36
36
  marginVertical: convertX(10),
@@ -48,13 +48,13 @@ const SegmentControl = (props) => {
48
48
  borderRadius: convertX(6.9),
49
49
  },
50
50
  !isFirst ?
51
- {backgroundColor: props.theme.segment.active} :
52
- {backgroundColor: props.theme.segment.background}, tabStyle]
51
+ {backgroundColor: props.theme?.segment.active} :
52
+ {backgroundColor: props.theme?.segment.background}, tabStyle]
53
53
  }
54
54
  onPress={() => setIsFirst(false)}>
55
55
  <Text
56
56
  style={{
57
- color: props.theme.segment.fontColor,
57
+ color: props.theme?.segment.fontColor,
58
58
  fontSize: convertX(12),
59
59
  fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
60
60
  marginVertical: convertX(10),
@@ -75,15 +75,15 @@ const WeekSelect = (props) => {
75
75
  justifyContent: 'center',
76
76
  alignItems: 'center',
77
77
  borderRadius: cx(20),
78
- backgroundColor: period.enabled ? props.theme.global.thirdBrand : props.theme.global.background,
78
+ backgroundColor: period.enabled ? props.theme?.global.thirdBrand : props.theme?.global.background,
79
79
  borderWidth: cx(1),
80
80
  // borderColor: period.enabled ? "#fff" : 'rgba(120, 120, 128, 0.2)'
81
- borderColor: props.theme.global.brand,
81
+ borderColor: props.theme?.global.brand,
82
82
  }}>
83
83
 
84
84
  <Text
85
85
  style={{
86
- color: props.theme.global.brand,
86
+ color: props.theme?.global.brand,
87
87
  textAlign: 'center',
88
88
  }}>{period.title}</Text>
89
89
  </View>
@@ -89,6 +89,7 @@ const darkTheme = {
89
89
  footerRadius: 0, // 底部圆角
90
90
  titleBg: "#2a2a2a",
91
91
  bottomBg: "#2a2a2a", // 底部栏底色
92
+ cellFontColor: '#ffffff',
92
93
  lineColor: "#e5e5e5", // 分隔线颜色
93
94
  tintColor: '#ff6600',
94
95
  titleFontSize: 14, // 头部栏标题大小