@ledvance/base 1.2.83 → 1.2.84

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 (165) hide show
  1. package/.babelrc +31 -31
  2. package/.eslintignore +5 -5
  3. package/.eslintrc.js +27 -27
  4. package/.prettierrc.js +1 -1
  5. package/.versionrc +5 -5
  6. package/localazy.json +848 -848
  7. package/localazy.keys.json +4 -4
  8. package/package.json +74 -74
  9. package/rn-cli.config.js +8 -8
  10. package/src/api/native.d.ts +71 -71
  11. package/src/api/native.ts +423 -423
  12. package/src/api/nativeEventEmitter.d.ts +3 -3
  13. package/src/api/nativeEventEmitter.ts +125 -125
  14. package/src/components/AdvanceCard.d.ts +25 -25
  15. package/src/components/AdvanceCard.tsx +117 -117
  16. package/src/components/AdvanceList.d.ts +9 -9
  17. package/src/components/AdvanceList.tsx +69 -69
  18. package/src/components/ApplyForDeviceItem.d.ts +6 -6
  19. package/src/components/ApplyForDeviceItem.tsx +83 -83
  20. package/src/components/ApplyForDeviceList.d.ts +7 -7
  21. package/src/components/ApplyForDeviceList.tsx +61 -61
  22. package/src/components/ApplyForText.d.ts +6 -6
  23. package/src/components/ApplyForText.tsx +52 -52
  24. package/src/components/Card.d.ts +10 -10
  25. package/src/components/Card.tsx +40 -40
  26. package/src/components/Cell.d.ts +21 -21
  27. package/src/components/Cell.tsx +69 -69
  28. package/src/components/CircularProgress.d.ts +8 -8
  29. package/src/components/CircularProgress.tsx +42 -42
  30. package/src/components/ColorAdjustView.d.ts +12 -12
  31. package/src/components/ColorAdjustView.tsx +64 -64
  32. package/src/components/ColorExtractor.d.ts +73 -73
  33. package/src/components/ColorExtractor.tsx +374 -374
  34. package/src/components/ColorTempAdjustView.d.ts +13 -13
  35. package/src/components/ColorTempAdjustView.tsx +57 -57
  36. package/src/components/ColorsLine.d.ts +7 -7
  37. package/src/components/ColorsLine.tsx +47 -47
  38. package/src/components/CustomListDialog.d.ts +15 -15
  39. package/src/components/CustomListDialog.tsx +66 -66
  40. package/src/components/DeleteButton.d.ts +10 -10
  41. package/src/components/DeleteButton.tsx +40 -40
  42. package/src/components/Dialog.d.ts +10 -10
  43. package/src/components/Dialog.tsx +38 -38
  44. package/src/components/DrawToolView.d.ts +46 -46
  45. package/src/components/DrawToolView.tsx +262 -262
  46. package/src/components/FanAdjustView.d.ts +23 -23
  47. package/src/components/FanAdjustView.tsx +141 -141
  48. package/src/components/InfoText.d.ts +11 -11
  49. package/src/components/InfoText.tsx +45 -45
  50. package/src/components/LampAdjustView.d.ts +10 -10
  51. package/src/components/LampAdjustView.tsx +75 -75
  52. package/src/components/LampAdjustView2.d.ts +24 -24
  53. package/src/components/LampAdjustView2.tsx +104 -104
  54. package/src/components/LinearGradientLine.d.ts +9 -9
  55. package/src/components/LinearGradientLine.tsx +63 -63
  56. package/src/components/LoadingView.tsx +39 -39
  57. package/src/components/MoodColorsLine.d.ts +9 -9
  58. package/src/components/MoodColorsLine.tsx +38 -38
  59. package/src/components/Page.d.ts +21 -21
  60. package/src/components/Page.tsx +104 -104
  61. package/src/components/Popup.d.ts +7 -7
  62. package/src/components/Popup.tsx +71 -71
  63. package/src/components/Segmented.d.ts +14 -14
  64. package/src/components/Segmented.tsx +76 -76
  65. package/src/components/ShowSelect.d.ts +1 -1
  66. package/src/components/ShowSelect.tsx +158 -158
  67. package/src/components/SocketItem.d.ts +13 -13
  68. package/src/components/SocketItem.tsx +87 -87
  69. package/src/components/Spacer.d.ts +7 -7
  70. package/src/components/Spacer.tsx +13 -13
  71. package/src/components/Stepper.d.ts +19 -19
  72. package/src/components/Stepper.tsx +130 -130
  73. package/src/components/StripAdjustView.d.ts +16 -16
  74. package/src/components/StripAdjustView.tsx +129 -129
  75. package/src/components/StripLightView.d.ts +14 -14
  76. package/src/components/StripLightView.tsx +24 -24
  77. package/src/components/Summary.tsx +116 -116
  78. package/src/components/Tag.d.ts +8 -8
  79. package/src/components/Tag.tsx +56 -56
  80. package/src/components/TextButton.d.ts +9 -9
  81. package/src/components/TextButton.tsx +31 -31
  82. package/src/components/TextField.d.ts +9 -9
  83. package/src/components/TextField.tsx +92 -92
  84. package/src/components/TextFieldStyleButton.d.ts +8 -8
  85. package/src/components/TextFieldStyleButton.tsx +85 -85
  86. package/src/components/UATabTitle.d.ts +6 -6
  87. package/src/components/UATabTitle.tsx +31 -31
  88. package/src/components/UATabs.d.ts +12 -12
  89. package/src/components/UATabs.tsx +77 -77
  90. package/src/components/connect.d.ts +10 -10
  91. package/src/components/connect.tsx +20 -20
  92. package/src/components/ldvColorBrightness.d.ts +1 -1
  93. package/src/components/ldvColorBrightness.tsx +18 -18
  94. package/src/components/ldvColorSlider.d.ts +14 -14
  95. package/src/components/ldvColorSlider.tsx +131 -131
  96. package/src/components/ldvItemView.d.ts +12 -12
  97. package/src/components/ldvItemView.tsx +43 -43
  98. package/src/components/ldvPickerView.d.ts +13 -13
  99. package/src/components/ldvPickerView.tsx +97 -97
  100. package/src/components/ldvPresetView.d.ts +2 -2
  101. package/src/components/ldvPresetView.tsx +86 -86
  102. package/src/components/ldvSaturation.d.ts +2 -2
  103. package/src/components/ldvSaturation.tsx +22 -22
  104. package/src/components/ldvSlider.d.ts +15 -15
  105. package/src/components/ldvSlider.tsx +103 -103
  106. package/src/components/ldvSwitch.d.ts +10 -10
  107. package/src/components/ldvSwitch.tsx +52 -52
  108. package/src/components/ldvTemperatureSlider.d.ts +13 -13
  109. package/src/components/ldvTemperatureSlider.tsx +139 -139
  110. package/src/components/ldvTopBar.d.ts +10 -10
  111. package/src/components/ldvTopBar.tsx +76 -76
  112. package/src/components/ldvTopName.d.ts +9 -9
  113. package/src/components/ldvTopName.tsx +63 -63
  114. package/src/components/segmentControl.d.ts +1 -1
  115. package/src/components/segmentControl.tsx +65 -65
  116. package/src/components/weekSelect.d.ts +7 -7
  117. package/src/components/weekSelect.tsx +98 -98
  118. package/src/composeLayout.d.ts +30 -30
  119. package/src/composeLayout.tsx +261 -261
  120. package/src/config/dark-theme.ts +61 -61
  121. package/src/config/light-theme.ts +61 -61
  122. package/src/hooks/Hooks.d.ts +2 -2
  123. package/src/hooks/Hooks.ts +8 -8
  124. package/src/i18n/index.d.ts +16 -16
  125. package/src/i18n/index.ts +37 -37
  126. package/src/i18n/strings.d.ts +15953 -15953
  127. package/src/i18n/strings.ts +23723 -23723
  128. package/src/main.tsx +9 -9
  129. package/src/models/GlobalParams.d.ts +14 -14
  130. package/src/models/GlobalParams.ts +14 -14
  131. package/src/models/TuyaApi.d.ts +29 -29
  132. package/src/models/TuyaApi.ts +92 -92
  133. package/src/models/combine.d.ts +26 -26
  134. package/src/models/combine.ts +17 -17
  135. package/src/models/configureStore.d.ts +9 -9
  136. package/src/models/configureStore.ts +33 -33
  137. package/src/models/index.d.ts +31 -31
  138. package/src/models/index.ts +22 -22
  139. package/src/models/modules/NativePropsSlice.d.ts +61 -61
  140. package/src/models/modules/NativePropsSlice.tsx +467 -467
  141. package/src/models/modules/Result.d.ts +14 -14
  142. package/src/models/modules/Result.ts +15 -15
  143. package/src/models/modules/common.d.ts +44 -44
  144. package/src/models/modules/common.ts +161 -161
  145. package/src/res/index.d.ts +70 -70
  146. package/src/res/index.ts +73 -73
  147. package/src/utils/ColorParser.d.ts +66 -66
  148. package/src/utils/ColorParser.ts +189 -189
  149. package/src/utils/ColorUtils.d.ts +71 -71
  150. package/src/utils/ColorUtils.tsx +448 -448
  151. package/src/utils/Support.d.ts +13 -13
  152. package/src/utils/Support.ts +108 -108
  153. package/src/utils/TypeUtils.d.ts +3 -3
  154. package/src/utils/cctUtils.d.ts +1 -1
  155. package/src/utils/cctUtils.ts +110 -110
  156. package/src/utils/common.d.ts +35 -35
  157. package/src/utils/common.ts +379 -379
  158. package/src/utils/index.d.ts +26 -26
  159. package/src/utils/index.ts +191 -191
  160. package/src/utils/interface.d.ts +6 -6
  161. package/src/utils/interface.ts +50 -50
  162. package/src/utils/loopsCompare.d.ts +1 -1
  163. package/src/utils/loopsCompare.ts +62 -62
  164. package/tsconfig.json +50 -50
  165. package/update-localazy.py +52 -52
@@ -1,116 +1,116 @@
1
- import React, { ReactElement, memo } from "react";
2
- import { Text, ViewStyle, View, StyleSheet } from 'react-native'
3
- import res from "@ledvance/base/src/res"
4
- import I18n from "@ledvance/base/src/i18n";
5
- import { Utils } from "tuya-panel-kit";
6
- import Spacer from "@ledvance/base/src/components/Spacer";
7
- import InfoText from "@ledvance/base/src/components/InfoText";
8
-
9
- const { convertX: cx } = Utils.RatioUtils;
10
-
11
- interface SummaryProps {
12
- style?: ViewStyle
13
- frequency?: string | ReactElement
14
- time?: string | ReactElement
15
- actions?: ReactElement
16
- hideActions?: boolean
17
- }
18
-
19
- const Summary = (props: SummaryProps) => {
20
- return (
21
- <View style={styles.cardContainer}>
22
- <Text style={styles.itemTitle}>{I18n.getLang('add_sleepschedule_one_source_subheadline4_text')}</Text>
23
- <Spacer height={cx(10)} />
24
- <View style={{}}>
25
- <View style={styles.summaryContainer}>
26
- <InfoText
27
- icon={res.summary_icon1}
28
- text={I18n.getLang('feature_summary_frequency_headline')}
29
- iconStyle={styles.summaryImg}
30
- textStyle={styles.leftTitle}
31
- style={styles.summaryLeft}
32
- />
33
- <View style={styles.summaryRight}>
34
- <View style={styles.rightWrap}>
35
- <Text style={styles.rightItem}>{props.frequency}</Text>
36
- </View>
37
- </View>
38
- </View>
39
- <View style={styles.summaryContainer}>
40
- <InfoText
41
- icon={res.summary_icon2}
42
- text={I18n.getLang('feature_summary_time_headline')}
43
- iconStyle={styles.summaryImg}
44
- textStyle={styles.leftTitle}
45
- style={styles.summaryLeft}
46
- />
47
- <View style={styles.summaryRight}>
48
- <View style={styles.rightWrap}>
49
- <Text style={styles.rightItem}>{props.time}</Text>
50
- </View>
51
- </View>
52
- </View>
53
- {!props.hideActions && <View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
54
- <InfoText
55
- icon={res.summary_icon3}
56
- text={I18n.getLang('motion_detection_add_time_schedule_actions_text1')}
57
- iconStyle={styles.summaryImg}
58
- textStyle={styles.leftTitle}
59
- style={styles.summaryLeft}
60
- />
61
- <View style={styles.summaryRight}>
62
- {props.actions}
63
- </View>
64
- </View>}
65
- </View>
66
- </View>
67
- )
68
- }
69
-
70
- const styles = StyleSheet.create({
71
- cardContainer: {
72
- marginHorizontal: cx(24),
73
- },
74
- itemTitle: {
75
- color: '#000',
76
- fontSize: cx(16),
77
- fontWeight: 'bold',
78
- fontFamily: 'helvetica_neue_lt_std_bd',
79
- },
80
- summaryContainer: {
81
- flex: 1,
82
- flexDirection: 'row',
83
- marginBottom: cx(10),
84
- },
85
- summaryLeft: {
86
- flexDirection: 'row',
87
- alignItems: 'center',
88
- minWidth: cx(100)
89
- },
90
- summaryImg: {
91
- width: cx(12),
92
- height: cx(12),
93
- marginRight: cx(6)
94
- },
95
- leftTitle: {
96
- fontSize: cx(14),
97
- color: '#000'
98
- },
99
- summaryRight: {
100
- flex: 1,
101
- flexDirection: 'column',
102
- marginLeft: cx(15),
103
- marginTop: cx(5)
104
- },
105
- rightWrap: {
106
- borderRadius: cx(16),
107
- paddingHorizontal: cx(12),
108
- alignSelf: 'flex-start',
109
- backgroundColor: '#cbcbcb',
110
- },
111
- rightItem: {
112
- color: '#000',
113
- },
114
- })
115
-
116
- export default memo(Summary)
1
+ import React, { ReactElement, memo } from "react";
2
+ import { Text, ViewStyle, View, StyleSheet } from 'react-native'
3
+ import res from "@ledvance/base/src/res"
4
+ import I18n from "@ledvance/base/src/i18n";
5
+ import { Utils } from "tuya-panel-kit";
6
+ import Spacer from "@ledvance/base/src/components/Spacer";
7
+ import InfoText from "@ledvance/base/src/components/InfoText";
8
+
9
+ const { convertX: cx } = Utils.RatioUtils;
10
+
11
+ interface SummaryProps {
12
+ style?: ViewStyle
13
+ frequency?: string | ReactElement
14
+ time?: string | ReactElement
15
+ actions?: ReactElement
16
+ hideActions?: boolean
17
+ }
18
+
19
+ const Summary = (props: SummaryProps) => {
20
+ return (
21
+ <View style={styles.cardContainer}>
22
+ <Text style={styles.itemTitle}>{I18n.getLang('add_sleepschedule_one_source_subheadline4_text')}</Text>
23
+ <Spacer height={cx(10)} />
24
+ <View style={{}}>
25
+ <View style={styles.summaryContainer}>
26
+ <InfoText
27
+ icon={res.summary_icon1}
28
+ text={I18n.getLang('feature_summary_frequency_headline')}
29
+ iconStyle={styles.summaryImg}
30
+ textStyle={styles.leftTitle}
31
+ style={styles.summaryLeft}
32
+ />
33
+ <View style={styles.summaryRight}>
34
+ <View style={styles.rightWrap}>
35
+ <Text style={styles.rightItem}>{props.frequency}</Text>
36
+ </View>
37
+ </View>
38
+ </View>
39
+ <View style={styles.summaryContainer}>
40
+ <InfoText
41
+ icon={res.summary_icon2}
42
+ text={I18n.getLang('feature_summary_time_headline')}
43
+ iconStyle={styles.summaryImg}
44
+ textStyle={styles.leftTitle}
45
+ style={styles.summaryLeft}
46
+ />
47
+ <View style={styles.summaryRight}>
48
+ <View style={styles.rightWrap}>
49
+ <Text style={styles.rightItem}>{props.time}</Text>
50
+ </View>
51
+ </View>
52
+ </View>
53
+ {!props.hideActions && <View style={[styles.summaryContainer, { alignItems: 'flex-start' }]}>
54
+ <InfoText
55
+ icon={res.summary_icon3}
56
+ text={I18n.getLang('motion_detection_add_time_schedule_actions_text1')}
57
+ iconStyle={styles.summaryImg}
58
+ textStyle={styles.leftTitle}
59
+ style={styles.summaryLeft}
60
+ />
61
+ <View style={styles.summaryRight}>
62
+ {props.actions}
63
+ </View>
64
+ </View>}
65
+ </View>
66
+ </View>
67
+ )
68
+ }
69
+
70
+ const styles = StyleSheet.create({
71
+ cardContainer: {
72
+ marginHorizontal: cx(24),
73
+ },
74
+ itemTitle: {
75
+ color: '#000',
76
+ fontSize: cx(16),
77
+ fontWeight: 'bold',
78
+ fontFamily: 'helvetica_neue_lt_std_bd',
79
+ },
80
+ summaryContainer: {
81
+ flex: 1,
82
+ flexDirection: 'row',
83
+ marginBottom: cx(10),
84
+ },
85
+ summaryLeft: {
86
+ flexDirection: 'row',
87
+ alignItems: 'center',
88
+ minWidth: cx(100)
89
+ },
90
+ summaryImg: {
91
+ width: cx(12),
92
+ height: cx(12),
93
+ marginRight: cx(6)
94
+ },
95
+ leftTitle: {
96
+ fontSize: cx(14),
97
+ color: '#000'
98
+ },
99
+ summaryRight: {
100
+ flex: 1,
101
+ flexDirection: 'column',
102
+ marginLeft: cx(15),
103
+ marginTop: cx(5)
104
+ },
105
+ rightWrap: {
106
+ borderRadius: cx(16),
107
+ paddingHorizontal: cx(12),
108
+ alignSelf: 'flex-start',
109
+ backgroundColor: '#cbcbcb',
110
+ },
111
+ rightItem: {
112
+ color: '#000',
113
+ },
114
+ })
115
+
116
+ export default memo(Summary)
@@ -1,8 +1,8 @@
1
- import { ViewProps } from 'react-native';
2
- interface TagProps extends ViewProps {
3
- checked: boolean;
4
- text: string;
5
- onCheckedChange: (boolean: any) => void;
6
- }
7
- declare const Tag: (props: TagProps) => JSX.Element;
8
- export default Tag;
1
+ import { ViewProps } from 'react-native';
2
+ interface TagProps extends ViewProps {
3
+ checked: boolean;
4
+ text: string;
5
+ onCheckedChange: (boolean: any) => void;
6
+ }
7
+ declare const Tag: (props: TagProps) => JSX.Element;
8
+ export default Tag;
@@ -1,57 +1,57 @@
1
- import {Image, StyleSheet, Text, TouchableOpacity, View, ViewProps} from 'react-native'
2
- import React from 'react'
3
- import {Utils} from 'tuya-panel-kit'
4
- import res from '../res'
5
-
6
- const cx = Utils.RatioUtils.convertX
7
-
8
- interface TagProps extends ViewProps {
9
- checked: boolean
10
- text: string
11
- onCheckedChange: (boolean) => void
12
- }
13
-
14
- const Tag = (props: TagProps) => {
15
- return (
16
- <TouchableOpacity
17
- onPress={() => {
18
- props.onCheckedChange(!props.checked)
19
- }}>
20
- <View style={[styles.root, props.checked ? {backgroundColor: '#ffe0d4'} : {}, props.style]}>
21
- <Text style={[styles.text, {marginEnd: cx(props.checked ? 4 : 12)}]}>{props.text}</Text>
22
- {
23
- props.checked &&
24
- <Image
25
- source={res.ic_arrows_nav_clear}
26
- style={styles.icon}/>
27
- }
28
- </View>
29
- </TouchableOpacity>
30
- )
31
- }
32
-
33
- const styles = StyleSheet.create({
34
- root: {
35
- height: cx(24),
36
- flexDirection: 'row',
37
- justifyContent: 'center',
38
- alignItems: 'center',
39
- borderWidth: cx(1),
40
- borderColor: '#ff6600',
41
- borderRadius: cx(12),
42
- },
43
- text: {
44
- marginStart: cx(12),
45
- color: '#ff6600',
46
- fontSize: cx(14),
47
- fontFamily: 'helvetica_neue_lt_std_roman',
48
- },
49
- icon: {
50
- width: cx(12),
51
- height: cx(12),
52
- marginEnd: cx(6),
53
- tintColor: '#F60',
54
- },
55
- })
56
-
1
+ import {Image, StyleSheet, Text, TouchableOpacity, View, ViewProps} from 'react-native'
2
+ import React from 'react'
3
+ import {Utils} from 'tuya-panel-kit'
4
+ import res from '../res'
5
+
6
+ const cx = Utils.RatioUtils.convertX
7
+
8
+ interface TagProps extends ViewProps {
9
+ checked: boolean
10
+ text: string
11
+ onCheckedChange: (boolean) => void
12
+ }
13
+
14
+ const Tag = (props: TagProps) => {
15
+ return (
16
+ <TouchableOpacity
17
+ onPress={() => {
18
+ props.onCheckedChange(!props.checked)
19
+ }}>
20
+ <View style={[styles.root, props.checked ? {backgroundColor: '#ffe0d4'} : {}, props.style]}>
21
+ <Text style={[styles.text, {marginEnd: cx(props.checked ? 4 : 12)}]}>{props.text}</Text>
22
+ {
23
+ props.checked &&
24
+ <Image
25
+ source={res.ic_arrows_nav_clear}
26
+ style={styles.icon}/>
27
+ }
28
+ </View>
29
+ </TouchableOpacity>
30
+ )
31
+ }
32
+
33
+ const styles = StyleSheet.create({
34
+ root: {
35
+ height: cx(24),
36
+ flexDirection: 'row',
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ borderWidth: cx(1),
40
+ borderColor: '#ff6600',
41
+ borderRadius: cx(12),
42
+ },
43
+ text: {
44
+ marginStart: cx(12),
45
+ color: '#ff6600',
46
+ fontSize: cx(14),
47
+ fontFamily: 'helvetica_neue_lt_std_roman',
48
+ },
49
+ icon: {
50
+ width: cx(12),
51
+ height: cx(12),
52
+ marginEnd: cx(6),
53
+ tintColor: '#F60',
54
+ },
55
+ })
56
+
57
57
  export default Tag
@@ -1,9 +1,9 @@
1
- import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
- interface TextButtonProps {
3
- text: string;
4
- onPress: () => void;
5
- style?: StyleProp<ViewStyle>;
6
- textStyle?: StyleProp<TextStyle>;
7
- }
8
- export default function TextButton(props: TextButtonProps): JSX.Element;
9
- export {};
1
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
2
+ interface TextButtonProps {
3
+ text: string;
4
+ onPress: () => void;
5
+ style?: StyleProp<ViewStyle>;
6
+ textStyle?: StyleProp<TextStyle>;
7
+ }
8
+ export default function TextButton(props: TextButtonProps): JSX.Element;
9
+ export {};
@@ -1,32 +1,32 @@
1
- import {StyleProp, Text, TextStyle, TouchableOpacity, ViewStyle} from 'react-native'
2
- import React from 'react'
3
- import {Utils} from 'tuya-panel-kit'
4
-
5
- const cx = Utils.RatioUtils.convertX
6
-
7
- interface TextButtonProps {
8
- text: string,
9
- onPress: () => void,
10
- style?: StyleProp<ViewStyle>
11
- textStyle?: StyleProp<TextStyle>
12
- }
13
-
14
- export default function TextButton(props: TextButtonProps) {
15
- return (
16
- <TouchableOpacity
17
- style={[{
18
- justifyContent: 'center',
19
- alignItems: 'center',
20
- alignSelf: 'center',
21
- paddingVertical: cx(8),
22
- paddingHorizontal: cx(12),
23
- }, props.style]}
24
- onPress={props.onPress}>
25
- <Text style={[{
26
- color: '#f60',
27
- fontSize: cx(14),
28
- fontFamily: 'helvetica_neue_lt_std_roman',
29
- }, props.textStyle]}>{props.text}</Text>
30
- </TouchableOpacity>
31
- )
1
+ import {StyleProp, Text, TextStyle, TouchableOpacity, ViewStyle} from 'react-native'
2
+ import React from 'react'
3
+ import {Utils} from 'tuya-panel-kit'
4
+
5
+ const cx = Utils.RatioUtils.convertX
6
+
7
+ interface TextButtonProps {
8
+ text: string,
9
+ onPress: () => void,
10
+ style?: StyleProp<ViewStyle>
11
+ textStyle?: StyleProp<TextStyle>
12
+ }
13
+
14
+ export default function TextButton(props: TextButtonProps) {
15
+ return (
16
+ <TouchableOpacity
17
+ style={[{
18
+ justifyContent: 'center',
19
+ alignItems: 'center',
20
+ alignSelf: 'center',
21
+ paddingVertical: cx(8),
22
+ paddingHorizontal: cx(12),
23
+ }, props.style]}
24
+ onPress={props.onPress}>
25
+ <Text style={[{
26
+ color: '#f60',
27
+ fontSize: cx(14),
28
+ fontFamily: 'helvetica_neue_lt_std_roman',
29
+ }, props.textStyle]}>{props.text}</Text>
30
+ </TouchableOpacity>
31
+ )
32
32
  }
@@ -1,9 +1,9 @@
1
- import { TextInputProps, ImageSourcePropType } from 'react-native';
2
- interface TextFieldProps extends TextInputProps {
3
- showError?: boolean;
4
- errorText?: string;
5
- tipIcon?: ImageSourcePropType;
6
- tipColor?: string;
7
- }
8
- declare const TextField: (props: TextFieldProps) => JSX.Element;
9
- export default TextField;
1
+ import { TextInputProps, ImageSourcePropType } from 'react-native';
2
+ interface TextFieldProps extends TextInputProps {
3
+ showError?: boolean;
4
+ errorText?: string;
5
+ tipIcon?: ImageSourcePropType;
6
+ tipColor?: string;
7
+ }
8
+ declare const TextField: (props: TextFieldProps) => JSX.Element;
9
+ export default TextField;
@@ -1,92 +1,92 @@
1
- import {Image, StyleSheet, Text, TextInput, TextInputProps, ImageSourcePropType,TouchableOpacity, View} from 'react-native'
2
- import React from 'react'
3
- import {Utils} from 'tuya-panel-kit'
4
- import res from '../res'
5
-
6
- const cx = Utils.RatioUtils.convertX
7
- const { withTheme } = Utils.ThemeUtils
8
-
9
- interface TextFieldProps extends TextInputProps {
10
- theme?: any
11
- showError?: boolean
12
- errorText?: string
13
- tipIcon?: ImageSourcePropType
14
- tipColor?: string
15
- }
16
-
17
- const TextField = (props: TextFieldProps) => {
18
- const icon = props.tipIcon || res.ic_warning_amber
19
- const color = props.tipColor || props.theme.global.warning
20
-
21
- const styles = StyleSheet.create({
22
- topTip: {
23
- marginTop: cx(5),
24
- fontSize: cx(12),
25
- marginStart: cx(13),
26
- color: props.theme.global.secondFontColor,
27
- fontFamily: 'helvetica_neue_lt_std_bd',
28
- },
29
- textInputGroup: {
30
- flexDirection: 'row',
31
- borderRadius: cx(4),
32
- backgroundColor: props.theme.textInput.background,
33
- alignItems: 'center',
34
- },
35
- textInput: {
36
- flex: 1,
37
- height: cx(44),
38
- marginStart: cx(16),
39
- marginEnd: cx(6),
40
- fontSize: cx(16),
41
- color: props.theme.textInput.fontColor,
42
- fontFamily: 'helvetica_neue_lt_std_roman',
43
- },
44
- iconTouchable: {
45
- marginEnd: cx(18),
46
- padding: cx(4),
47
- },
48
- icon: {
49
- width: cx(16),
50
- height: cx(16),
51
- },
52
- line: {
53
- height: 1,
54
- position: 'absolute',
55
- start: cx(4),
56
- end: cx(4),
57
- bottom: 0,
58
- backgroundColor: props.theme.textInput.line,
59
- },
60
- errorContainer: {
61
- flexDirection: 'row',
62
- alignItems: 'center',
63
- marginStart: cx(13),
64
- },
65
- })
66
- return (
67
- <View style={props.style}>
68
- <Text style={[styles.topTip, { opacity: (!!props.value) ? 1 : 0 }]}>{props.placeholder}</Text>
69
- <View style={styles.textInputGroup}>
70
- <TextInput{...props} style={styles.textInput} />
71
- {!!props.value &&
72
- <TouchableOpacity
73
- style={styles.iconTouchable}
74
- onPress={() => {
75
- props.onChangeText && props.onChangeText('')
76
- }}>
77
- <Image source={{ uri: res.ic_cancel }} style={styles.icon} />
78
- </TouchableOpacity>
79
- }
80
- <View style={styles.line} />
81
- </View>
82
- <View style={[styles.errorContainer, { opacity: !!(props.showError) ? 1 : 0 }]}>
83
- <Image source={icon} style={[styles.icon, { tintColor: color }]} />
84
- <Text
85
- style={{ marginLeft: cx(5), color: color }}
86
- >{props.errorText}</Text>
87
- </View>
88
- </View>
89
- )
90
- }
91
-
92
- export default withTheme(TextField)
1
+ import {Image, StyleSheet, Text, TextInput, TextInputProps, ImageSourcePropType,TouchableOpacity, View} from 'react-native'
2
+ import React from 'react'
3
+ import {Utils} from 'tuya-panel-kit'
4
+ import res from '../res'
5
+
6
+ const cx = Utils.RatioUtils.convertX
7
+ const { withTheme } = Utils.ThemeUtils
8
+
9
+ interface TextFieldProps extends TextInputProps {
10
+ theme?: any
11
+ showError?: boolean
12
+ errorText?: string
13
+ tipIcon?: ImageSourcePropType
14
+ tipColor?: string
15
+ }
16
+
17
+ const TextField = (props: TextFieldProps) => {
18
+ const icon = props.tipIcon || res.ic_warning_amber
19
+ const color = props.tipColor || props.theme.global.warning
20
+
21
+ const styles = StyleSheet.create({
22
+ topTip: {
23
+ marginTop: cx(5),
24
+ fontSize: cx(12),
25
+ marginStart: cx(13),
26
+ color: props.theme.global.secondFontColor,
27
+ fontFamily: 'helvetica_neue_lt_std_bd',
28
+ },
29
+ textInputGroup: {
30
+ flexDirection: 'row',
31
+ borderRadius: cx(4),
32
+ backgroundColor: props.theme.textInput.background,
33
+ alignItems: 'center',
34
+ },
35
+ textInput: {
36
+ flex: 1,
37
+ height: cx(44),
38
+ marginStart: cx(16),
39
+ marginEnd: cx(6),
40
+ fontSize: cx(16),
41
+ color: props.theme.textInput.fontColor,
42
+ fontFamily: 'helvetica_neue_lt_std_roman',
43
+ },
44
+ iconTouchable: {
45
+ marginEnd: cx(18),
46
+ padding: cx(4),
47
+ },
48
+ icon: {
49
+ width: cx(16),
50
+ height: cx(16),
51
+ },
52
+ line: {
53
+ height: 1,
54
+ position: 'absolute',
55
+ start: cx(4),
56
+ end: cx(4),
57
+ bottom: 0,
58
+ backgroundColor: props.theme.textInput.line,
59
+ },
60
+ errorContainer: {
61
+ flexDirection: 'row',
62
+ alignItems: 'center',
63
+ marginStart: cx(13),
64
+ },
65
+ })
66
+ return (
67
+ <View style={props.style}>
68
+ <Text style={[styles.topTip, { opacity: (!!props.value) ? 1 : 0 }]}>{props.placeholder}</Text>
69
+ <View style={styles.textInputGroup}>
70
+ <TextInput{...props} style={styles.textInput} />
71
+ {!!props.value &&
72
+ <TouchableOpacity
73
+ style={styles.iconTouchable}
74
+ onPress={() => {
75
+ props.onChangeText && props.onChangeText('')
76
+ }}>
77
+ <Image source={{ uri: res.ic_cancel }} style={styles.icon} />
78
+ </TouchableOpacity>
79
+ }
80
+ <View style={styles.line} />
81
+ </View>
82
+ <View style={[styles.errorContainer, { opacity: !!(props.showError) ? 1 : 0 }]}>
83
+ <Image source={icon} style={[styles.icon, { tintColor: color }]} />
84
+ <Text
85
+ style={{ marginLeft: cx(5), color: color }}
86
+ >{props.errorText}</Text>
87
+ </View>
88
+ </View>
89
+ )
90
+ }
91
+
92
+ export default withTheme(TextField)
@@ -1,8 +1,8 @@
1
- import { ViewProps } from 'react-native';
2
- interface TextFieldStyleButtonProps extends ViewProps {
3
- placeholder: string;
4
- text: string;
5
- onPress: () => void;
6
- }
7
- declare const TextFieldStyleButton: (props: TextFieldStyleButtonProps) => JSX.Element;
8
- export default TextFieldStyleButton;
1
+ import { ViewProps } from 'react-native';
2
+ interface TextFieldStyleButtonProps extends ViewProps {
3
+ placeholder: string;
4
+ text: string;
5
+ onPress: () => void;
6
+ }
7
+ declare const TextFieldStyleButton: (props: TextFieldStyleButtonProps) => JSX.Element;
8
+ export default TextFieldStyleButton;