@xaui/native 0.2.7 → 0.9.1-alpha.0
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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -356
- package/dist/alert/index.d.cts +0 -90
- package/dist/alert/index.d.ts +0 -90
- package/dist/alert/index.js +0 -356
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle, Insets, TextStyle, GestureResponderEvent } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type BottomTabBarSize = 'sm' | 'md' | 'lg';
|
|
6
|
-
type BottomTabBarVariant = 'stacked' | 'inline' | 'icon-only';
|
|
7
|
-
type BottomTabBarIconRenderParams = {
|
|
8
|
-
focused: boolean;
|
|
9
|
-
color: string;
|
|
10
|
-
size: number;
|
|
11
|
-
};
|
|
12
|
-
type BottomTabBarItemLabelRenderParams = {
|
|
13
|
-
focused: boolean;
|
|
14
|
-
color: string;
|
|
15
|
-
children: string;
|
|
16
|
-
position: 'below-icon' | 'beside-icon';
|
|
17
|
-
};
|
|
18
|
-
type BottomTabBarItemCustomAppearance = {
|
|
19
|
-
container?: StyleProp<ViewStyle>;
|
|
20
|
-
indicator?: StyleProp<ViewStyle>;
|
|
21
|
-
label?: StyleProp<TextStyle>;
|
|
22
|
-
};
|
|
23
|
-
type BottomTabBarItemProps = {
|
|
24
|
-
/**
|
|
25
|
-
* Unique key for this tab item.
|
|
26
|
-
*/
|
|
27
|
-
itemKey: string;
|
|
28
|
-
/**
|
|
29
|
-
* Label shown under icon.
|
|
30
|
-
*/
|
|
31
|
-
label: ReactNode;
|
|
32
|
-
/**
|
|
33
|
-
* Icon content or icon render function.
|
|
34
|
-
*/
|
|
35
|
-
icon?: ReactNode | ((params: BottomTabBarIconRenderParams) => ReactNode);
|
|
36
|
-
/**
|
|
37
|
-
* Optional icon when selected.
|
|
38
|
-
*/
|
|
39
|
-
activeIcon?: ReactNode | ((params: BottomTabBarIconRenderParams) => ReactNode);
|
|
40
|
-
/**
|
|
41
|
-
* Optional badge shown near icon.
|
|
42
|
-
*/
|
|
43
|
-
badge?: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* Whether this item is disabled.
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
isDisabled?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Controlled selected state (standalone mode).
|
|
51
|
-
*/
|
|
52
|
-
isSelected?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Whether to show label.
|
|
55
|
-
*/
|
|
56
|
-
showLabel?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Per-item active color override.
|
|
59
|
-
*/
|
|
60
|
-
activeColor?: string;
|
|
61
|
-
/**
|
|
62
|
-
* Per-item inactive color override.
|
|
63
|
-
*/
|
|
64
|
-
inactiveColor?: string;
|
|
65
|
-
/**
|
|
66
|
-
* Per-item active indicator color override.
|
|
67
|
-
*/
|
|
68
|
-
indicatorColor?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Custom style for item.
|
|
71
|
-
*/
|
|
72
|
-
style?: StyleProp<ViewStyle>;
|
|
73
|
-
/**
|
|
74
|
-
* Custom appearance styles.
|
|
75
|
-
*/
|
|
76
|
-
customAppearance?: BottomTabBarItemCustomAppearance;
|
|
77
|
-
/**
|
|
78
|
-
* Callback fired when item is pressed.
|
|
79
|
-
*/
|
|
80
|
-
onPress?: (event: GestureResponderEvent) => void;
|
|
81
|
-
/**
|
|
82
|
-
* Callback fired when item is long-pressed.
|
|
83
|
-
*/
|
|
84
|
-
onLongPress?: (event: GestureResponderEvent) => void;
|
|
85
|
-
/**
|
|
86
|
-
* Accessibility label.
|
|
87
|
-
*/
|
|
88
|
-
accessibilityLabel?: string;
|
|
89
|
-
/**
|
|
90
|
-
* testID for e2e tests.
|
|
91
|
-
*/
|
|
92
|
-
testID?: string;
|
|
93
|
-
};
|
|
94
|
-
type ExpoRouterTabRoute = {
|
|
95
|
-
key: string;
|
|
96
|
-
name: string;
|
|
97
|
-
params?: Record<string, unknown>;
|
|
98
|
-
};
|
|
99
|
-
type ExpoRouterTabState = {
|
|
100
|
-
index: number;
|
|
101
|
-
routes: ExpoRouterTabRoute[];
|
|
102
|
-
};
|
|
103
|
-
type ExpoRouterTabDescriptorOptions = {
|
|
104
|
-
title?: string;
|
|
105
|
-
tabBarLabel?: string | ((props: BottomTabBarItemLabelRenderParams) => ReactNode);
|
|
106
|
-
tabBarIcon?: (props: BottomTabBarIconRenderParams) => ReactNode;
|
|
107
|
-
tabBarActiveTintColor?: string;
|
|
108
|
-
tabBarInactiveTintColor?: string;
|
|
109
|
-
tabBarBadge?: ReactNode;
|
|
110
|
-
tabBarShowLabel?: boolean;
|
|
111
|
-
tabBarButtonTestID?: string;
|
|
112
|
-
tabBarAccessibilityLabel?: string;
|
|
113
|
-
tabBarItemStyle?: StyleProp<ViewStyle>;
|
|
114
|
-
tabBarStyle?: StyleProp<ViewStyle>;
|
|
115
|
-
href?: string | null;
|
|
116
|
-
};
|
|
117
|
-
type ExpoRouterTabDescriptor = {
|
|
118
|
-
options: ExpoRouterTabDescriptorOptions;
|
|
119
|
-
};
|
|
120
|
-
type ExpoRouterTabDescriptors = Record<string, ExpoRouterTabDescriptor>;
|
|
121
|
-
type ExpoRouterTabNavigation = {
|
|
122
|
-
emit: (options: {
|
|
123
|
-
type: 'tabPress' | 'tabLongPress';
|
|
124
|
-
target?: string;
|
|
125
|
-
canPreventDefault?: boolean;
|
|
126
|
-
}) => {
|
|
127
|
-
defaultPrevented?: boolean;
|
|
128
|
-
};
|
|
129
|
-
navigate: (name: string, params?: Record<string, unknown>) => void;
|
|
130
|
-
};
|
|
131
|
-
type ExpoRouterBottomTabBarCompatibleProps = {
|
|
132
|
-
state: ExpoRouterTabState;
|
|
133
|
-
descriptors: ExpoRouterTabDescriptors;
|
|
134
|
-
navigation: ExpoRouterTabNavigation;
|
|
135
|
-
insets?: Partial<Insets>;
|
|
136
|
-
};
|
|
137
|
-
type BottomTabBarBaseProps = {
|
|
138
|
-
/**
|
|
139
|
-
* Shared theme color.
|
|
140
|
-
* @default 'primary'
|
|
141
|
-
*/
|
|
142
|
-
themeColor?: ThemeColor;
|
|
143
|
-
/**
|
|
144
|
-
* Bar size.
|
|
145
|
-
* @default 'md'
|
|
146
|
-
*/
|
|
147
|
-
size?: BottomTabBarSize;
|
|
148
|
-
/**
|
|
149
|
-
* Layout variant for each tab item.
|
|
150
|
-
* @default 'stacked'
|
|
151
|
-
*/
|
|
152
|
-
variant?: BottomTabBarVariant;
|
|
153
|
-
/**
|
|
154
|
-
* Whether all items are disabled.
|
|
155
|
-
* @default false
|
|
156
|
-
*/
|
|
157
|
-
isDisabled?: boolean;
|
|
158
|
-
/**
|
|
159
|
-
* Whether labels are shown by default.
|
|
160
|
-
* @default true
|
|
161
|
-
*/
|
|
162
|
-
showLabel?: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Safe area bottom inset (manual mode). In expo-router mode this comes from `insets.bottom`.
|
|
165
|
-
*/
|
|
166
|
-
insetBottom?: number;
|
|
167
|
-
/**
|
|
168
|
-
* Active indicator color override.
|
|
169
|
-
*/
|
|
170
|
-
indicatorColor?: string;
|
|
171
|
-
/**
|
|
172
|
-
* Active icon/label color override.
|
|
173
|
-
*/
|
|
174
|
-
activeColor?: string;
|
|
175
|
-
/**
|
|
176
|
-
* Inactive icon/label color override.
|
|
177
|
-
*/
|
|
178
|
-
inactiveColor?: string;
|
|
179
|
-
/**
|
|
180
|
-
* Bar container style.
|
|
181
|
-
*/
|
|
182
|
-
style?: StyleProp<ViewStyle>;
|
|
183
|
-
/**
|
|
184
|
-
* Custom appearance styles.
|
|
185
|
-
*/
|
|
186
|
-
customAppearance?: {
|
|
187
|
-
container?: StyleProp<ViewStyle>;
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
type BottomTabBarComposableProps = BottomTabBarBaseProps & {
|
|
191
|
-
children: ReactNode;
|
|
192
|
-
/**
|
|
193
|
-
* Controlled selected item key.
|
|
194
|
-
*/
|
|
195
|
-
selectedKey?: string;
|
|
196
|
-
/**
|
|
197
|
-
* Uncontrolled default selected item key.
|
|
198
|
-
*/
|
|
199
|
-
defaultSelectedKey?: string;
|
|
200
|
-
/**
|
|
201
|
-
* Callback fired when selected item changes.
|
|
202
|
-
*/
|
|
203
|
-
onSelectionChange?: (key: string) => void;
|
|
204
|
-
};
|
|
205
|
-
type BottomTabBarProps = BottomTabBarComposableProps | (BottomTabBarBaseProps & ExpoRouterBottomTabBarCompatibleProps);
|
|
206
|
-
|
|
207
|
-
declare const BottomTabBar: React.FC<BottomTabBarProps>;
|
|
208
|
-
|
|
209
|
-
declare const BottomTabBarItem: React.FC<BottomTabBarItemProps>;
|
|
210
|
-
|
|
211
|
-
export { BottomTabBar, type BottomTabBarComposableProps, type BottomTabBarIconRenderParams, BottomTabBarItem, type BottomTabBarItemCustomAppearance, type BottomTabBarItemLabelRenderParams, type BottomTabBarItemProps, type BottomTabBarProps, type BottomTabBarSize, type BottomTabBarVariant, type ExpoRouterBottomTabBarCompatibleProps, type ExpoRouterTabDescriptor, type ExpoRouterTabDescriptorOptions, type ExpoRouterTabDescriptors, type ExpoRouterTabNavigation, type ExpoRouterTabRoute, type ExpoRouterTabState };
|
|
@@ -1,497 +0,0 @@
|
|
|
1
|
-
import "../chunk-SHBDANQN.js";
|
|
2
|
-
import {
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/bottom-tab-bar/bottom-tab-bar.tsx
|
|
7
|
-
import React2, { useMemo as useMemo3, useState as useState2 } from "react";
|
|
8
|
-
import { View as View2 } from "react-native";
|
|
9
|
-
|
|
10
|
-
// src/components/bottom-tab-bar/bottom-tab-bar.hook.ts
|
|
11
|
-
import { useMemo } from "react";
|
|
12
|
-
import { getSafeThemeColor, withOpacity } from "@xaui/core";
|
|
13
|
-
var sizeMap = {
|
|
14
|
-
sm: {
|
|
15
|
-
minHeight: 68,
|
|
16
|
-
iconSize: 20,
|
|
17
|
-
indicatorWidth: 58,
|
|
18
|
-
indicatorHeight: 30,
|
|
19
|
-
indicatorRadius: 15,
|
|
20
|
-
itemPaddingTop: 8,
|
|
21
|
-
itemPaddingBottom: 6,
|
|
22
|
-
labelSize: 11,
|
|
23
|
-
labelSpacing: 4
|
|
24
|
-
},
|
|
25
|
-
md: {
|
|
26
|
-
minHeight: 78,
|
|
27
|
-
iconSize: 24,
|
|
28
|
-
indicatorWidth: 64,
|
|
29
|
-
indicatorHeight: 32,
|
|
30
|
-
indicatorRadius: 16,
|
|
31
|
-
itemPaddingTop: 10,
|
|
32
|
-
itemPaddingBottom: 8,
|
|
33
|
-
labelSize: 12,
|
|
34
|
-
labelSpacing: 4
|
|
35
|
-
},
|
|
36
|
-
lg: {
|
|
37
|
-
minHeight: 86,
|
|
38
|
-
iconSize: 26,
|
|
39
|
-
indicatorWidth: 70,
|
|
40
|
-
indicatorHeight: 36,
|
|
41
|
-
indicatorRadius: 18,
|
|
42
|
-
itemPaddingTop: 11,
|
|
43
|
-
itemPaddingBottom: 10,
|
|
44
|
-
labelSize: 13,
|
|
45
|
-
labelSpacing: 5
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var useBottomTabBarSizeStyles = (size) => {
|
|
49
|
-
return useMemo(() => sizeMap[size], [size]);
|
|
50
|
-
};
|
|
51
|
-
var useBottomTabBarColors = (themeColor, activeColor, inactiveColor, indicatorColor) => {
|
|
52
|
-
const theme = useXUITheme();
|
|
53
|
-
const colorScheme = theme.colors[getSafeThemeColor(themeColor)];
|
|
54
|
-
return useMemo(() => {
|
|
55
|
-
return {
|
|
56
|
-
activeColor: activeColor ?? colorScheme.main,
|
|
57
|
-
inactiveColor: inactiveColor ?? withOpacity(theme.colors.foreground, 0.66),
|
|
58
|
-
indicatorColor: indicatorColor ?? withOpacity(colorScheme.main, theme.mode === "dark" ? 0.28 : 0.16),
|
|
59
|
-
containerColor: theme.colors.background,
|
|
60
|
-
borderColor: withOpacity(theme.colors.foreground, 0.08)
|
|
61
|
-
};
|
|
62
|
-
}, [activeColor, colorScheme.main, indicatorColor, inactiveColor, theme]);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
// src/components/bottom-tab-bar/bottom-tab-bar-context.ts
|
|
66
|
-
import { createContext, useContext } from "react";
|
|
67
|
-
var BottomTabBarContext = createContext(
|
|
68
|
-
null
|
|
69
|
-
);
|
|
70
|
-
var useBottomTabBarContext = () => {
|
|
71
|
-
return useContext(BottomTabBarContext);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
// src/components/bottom-tab-bar/bottom-tab-bar-item.tsx
|
|
75
|
-
import React, { useEffect, useMemo as useMemo2, useRef, useState } from "react";
|
|
76
|
-
import { Animated, Pressable, Text, View } from "react-native";
|
|
77
|
-
|
|
78
|
-
// src/components/bottom-tab-bar/bottom-tab-bar.style.ts
|
|
79
|
-
import { StyleSheet } from "react-native";
|
|
80
|
-
var styles = StyleSheet.create({
|
|
81
|
-
container: {
|
|
82
|
-
flexDirection: "row",
|
|
83
|
-
alignItems: "stretch",
|
|
84
|
-
width: "100%",
|
|
85
|
-
borderTopWidth: 1
|
|
86
|
-
},
|
|
87
|
-
itemPressable: {
|
|
88
|
-
flex: 1
|
|
89
|
-
},
|
|
90
|
-
itemContainer: {
|
|
91
|
-
flex: 1,
|
|
92
|
-
alignItems: "center",
|
|
93
|
-
justifyContent: "center"
|
|
94
|
-
},
|
|
95
|
-
itemContainerInline: {
|
|
96
|
-
flexDirection: "row"
|
|
97
|
-
},
|
|
98
|
-
indicator: {
|
|
99
|
-
alignItems: "center",
|
|
100
|
-
justifyContent: "center",
|
|
101
|
-
position: "relative"
|
|
102
|
-
},
|
|
103
|
-
indicatorContent: {
|
|
104
|
-
flexDirection: "row",
|
|
105
|
-
alignItems: "center",
|
|
106
|
-
justifyContent: "center"
|
|
107
|
-
},
|
|
108
|
-
indicatorBackground: {
|
|
109
|
-
position: "absolute"
|
|
110
|
-
},
|
|
111
|
-
label: {
|
|
112
|
-
fontWeight: "600",
|
|
113
|
-
letterSpacing: 0.1
|
|
114
|
-
},
|
|
115
|
-
inlineLabel: {
|
|
116
|
-
marginLeft: 6
|
|
117
|
-
},
|
|
118
|
-
badgeContainer: {
|
|
119
|
-
position: "absolute",
|
|
120
|
-
top: -4,
|
|
121
|
-
right: -10
|
|
122
|
-
},
|
|
123
|
-
disabled: {
|
|
124
|
-
opacity: 0.5
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
// src/components/bottom-tab-bar/bottom-tab-bar-item.tsx
|
|
129
|
-
var resolveIconNode = (icon, params) => {
|
|
130
|
-
if (typeof icon === "function") {
|
|
131
|
-
return icon(params);
|
|
132
|
-
}
|
|
133
|
-
return icon;
|
|
134
|
-
};
|
|
135
|
-
var BottomTabBarItem = ({
|
|
136
|
-
itemKey,
|
|
137
|
-
label,
|
|
138
|
-
icon,
|
|
139
|
-
activeIcon,
|
|
140
|
-
badge,
|
|
141
|
-
isDisabled = false,
|
|
142
|
-
isSelected,
|
|
143
|
-
showLabel,
|
|
144
|
-
activeColor,
|
|
145
|
-
inactiveColor,
|
|
146
|
-
indicatorColor,
|
|
147
|
-
style,
|
|
148
|
-
customAppearance,
|
|
149
|
-
onPress,
|
|
150
|
-
onLongPress,
|
|
151
|
-
accessibilityLabel,
|
|
152
|
-
testID
|
|
153
|
-
}) => {
|
|
154
|
-
const INLINE_INDICATOR_HORIZONTAL_PADDING = 10;
|
|
155
|
-
const INLINE_INDICATOR_VERTICAL_PADDING = 14;
|
|
156
|
-
const ICON_ONLY_INDICATOR_HORIZONTAL_PADDING = 10;
|
|
157
|
-
const ICON_ONLY_INDICATOR_VERTICAL_PADDING = 10;
|
|
158
|
-
const context = useBottomTabBarContext();
|
|
159
|
-
const selected = isSelected ?? context?.selectedKey === itemKey;
|
|
160
|
-
const disabled = isDisabled || !!context?.isDisabled;
|
|
161
|
-
const resolvedVariant = context?.variant ?? "stacked";
|
|
162
|
-
const isIconOnly = resolvedVariant === "icon-only";
|
|
163
|
-
const resolvedShowLabel = isIconOnly ? false : showLabel ?? context?.showLabel ?? true;
|
|
164
|
-
const isInline = resolvedVariant === "inline";
|
|
165
|
-
const resolvedSize = context?.size ?? "md";
|
|
166
|
-
const resolvedThemeColor = context?.themeColor ?? "primary";
|
|
167
|
-
const [contentSize, setContentSize] = useState({ width: 0, height: 0 });
|
|
168
|
-
const sizeStyles = useBottomTabBarSizeStyles(resolvedSize);
|
|
169
|
-
const resolvedIndicatorWidth = isInline ? Math.max(
|
|
170
|
-
sizeStyles.indicatorHeight,
|
|
171
|
-
contentSize.width + INLINE_INDICATOR_HORIZONTAL_PADDING * 2
|
|
172
|
-
) : isIconOnly ? Math.max(
|
|
173
|
-
sizeStyles.indicatorWidth,
|
|
174
|
-
contentSize.width + ICON_ONLY_INDICATOR_HORIZONTAL_PADDING * 2
|
|
175
|
-
) : sizeStyles.indicatorWidth;
|
|
176
|
-
const resolvedIndicatorHeight = isInline ? Math.max(
|
|
177
|
-
sizeStyles.indicatorHeight,
|
|
178
|
-
contentSize.height + INLINE_INDICATOR_VERTICAL_PADDING * 1.35
|
|
179
|
-
) : isIconOnly ? Math.max(
|
|
180
|
-
sizeStyles.indicatorHeight,
|
|
181
|
-
contentSize.height + ICON_ONLY_INDICATOR_VERTICAL_PADDING * 2
|
|
182
|
-
) : sizeStyles.indicatorHeight;
|
|
183
|
-
const colors = useBottomTabBarColors(
|
|
184
|
-
resolvedThemeColor,
|
|
185
|
-
activeColor ?? context?.activeColor,
|
|
186
|
-
inactiveColor ?? context?.inactiveColor,
|
|
187
|
-
indicatorColor ?? context?.indicatorColor
|
|
188
|
-
);
|
|
189
|
-
const indicatorScale = useRef(new Animated.Value(selected ? 1 : 0.75)).current;
|
|
190
|
-
const indicatorOpacity = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
191
|
-
useEffect(() => {
|
|
192
|
-
Animated.parallel([
|
|
193
|
-
Animated.spring(indicatorScale, {
|
|
194
|
-
toValue: selected ? 1 : 0.75,
|
|
195
|
-
friction: 9,
|
|
196
|
-
tension: 95,
|
|
197
|
-
useNativeDriver: true
|
|
198
|
-
}),
|
|
199
|
-
Animated.timing(indicatorOpacity, {
|
|
200
|
-
toValue: selected ? 1 : 0,
|
|
201
|
-
duration: selected ? 180 : 140,
|
|
202
|
-
useNativeDriver: true
|
|
203
|
-
})
|
|
204
|
-
]).start();
|
|
205
|
-
}, [indicatorOpacity, indicatorScale, selected]);
|
|
206
|
-
const iconColor = selected ? colors.activeColor : colors.inactiveColor;
|
|
207
|
-
const iconNode = useMemo2(() => {
|
|
208
|
-
const params = {
|
|
209
|
-
focused: !!selected,
|
|
210
|
-
color: iconColor,
|
|
211
|
-
size: sizeStyles.iconSize
|
|
212
|
-
};
|
|
213
|
-
if (selected && activeIcon) {
|
|
214
|
-
return resolveIconNode(activeIcon, params);
|
|
215
|
-
}
|
|
216
|
-
return resolveIconNode(icon, params);
|
|
217
|
-
}, [activeIcon, icon, iconColor, selected, sizeStyles.iconSize]);
|
|
218
|
-
const labelNode = resolvedShowLabel ? /* @__PURE__ */ React.createElement(
|
|
219
|
-
Text,
|
|
220
|
-
{
|
|
221
|
-
numberOfLines: 1,
|
|
222
|
-
style: [
|
|
223
|
-
styles.label,
|
|
224
|
-
isInline && styles.inlineLabel,
|
|
225
|
-
{
|
|
226
|
-
color: iconColor,
|
|
227
|
-
fontSize: sizeStyles.labelSize
|
|
228
|
-
},
|
|
229
|
-
customAppearance?.label
|
|
230
|
-
]
|
|
231
|
-
},
|
|
232
|
-
label
|
|
233
|
-
) : null;
|
|
234
|
-
return /* @__PURE__ */ React.createElement(
|
|
235
|
-
Pressable,
|
|
236
|
-
{
|
|
237
|
-
onPress: (event) => {
|
|
238
|
-
if (disabled) return;
|
|
239
|
-
context?.onSelectionChange?.(itemKey);
|
|
240
|
-
onPress?.(event);
|
|
241
|
-
},
|
|
242
|
-
onLongPress,
|
|
243
|
-
disabled,
|
|
244
|
-
accessibilityRole: "tab",
|
|
245
|
-
accessibilityState: { selected: !!selected, disabled },
|
|
246
|
-
accessibilityLabel,
|
|
247
|
-
testID,
|
|
248
|
-
style: styles.itemPressable
|
|
249
|
-
},
|
|
250
|
-
/* @__PURE__ */ React.createElement(
|
|
251
|
-
View,
|
|
252
|
-
{
|
|
253
|
-
style: [
|
|
254
|
-
styles.itemContainer,
|
|
255
|
-
isInline && styles.itemContainerInline,
|
|
256
|
-
{
|
|
257
|
-
paddingTop: sizeStyles.itemPaddingTop,
|
|
258
|
-
paddingBottom: sizeStyles.itemPaddingBottom
|
|
259
|
-
},
|
|
260
|
-
disabled && styles.disabled,
|
|
261
|
-
style,
|
|
262
|
-
customAppearance?.container
|
|
263
|
-
]
|
|
264
|
-
},
|
|
265
|
-
/* @__PURE__ */ React.createElement(
|
|
266
|
-
Animated.View,
|
|
267
|
-
{
|
|
268
|
-
style: [
|
|
269
|
-
styles.indicator,
|
|
270
|
-
{
|
|
271
|
-
width: resolvedIndicatorWidth,
|
|
272
|
-
height: resolvedIndicatorHeight,
|
|
273
|
-
marginBottom: !isInline && resolvedShowLabel ? sizeStyles.labelSpacing : 0
|
|
274
|
-
},
|
|
275
|
-
customAppearance?.indicator
|
|
276
|
-
]
|
|
277
|
-
},
|
|
278
|
-
/* @__PURE__ */ React.createElement(
|
|
279
|
-
Animated.View,
|
|
280
|
-
{
|
|
281
|
-
style: [
|
|
282
|
-
styles.indicatorBackground,
|
|
283
|
-
{
|
|
284
|
-
width: resolvedIndicatorWidth,
|
|
285
|
-
height: resolvedIndicatorHeight,
|
|
286
|
-
borderRadius: resolvedIndicatorHeight / 2,
|
|
287
|
-
backgroundColor: colors.indicatorColor,
|
|
288
|
-
transform: [{ scale: indicatorScale }],
|
|
289
|
-
opacity: indicatorOpacity
|
|
290
|
-
}
|
|
291
|
-
]
|
|
292
|
-
}
|
|
293
|
-
),
|
|
294
|
-
/* @__PURE__ */ React.createElement(
|
|
295
|
-
View,
|
|
296
|
-
{
|
|
297
|
-
style: styles.indicatorContent,
|
|
298
|
-
onLayout: (event) => {
|
|
299
|
-
if (!isInline && !isIconOnly) return;
|
|
300
|
-
const nextWidth = Math.ceil(event.nativeEvent.layout.width);
|
|
301
|
-
const nextHeight = Math.ceil(event.nativeEvent.layout.height);
|
|
302
|
-
setContentSize(
|
|
303
|
-
(prev) => prev.width === nextWidth && prev.height === nextHeight ? prev : { width: nextWidth, height: nextHeight }
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
iconNode,
|
|
308
|
-
badge ? /* @__PURE__ */ React.createElement(View, { style: styles.badgeContainer }, badge) : null,
|
|
309
|
-
isInline ? labelNode : null
|
|
310
|
-
)
|
|
311
|
-
),
|
|
312
|
-
!isInline ? labelNode : null
|
|
313
|
-
)
|
|
314
|
-
);
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
// src/components/bottom-tab-bar/bottom-tab-bar.tsx
|
|
318
|
-
var isExpoRouterMode = (props) => {
|
|
319
|
-
return "state" in props && "navigation" in props && "descriptors" in props && !!props.state && !!props.navigation && !!props.descriptors;
|
|
320
|
-
};
|
|
321
|
-
var getRouteLabel = (route, options, focused, color, variant) => {
|
|
322
|
-
if (typeof options.tabBarLabel === "function") {
|
|
323
|
-
return options.tabBarLabel({
|
|
324
|
-
focused,
|
|
325
|
-
color,
|
|
326
|
-
children: options.title ?? route.name,
|
|
327
|
-
position: variant === "inline" ? "beside-icon" : "below-icon"
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
if (typeof options.tabBarLabel === "string") {
|
|
331
|
-
return options.tabBarLabel;
|
|
332
|
-
}
|
|
333
|
-
if (typeof options.title === "string") {
|
|
334
|
-
return options.title;
|
|
335
|
-
}
|
|
336
|
-
return route.name;
|
|
337
|
-
};
|
|
338
|
-
var BottomTabBar = (props) => {
|
|
339
|
-
const {
|
|
340
|
-
themeColor = "primary",
|
|
341
|
-
size = "md",
|
|
342
|
-
variant = "stacked",
|
|
343
|
-
isDisabled = false,
|
|
344
|
-
showLabel = true,
|
|
345
|
-
insetBottom = 0,
|
|
346
|
-
indicatorColor,
|
|
347
|
-
activeColor,
|
|
348
|
-
inactiveColor,
|
|
349
|
-
style,
|
|
350
|
-
customAppearance
|
|
351
|
-
} = props;
|
|
352
|
-
const sizeStyles = useBottomTabBarSizeStyles(size);
|
|
353
|
-
const colors = useBottomTabBarColors(
|
|
354
|
-
themeColor,
|
|
355
|
-
activeColor,
|
|
356
|
-
inactiveColor,
|
|
357
|
-
indicatorColor
|
|
358
|
-
);
|
|
359
|
-
if (isExpoRouterMode(props)) {
|
|
360
|
-
const { state, descriptors, navigation, insets } = props;
|
|
361
|
-
const currentRoute = state.routes[state.index];
|
|
362
|
-
const focusedOptions = descriptors[currentRoute.key]?.options;
|
|
363
|
-
const focusedStyle = focusedOptions?.tabBarStyle;
|
|
364
|
-
if (focusedStyle?.display === "none") {
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
367
|
-
const routerInsetBottom = insets?.bottom ?? insetBottom;
|
|
368
|
-
return /* @__PURE__ */ React2.createElement(
|
|
369
|
-
View2,
|
|
370
|
-
{
|
|
371
|
-
style: [
|
|
372
|
-
styles.container,
|
|
373
|
-
{
|
|
374
|
-
minHeight: sizeStyles.minHeight + routerInsetBottom,
|
|
375
|
-
paddingBottom: routerInsetBottom,
|
|
376
|
-
backgroundColor: colors.containerColor,
|
|
377
|
-
borderTopColor: colors.borderColor
|
|
378
|
-
},
|
|
379
|
-
style,
|
|
380
|
-
customAppearance?.container
|
|
381
|
-
]
|
|
382
|
-
},
|
|
383
|
-
state.routes.filter((route) => descriptors[route.key]?.options.href !== null).map((route) => {
|
|
384
|
-
const routeOptions = descriptors[route.key]?.options ?? {};
|
|
385
|
-
const focused = currentRoute.key === route.key;
|
|
386
|
-
const routeActiveColor = routeOptions.tabBarActiveTintColor ?? activeColor;
|
|
387
|
-
const routeInactiveColor = routeOptions.tabBarInactiveTintColor ?? inactiveColor;
|
|
388
|
-
const labelColor = focused ? routeActiveColor ?? colors.activeColor : routeInactiveColor ?? colors.inactiveColor;
|
|
389
|
-
return /* @__PURE__ */ React2.createElement(
|
|
390
|
-
BottomTabBarItem,
|
|
391
|
-
{
|
|
392
|
-
key: route.key,
|
|
393
|
-
itemKey: route.key,
|
|
394
|
-
label: getRouteLabel(
|
|
395
|
-
route,
|
|
396
|
-
routeOptions,
|
|
397
|
-
focused,
|
|
398
|
-
labelColor,
|
|
399
|
-
variant
|
|
400
|
-
),
|
|
401
|
-
icon: routeOptions.tabBarIcon,
|
|
402
|
-
isSelected: focused,
|
|
403
|
-
showLabel: routeOptions.tabBarShowLabel ?? showLabel,
|
|
404
|
-
activeColor: routeActiveColor,
|
|
405
|
-
inactiveColor: routeInactiveColor,
|
|
406
|
-
badge: routeOptions.tabBarBadge,
|
|
407
|
-
accessibilityLabel: routeOptions.tabBarAccessibilityLabel,
|
|
408
|
-
testID: routeOptions.tabBarButtonTestID,
|
|
409
|
-
style: routeOptions.tabBarItemStyle,
|
|
410
|
-
isDisabled,
|
|
411
|
-
onPress: () => {
|
|
412
|
-
const event = navigation.emit({
|
|
413
|
-
type: "tabPress",
|
|
414
|
-
target: route.key,
|
|
415
|
-
canPreventDefault: true
|
|
416
|
-
});
|
|
417
|
-
if (!focused && !event.defaultPrevented) {
|
|
418
|
-
navigation.navigate(route.name, route.params);
|
|
419
|
-
}
|
|
420
|
-
},
|
|
421
|
-
onLongPress: () => {
|
|
422
|
-
navigation.emit({
|
|
423
|
-
type: "tabLongPress",
|
|
424
|
-
target: route.key
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
);
|
|
429
|
-
})
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
const { children, selectedKey, defaultSelectedKey, onSelectionChange } = props;
|
|
433
|
-
const firstItemKey = React2.useMemo(() => {
|
|
434
|
-
const child = React2.Children.toArray(children)[0];
|
|
435
|
-
if (React2.isValidElement(child)) {
|
|
436
|
-
return child.props.itemKey;
|
|
437
|
-
}
|
|
438
|
-
return void 0;
|
|
439
|
-
}, [children]);
|
|
440
|
-
const isControlled = typeof selectedKey === "string";
|
|
441
|
-
const [internalSelectedKey, setInternalSelectedKey] = useState2(
|
|
442
|
-
defaultSelectedKey ?? firstItemKey
|
|
443
|
-
);
|
|
444
|
-
const resolvedSelectedKey = isControlled ? selectedKey : internalSelectedKey;
|
|
445
|
-
const handleSelectionChange = (nextKey) => {
|
|
446
|
-
if (!isControlled) {
|
|
447
|
-
setInternalSelectedKey(nextKey);
|
|
448
|
-
}
|
|
449
|
-
onSelectionChange?.(nextKey);
|
|
450
|
-
};
|
|
451
|
-
const contextValue = useMemo3(
|
|
452
|
-
() => ({
|
|
453
|
-
selectedKey: resolvedSelectedKey,
|
|
454
|
-
onSelectionChange: handleSelectionChange,
|
|
455
|
-
isDisabled,
|
|
456
|
-
showLabel,
|
|
457
|
-
size,
|
|
458
|
-
variant,
|
|
459
|
-
themeColor,
|
|
460
|
-
indicatorColor,
|
|
461
|
-
activeColor,
|
|
462
|
-
inactiveColor
|
|
463
|
-
}),
|
|
464
|
-
[
|
|
465
|
-
activeColor,
|
|
466
|
-
inactiveColor,
|
|
467
|
-
indicatorColor,
|
|
468
|
-
isDisabled,
|
|
469
|
-
resolvedSelectedKey,
|
|
470
|
-
showLabel,
|
|
471
|
-
size,
|
|
472
|
-
variant,
|
|
473
|
-
themeColor
|
|
474
|
-
]
|
|
475
|
-
);
|
|
476
|
-
return /* @__PURE__ */ React2.createElement(BottomTabBarContext.Provider, { value: contextValue }, /* @__PURE__ */ React2.createElement(
|
|
477
|
-
View2,
|
|
478
|
-
{
|
|
479
|
-
style: [
|
|
480
|
-
styles.container,
|
|
481
|
-
{
|
|
482
|
-
minHeight: sizeStyles.minHeight + insetBottom,
|
|
483
|
-
paddingBottom: insetBottom,
|
|
484
|
-
backgroundColor: colors.containerColor,
|
|
485
|
-
borderTopColor: colors.borderColor
|
|
486
|
-
},
|
|
487
|
-
style,
|
|
488
|
-
customAppearance?.container
|
|
489
|
-
]
|
|
490
|
-
},
|
|
491
|
-
children
|
|
492
|
-
));
|
|
493
|
-
};
|
|
494
|
-
export {
|
|
495
|
-
BottomTabBar,
|
|
496
|
-
BottomTabBarItem
|
|
497
|
-
};
|