@ledvance/base 1.3.99 → 1.3.100

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.json CHANGED
@@ -1282,7 +1282,8 @@
1282
1282
  "MATCH:contact_sensor_battery",
1283
1283
  "MATCH:siren_settings_antidismantle",
1284
1284
  "MATCH:motion_detection_no_safe_mode_subheadline_text",
1285
- "MATCH:app_navigation_bottom_msg"
1285
+ "MATCH:app_navigation_bottom_msg",
1286
+ "MATCH:internetaccess_timeschedule"
1286
1287
  ],
1287
1288
  "replacements": {
1288
1289
  "REGEX:% %1\\$s.*?\\)%": "{0}",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.3.99",
7
+ "version": "1.3.100",
8
8
  "scripts": {
9
9
  "prepublishOnly": "python update-localazy.py"
10
10
  },
@@ -0,0 +1,49 @@
1
+ import { NativeModules } from 'react-native'
2
+ import { xLog } from '@utils'
3
+ // 从 NativeModules 中解构出 Orientation,如果不存在,它就是 undefined
4
+ const { Orientation } = NativeModules
5
+ /**
6
+ * 检查 react-native-orientation-locker 的原生模块是否已链接
7
+ * @returns {boolean} 如果已链接则返回 true,否则返回 false
8
+ */
9
+ const isSupported = (): boolean => !!Orientation
10
+ /**
11
+ * 锁定屏幕到竖屏。
12
+ * 如果模块未链接,此函数将不执行任何操作。
13
+ */
14
+ const lockToPortrait = (): void => {
15
+ if (isSupported()) {
16
+ Orientation.lockToPortrait()
17
+ } else {
18
+ xLog('[OrientationService] Orientation is not linked. Skipping lockToPortrait.')
19
+ }
20
+ }
21
+ /**
22
+ * 锁定屏幕到横屏。
23
+ * 如果模块未链接,此函数将不执行任何操作。
24
+ */
25
+ const lockToLandscape = (): void => {
26
+ if (isSupported()) {
27
+ Orientation.lockToLandscape()
28
+ } else {
29
+ xLog('[OrientationService] Orientation is not linked. Skipping lockToLandscape.')
30
+ }
31
+ }
32
+ /**
33
+ * 解除屏幕方向锁定。
34
+ * 如果模块未链接,此函数将不执行任何操作。
35
+ */
36
+ const unlockAllOrientations = (): void => {
37
+ if (isSupported()) {
38
+ Orientation.unlockAllOrientations()
39
+ } else {
40
+ xLog('[OrientationService] Orientation is not linked. Skipping unlockAllOrientations.')
41
+ }
42
+ }
43
+ // 导出所有安全的方法
44
+ export const OrientationService = {
45
+ isSupported,
46
+ lockToPortrait,
47
+ lockToLandscape,
48
+ unlockAllOrientations,
49
+ }
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import {StyleSheet, Text, View, ViewProps, ViewStyle} from 'react-native';
3
- import {SwitchButton, Utils} from 'tuya-panel-kit';
2
+ import {StyleSheet, Text, View, ViewProps, ViewStyle, TouchableOpacity, Image} from 'react-native';
3
+ import {Utils} from 'tuya-panel-kit';
4
4
  import Card from './Card';
5
5
  import Spacer from './Spacer';
6
6
  import I18n from '../i18n';
7
7
  import ThemeType from '../config/themeType'
8
+ import res from '../res'
8
9
 
9
10
  const cx = Utils.RatioUtils.convertX;
10
11
  const { withTheme } = Utils.ThemeUtils
@@ -46,6 +47,13 @@ const DiySceneItem = (props: DiySceneItemProps) => {
46
47
  fontFamily: 'helvetica_neue_lt_std_bd',
47
48
  lineHeight: cx(20),
48
49
  },
50
+ checkbox: {
51
+ width: cx(45),
52
+ height: cx(45),
53
+ marginTop: cx(-5),
54
+ marginBottom: cx(-10),
55
+ fontWeight: 'bold',
56
+ },
49
57
  moodTypeItem: {
50
58
  flexDirection: 'row',
51
59
  },
@@ -71,11 +79,9 @@ const DiySceneItem = (props: DiySceneItemProps) => {
71
79
  <Spacer height={cx(16)} />
72
80
  <View style={styles.headline}>
73
81
  <Text style={styles.headText}>{scene.name}</Text>
74
- <SwitchButton
75
- thumbStyle={{ elevation: 0 }}
76
- value={props.enable}
77
- onValueChange={props.onSwitch}
78
- />
82
+ <TouchableOpacity style={styles.checkbox} onPress={() => props.onSwitch(!props.enable)}>
83
+ <Image source={{ uri: res.ic_check}} width={cx(44)} height={cx(44)} style={[styles.checkbox, { tintColor: props.enable ? props.theme?.icon.primary : props.theme?.icon.disable}]} />
84
+ </TouchableOpacity>
79
85
  </View>
80
86
  <Spacer />
81
87
  <Spacer height={cx(12)} />