@ledvance/base 1.3.85 → 1.3.86
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 +29 -1
- package/package.json +1 -1
- package/src/components/BottomTabNavigator.tsx +151 -0
- package/src/i18n/strings.ts +784 -0
- package/src/utils/index.ts +52 -0
- package/translateKey.txt +29 -1
package/localazy.json
CHANGED
|
@@ -1203,7 +1203,35 @@
|
|
|
1203
1203
|
"MATCH:camera_motiondetectiondescription",
|
|
1204
1204
|
"MATCH:wifi_repeater_title",
|
|
1205
1205
|
"MATCH:wifi_repeater_description",
|
|
1206
|
-
"MATCH:wifi_repeater_group_tips"
|
|
1206
|
+
"MATCH:wifi_repeater_group_tips",
|
|
1207
|
+
"MATCH:repeater_ssid",
|
|
1208
|
+
"MATCH:repeater_ssid_required",
|
|
1209
|
+
"MATCH:login_textfield_headline_pw",
|
|
1210
|
+
"MATCH:repeater_ssid_desc",
|
|
1211
|
+
"MATCH:password_required",
|
|
1212
|
+
"MATCH:repeater_change_wifi_tips",
|
|
1213
|
+
"MATCH:repeater_schedule_error_limit",
|
|
1214
|
+
"MATCH:repeater_schedule_error_common",
|
|
1215
|
+
"MATCH:repeater_other_device",
|
|
1216
|
+
"MATCH:internet_access",
|
|
1217
|
+
"MATCH:repeater_no_device",
|
|
1218
|
+
"MATCH:repeater_router_setting",
|
|
1219
|
+
"MATCH:repeater_repeater_setting",
|
|
1220
|
+
"MATCH:show_password",
|
|
1221
|
+
"MATCH:manage_room_headline_devices",
|
|
1222
|
+
"MATCH:repeater_quickly_config",
|
|
1223
|
+
"MATCH:repeater_copy_router_info",
|
|
1224
|
+
"MATCH:repeater_network_2_4g",
|
|
1225
|
+
"MATCH:repeater_applying_title",
|
|
1226
|
+
"MATCH:repeater_applying_content_1",
|
|
1227
|
+
"MATCH:repeater_applying_content_2",
|
|
1228
|
+
"MATCH:repeater_select_router",
|
|
1229
|
+
"MATCH:repeater_current_router",
|
|
1230
|
+
"MATCH:repeater_change_router_tips",
|
|
1231
|
+
"MATCH:repeater_select_other_router",
|
|
1232
|
+
"MATCH:repeater_password_error_length",
|
|
1233
|
+
"MATCH:repeater_password_error_space",
|
|
1234
|
+
"MATCH:cancel_dialog_leave_unsaved_repeater_note"
|
|
1207
1235
|
],
|
|
1208
1236
|
"replacements": {
|
|
1209
1237
|
"REGEX:% %1\\$s.*?\\)%": "{0}",
|
package/package.json
CHANGED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import ThemeType from '../config/themeType'
|
|
2
|
+
import React, { useState, ReactNode } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
View,
|
|
5
|
+
Text,
|
|
6
|
+
TouchableOpacity,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Image,
|
|
9
|
+
ImageSourcePropType,
|
|
10
|
+
} from 'react-native'
|
|
11
|
+
import { Utils } from 'tuya-panel-kit'
|
|
12
|
+
|
|
13
|
+
const cx = Utils.RatioUtils.convertX
|
|
14
|
+
const { withTheme } = Utils.ThemeUtils
|
|
15
|
+
|
|
16
|
+
export interface TabItem {
|
|
17
|
+
key: string
|
|
18
|
+
title: string
|
|
19
|
+
icon?: ImageSourcePropType
|
|
20
|
+
activeIcon?: ImageSourcePropType
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface BottomTabNavigatorProps {
|
|
24
|
+
theme?: ThemeType
|
|
25
|
+
tabs: TabItem[]
|
|
26
|
+
children: ReactNode
|
|
27
|
+
activeTabKey?: string
|
|
28
|
+
onTabChange: (tabKey: string) => void
|
|
29
|
+
backgroundColor?: string
|
|
30
|
+
activeColor?: string
|
|
31
|
+
inactiveColor?: string
|
|
32
|
+
tabBarStyle?: object
|
|
33
|
+
tabItemStyle?: object
|
|
34
|
+
iconSize?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const BottomTabNavigator: React.FC<BottomTabNavigatorProps> = (props: BottomTabNavigatorProps) => {
|
|
38
|
+
const { tabs,
|
|
39
|
+
children,
|
|
40
|
+
activeTabKey,
|
|
41
|
+
onTabChange,
|
|
42
|
+
backgroundColor = props.theme?.tabBar.background,
|
|
43
|
+
activeColor = props.theme?.tabBar.active,
|
|
44
|
+
inactiveColor = props.theme?.tabBar.inactive,
|
|
45
|
+
tabBarStyle,
|
|
46
|
+
tabItemStyle,
|
|
47
|
+
iconSize = cx(45),
|
|
48
|
+
} = props
|
|
49
|
+
const [internalActiveTab, setInternalActiveTab] = useState<string>(
|
|
50
|
+
activeTabKey || tabs[0]?.key || ''
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const currentActiveTab = activeTabKey || internalActiveTab
|
|
54
|
+
|
|
55
|
+
const handleTabPress = (tabKey: string) => {
|
|
56
|
+
if (!activeTabKey) {
|
|
57
|
+
setInternalActiveTab(tabKey)
|
|
58
|
+
}
|
|
59
|
+
onTabChange(tabKey)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const renderTabIcon = (tab: TabItem, isActive: boolean) => {
|
|
63
|
+
if (!tab.icon) return null
|
|
64
|
+
|
|
65
|
+
const iconSource = isActive && tab.activeIcon ? tab.activeIcon : tab.icon
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Image
|
|
69
|
+
source={iconSource}
|
|
70
|
+
style={[
|
|
71
|
+
styles.tabIcon,
|
|
72
|
+
{
|
|
73
|
+
width: iconSize,
|
|
74
|
+
height: iconSize,
|
|
75
|
+
tintColor: isActive ? activeColor : inactiveColor
|
|
76
|
+
}
|
|
77
|
+
]}
|
|
78
|
+
resizeMode="contain"
|
|
79
|
+
/>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const styles = StyleSheet.create({
|
|
84
|
+
container: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
},
|
|
87
|
+
content: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
},
|
|
90
|
+
tabBar: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
borderTopWidth: 1,
|
|
93
|
+
borderTopColor: props.theme?.tabBar.divider,
|
|
94
|
+
paddingBottom: cx(10),
|
|
95
|
+
paddingTop: cx(5),
|
|
96
|
+
},
|
|
97
|
+
tabItem: {
|
|
98
|
+
flex: 1,
|
|
99
|
+
justifyContent: 'flex-end',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
},
|
|
102
|
+
tabIcon: {
|
|
103
|
+
marginBottom: cx(2),
|
|
104
|
+
},
|
|
105
|
+
tabText: {
|
|
106
|
+
fontSize: cx(12),
|
|
107
|
+
textAlign: 'center',
|
|
108
|
+
},
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<View style={styles.container}>
|
|
113
|
+
{/* Main Content */}
|
|
114
|
+
<View style={styles.content}>
|
|
115
|
+
{children}
|
|
116
|
+
</View>
|
|
117
|
+
|
|
118
|
+
{/* Bottom Tab Bar */}
|
|
119
|
+
<View style={[
|
|
120
|
+
styles.tabBar,
|
|
121
|
+
{ backgroundColor },
|
|
122
|
+
tabBarStyle
|
|
123
|
+
]}>
|
|
124
|
+
{tabs.map((tab) => {
|
|
125
|
+
const isActive = currentActiveTab === tab.key
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<TouchableOpacity
|
|
129
|
+
key={tab.key}
|
|
130
|
+
style={[styles.tabItem, tabItemStyle]}
|
|
131
|
+
onPress={() => handleTabPress(tab.key)}
|
|
132
|
+
activeOpacity={0.8}
|
|
133
|
+
>
|
|
134
|
+
{renderTabIcon(tab, isActive)}
|
|
135
|
+
<Text
|
|
136
|
+
style={[
|
|
137
|
+
styles.tabText,
|
|
138
|
+
{ color: isActive ? activeColor : inactiveColor }
|
|
139
|
+
]}
|
|
140
|
+
>
|
|
141
|
+
{tab.title}
|
|
142
|
+
</Text>
|
|
143
|
+
</TouchableOpacity>
|
|
144
|
+
)
|
|
145
|
+
})}
|
|
146
|
+
</View>
|
|
147
|
+
</View>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default withTheme(BottomTabNavigator)
|