@gaozh1024/rn-kit 0.3.3 → 0.3.4
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/README.md +106 -11
- package/TAILWIND_SETUP.md +1 -0
- package/dist/index.d.mts +23 -5
- package/dist/index.d.ts +23 -5
- package/dist/index.js +388 -363
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +350 -326
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,6 +44,7 @@ __export(index_exports, {
|
|
|
44
44
|
AppScrollView: () => AppScrollView,
|
|
45
45
|
AppStatusBar: () => AppStatusBar,
|
|
46
46
|
AppText: () => AppText,
|
|
47
|
+
AppTextInput: () => AppTextInput,
|
|
47
48
|
AppView: () => AppView,
|
|
48
49
|
BottomTabBar: () => BottomTabBar,
|
|
49
50
|
Card: () => Card,
|
|
@@ -61,7 +62,7 @@ __export(index_exports, {
|
|
|
61
62
|
Icon: () => Icon,
|
|
62
63
|
Loading: () => Loading,
|
|
63
64
|
MemoryStorage: () => MemoryStorage,
|
|
64
|
-
NavigationContainer: () =>
|
|
65
|
+
NavigationContainer: () => import_native6.NavigationContainer,
|
|
65
66
|
NavigationIcons: () => NavigationIcons,
|
|
66
67
|
NavigationProvider: () => NavigationProvider,
|
|
67
68
|
OverlayProvider: () => OverlayProvider,
|
|
@@ -120,10 +121,10 @@ __export(index_exports, {
|
|
|
120
121
|
useDebounce: () => useDebounce,
|
|
121
122
|
useDimensions: () => useDimensions,
|
|
122
123
|
useDrawerNavigation: () => useDrawerNavigation,
|
|
123
|
-
useFocusEffect: () =>
|
|
124
|
+
useFocusEffect: () => import_native5.useFocusEffect,
|
|
124
125
|
useForm: () => useForm,
|
|
125
126
|
useInfinite: () => useInfinite,
|
|
126
|
-
useIsFocused: () =>
|
|
127
|
+
useIsFocused: () => import_native5.useIsFocused,
|
|
127
128
|
useKeyboard: () => useKeyboard,
|
|
128
129
|
useLoading: () => useLoading,
|
|
129
130
|
useMemoizedFn: () => useMemoizedFn,
|
|
@@ -138,7 +139,7 @@ __export(index_exports, {
|
|
|
138
139
|
useRefresh: () => useRefresh,
|
|
139
140
|
useRequest: () => useRequest,
|
|
140
141
|
useRoute: () => useRoute,
|
|
141
|
-
useScrollToTop: () =>
|
|
142
|
+
useScrollToTop: () => import_native5.useScrollToTop,
|
|
142
143
|
useSetState: () => useSetState,
|
|
143
144
|
useStackNavigation: () => useStackNavigation,
|
|
144
145
|
useStorage: () => useStorage,
|
|
@@ -1144,6 +1145,7 @@ var import_jsx_runtime2 = require("nativewind/jsx-runtime");
|
|
|
1144
1145
|
function AppView({
|
|
1145
1146
|
flex,
|
|
1146
1147
|
row,
|
|
1148
|
+
wrap,
|
|
1147
1149
|
center,
|
|
1148
1150
|
between,
|
|
1149
1151
|
items,
|
|
@@ -1170,6 +1172,7 @@ function AppView({
|
|
|
1170
1172
|
flex === true && "flex-1",
|
|
1171
1173
|
typeof flex === "number" && `flex-${flex}`,
|
|
1172
1174
|
row ? "flex-row" : "flex-col",
|
|
1175
|
+
wrap && "flex-wrap",
|
|
1173
1176
|
center && "items-center justify-center",
|
|
1174
1177
|
between && "justify-between",
|
|
1175
1178
|
items && `items-${items}`,
|
|
@@ -1363,6 +1366,7 @@ function SafeScreen({
|
|
|
1363
1366
|
left = false,
|
|
1364
1367
|
right = false,
|
|
1365
1368
|
bg,
|
|
1369
|
+
surface,
|
|
1366
1370
|
flex = true,
|
|
1367
1371
|
className,
|
|
1368
1372
|
children,
|
|
@@ -1371,7 +1375,7 @@ function SafeScreen({
|
|
|
1371
1375
|
}) {
|
|
1372
1376
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
1373
1377
|
const { theme, isDark } = useOptionalTheme();
|
|
1374
|
-
const resolvedBgColor = resolveNamedColor(bg, theme, isDark);
|
|
1378
|
+
const resolvedBgColor = resolveSurfaceColor(surface, theme, isDark) ?? resolveNamedColor(bg, theme, isDark);
|
|
1375
1379
|
const shouldUseClassBg = !!bg && !resolvedBgColor;
|
|
1376
1380
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1377
1381
|
import_react_native5.View,
|
|
@@ -1403,7 +1407,7 @@ function AppScreen({
|
|
|
1403
1407
|
className,
|
|
1404
1408
|
...props
|
|
1405
1409
|
}) {
|
|
1406
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SafeScreen, { flex: true,
|
|
1410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SafeScreen, { flex: true, surface: "background", ...props, className, children });
|
|
1407
1411
|
}
|
|
1408
1412
|
function SafeBottom({
|
|
1409
1413
|
children,
|
|
@@ -1432,7 +1436,12 @@ function AppButton({
|
|
|
1432
1436
|
const buttonColors = {
|
|
1433
1437
|
primary: theme.colors.primary?.[500] || "#f38b32",
|
|
1434
1438
|
secondary: theme.colors.secondary?.[500] || "#3b82f6",
|
|
1435
|
-
|
|
1439
|
+
success: theme.colors.success?.[500] || "#22c55e",
|
|
1440
|
+
warning: theme.colors.warning?.[500] || "#f59e0b",
|
|
1441
|
+
info: theme.colors.info?.[500] || theme.colors.secondary?.[500] || "#3b82f6",
|
|
1442
|
+
error: theme.colors.error?.[500] || "#ef4444",
|
|
1443
|
+
danger: theme.colors.error?.[500] || "#ef4444",
|
|
1444
|
+
muted: isDark ? "#6b7280" : "#9ca3af"
|
|
1436
1445
|
};
|
|
1437
1446
|
const ghostTextColor = isDark ? "#ffffff" : theme.colors.text?.[500] || "#1f2937";
|
|
1438
1447
|
const ghostBackgroundColor = isDark ? "rgba(255,255,255,0.04)" : "transparent";
|
|
@@ -1693,6 +1702,10 @@ var import_react_native9 = require("react-native");
|
|
|
1693
1702
|
var import_jsx_runtime15 = require("nativewind/jsx-runtime");
|
|
1694
1703
|
function Card({
|
|
1695
1704
|
children,
|
|
1705
|
+
p,
|
|
1706
|
+
px,
|
|
1707
|
+
py,
|
|
1708
|
+
gap,
|
|
1696
1709
|
className,
|
|
1697
1710
|
style,
|
|
1698
1711
|
noShadow = false,
|
|
@@ -1708,6 +1721,10 @@ function Card({
|
|
|
1708
1721
|
!noRadius && "rounded-lg",
|
|
1709
1722
|
!noShadow && "shadow-sm",
|
|
1710
1723
|
"overflow-hidden",
|
|
1724
|
+
p !== void 0 && `p-${p}`,
|
|
1725
|
+
px !== void 0 && `px-${px}`,
|
|
1726
|
+
py !== void 0 && `py-${py}`,
|
|
1727
|
+
gap !== void 0 && `gap-${gap}`,
|
|
1711
1728
|
className
|
|
1712
1729
|
),
|
|
1713
1730
|
style: [
|
|
@@ -2426,6 +2443,8 @@ var AppInput = (0, import_react17.forwardRef)(
|
|
|
2426
2443
|
}
|
|
2427
2444
|
);
|
|
2428
2445
|
AppInput.displayName = "AppInput";
|
|
2446
|
+
var AppTextInput = AppInput;
|
|
2447
|
+
AppTextInput.displayName = "AppTextInput";
|
|
2429
2448
|
var styles5 = import_react_native14.StyleSheet.create({
|
|
2430
2449
|
inputContainer: {
|
|
2431
2450
|
borderWidth: 0.5,
|
|
@@ -4176,285 +4195,16 @@ function createDrawerScreens(routes) {
|
|
|
4176
4195
|
}
|
|
4177
4196
|
|
|
4178
4197
|
// src/navigation/components/AppHeader.tsx
|
|
4179
|
-
var
|
|
4180
|
-
var
|
|
4181
|
-
var import_jsx_runtime36 = require("nativewind/jsx-runtime");
|
|
4182
|
-
function AppHeader({
|
|
4183
|
-
title,
|
|
4184
|
-
subtitle,
|
|
4185
|
-
leftIcon = "chevron-left",
|
|
4186
|
-
onLeftPress,
|
|
4187
|
-
rightIcons = [],
|
|
4188
|
-
transparent = false,
|
|
4189
|
-
safeArea = true,
|
|
4190
|
-
style
|
|
4191
|
-
}) {
|
|
4192
|
-
const colors = useThemeColors();
|
|
4193
|
-
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
4194
|
-
const backgroundColor = transparent ? "transparent" : colors.card;
|
|
4195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4196
|
-
AppView,
|
|
4197
|
-
{
|
|
4198
|
-
style: [
|
|
4199
|
-
{
|
|
4200
|
-
backgroundColor,
|
|
4201
|
-
paddingTop: safeArea ? insets.top : 0
|
|
4202
|
-
},
|
|
4203
|
-
style
|
|
4204
|
-
],
|
|
4205
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { row: true, items: "center", px: 4, style: styles13.container, children: [
|
|
4206
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { style: [styles13.sideContainer, styles13.leftContainer], children: leftIcon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppPressable, { onPress: onLeftPress, style: styles13.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { name: leftIcon, size: 24, color: colors.text }) }) }),
|
|
4207
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { style: styles13.centerContainer, children: [
|
|
4208
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4209
|
-
AppText,
|
|
4210
|
-
{
|
|
4211
|
-
size: "lg",
|
|
4212
|
-
weight: "semibold",
|
|
4213
|
-
style: [styles13.title, { color: colors.text }],
|
|
4214
|
-
numberOfLines: 1,
|
|
4215
|
-
children: title
|
|
4216
|
-
}
|
|
4217
|
-
),
|
|
4218
|
-
subtitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4219
|
-
AppText,
|
|
4220
|
-
{
|
|
4221
|
-
size: "xs",
|
|
4222
|
-
style: [styles13.subtitle, { color: colors.textMuted }],
|
|
4223
|
-
numberOfLines: 1,
|
|
4224
|
-
children: subtitle
|
|
4225
|
-
}
|
|
4226
|
-
)
|
|
4227
|
-
] }),
|
|
4228
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { row: true, items: "center", style: [styles13.sideContainer, styles13.rightContainer], children: rightIcons.map((icon, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppPressable, { onPress: icon.onPress, style: styles13.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { children: [
|
|
4229
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { name: icon.icon, size: 24, color: colors.text }),
|
|
4230
|
-
icon.badge ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { style: styles13.badge, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppText, { size: "xs", color: "white", style: styles13.badgeText, children: icon.badge > 99 ? "99+" : icon.badge }) }) : null
|
|
4231
|
-
] }) }, index)) })
|
|
4232
|
-
] })
|
|
4233
|
-
}
|
|
4234
|
-
);
|
|
4235
|
-
}
|
|
4236
|
-
var styles13 = import_react_native25.StyleSheet.create({
|
|
4237
|
-
container: {
|
|
4238
|
-
height: 44
|
|
4239
|
-
// iOS 标准导航栏高度
|
|
4240
|
-
},
|
|
4241
|
-
sideContainer: {
|
|
4242
|
-
width: 70,
|
|
4243
|
-
// 固定宽度,确保标题居中
|
|
4244
|
-
flexDirection: "row",
|
|
4245
|
-
alignItems: "center"
|
|
4246
|
-
},
|
|
4247
|
-
leftContainer: {
|
|
4248
|
-
justifyContent: "flex-start"
|
|
4249
|
-
},
|
|
4250
|
-
rightContainer: {
|
|
4251
|
-
justifyContent: "flex-end"
|
|
4252
|
-
},
|
|
4253
|
-
centerContainer: {
|
|
4254
|
-
flex: 1,
|
|
4255
|
-
alignItems: "center",
|
|
4256
|
-
justifyContent: "center"
|
|
4257
|
-
},
|
|
4258
|
-
title: {
|
|
4259
|
-
textAlign: "center"
|
|
4260
|
-
},
|
|
4261
|
-
subtitle: {
|
|
4262
|
-
textAlign: "center",
|
|
4263
|
-
marginTop: 2
|
|
4264
|
-
},
|
|
4265
|
-
iconButton: {
|
|
4266
|
-
padding: 8
|
|
4267
|
-
},
|
|
4268
|
-
badge: {
|
|
4269
|
-
position: "absolute",
|
|
4270
|
-
top: -4,
|
|
4271
|
-
right: -4,
|
|
4272
|
-
minWidth: 16,
|
|
4273
|
-
height: 16,
|
|
4274
|
-
borderRadius: 8,
|
|
4275
|
-
backgroundColor: "#ef4444",
|
|
4276
|
-
alignItems: "center",
|
|
4277
|
-
justifyContent: "center",
|
|
4278
|
-
paddingHorizontal: 4
|
|
4279
|
-
},
|
|
4280
|
-
badgeText: {
|
|
4281
|
-
fontSize: 10,
|
|
4282
|
-
fontWeight: "bold"
|
|
4283
|
-
}
|
|
4284
|
-
});
|
|
4285
|
-
|
|
4286
|
-
// src/navigation/components/DrawerContent.tsx
|
|
4287
|
-
var import_react_native26 = require("react-native");
|
|
4288
|
-
var import_drawer2 = require("@react-navigation/drawer");
|
|
4289
|
-
var import_jsx_runtime37 = require("nativewind/jsx-runtime");
|
|
4290
|
-
function DrawerContent({
|
|
4291
|
-
state,
|
|
4292
|
-
descriptors,
|
|
4293
|
-
navigation,
|
|
4294
|
-
header,
|
|
4295
|
-
footer,
|
|
4296
|
-
items,
|
|
4297
|
-
activeBackgroundColor,
|
|
4298
|
-
activeTintColor,
|
|
4299
|
-
inactiveTintColor
|
|
4300
|
-
}) {
|
|
4301
|
-
const { theme, isDark } = useTheme();
|
|
4302
|
-
const colors = useThemeColors();
|
|
4303
|
-
const activeBgColor = activeBackgroundColor || (isDark ? colors.primarySurface : theme.colors.primary?.[50] || "#fff7ed");
|
|
4304
|
-
const activeColor = activeTintColor || colors.primary;
|
|
4305
|
-
const inactiveColor = inactiveTintColor || (isDark ? "#d1d5db" : "#4b5563");
|
|
4306
|
-
const backgroundColor = colors.card;
|
|
4307
|
-
const dividerColor = colors.divider;
|
|
4308
|
-
const drawerItems = items || state.routes.map((route) => {
|
|
4309
|
-
const descriptor = descriptors[route.key];
|
|
4310
|
-
const options = descriptor.options;
|
|
4311
|
-
return {
|
|
4312
|
-
name: route.name,
|
|
4313
|
-
label: options.drawerLabel || options.title || route.name,
|
|
4314
|
-
icon: options.drawerIcon?.({ size: 24, color: inactiveColor })?.props?.name,
|
|
4315
|
-
badge: options.tabBarBadge
|
|
4316
|
-
};
|
|
4317
|
-
});
|
|
4318
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_drawer2.DrawerContentScrollView, { style: [styles14.container, { backgroundColor }], children: [
|
|
4319
|
-
header && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.header, { borderBottomColor: dividerColor }], children: header }),
|
|
4320
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppView, { className: "py-2", children: drawerItems.map((item) => {
|
|
4321
|
-
const isFocused = state.routes[state.index].name === item.name;
|
|
4322
|
-
const onPress = () => {
|
|
4323
|
-
navigation.navigate(item.name);
|
|
4324
|
-
};
|
|
4325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4326
|
-
import_react_native26.TouchableOpacity,
|
|
4327
|
-
{
|
|
4328
|
-
onPress,
|
|
4329
|
-
style: [styles14.item, isFocused && { backgroundColor: activeBgColor }],
|
|
4330
|
-
children: [
|
|
4331
|
-
item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: styles14.iconContainer, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4332
|
-
Icon,
|
|
4333
|
-
{
|
|
4334
|
-
name: item.icon,
|
|
4335
|
-
size: "md",
|
|
4336
|
-
color: isFocused ? activeColor : inactiveColor
|
|
4337
|
-
}
|
|
4338
|
-
) }),
|
|
4339
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4340
|
-
AppText,
|
|
4341
|
-
{
|
|
4342
|
-
style: [
|
|
4343
|
-
styles14.label,
|
|
4344
|
-
{ color: isFocused ? activeColor : inactiveColor },
|
|
4345
|
-
isFocused && styles14.activeLabel
|
|
4346
|
-
],
|
|
4347
|
-
numberOfLines: 1,
|
|
4348
|
-
children: item.label
|
|
4349
|
-
}
|
|
4350
|
-
),
|
|
4351
|
-
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppText, { style: styles14.badgeText, children: typeof item.badge === "number" && item.badge > 99 ? "99+" : item.badge }) })
|
|
4352
|
-
]
|
|
4353
|
-
},
|
|
4354
|
-
item.name
|
|
4355
|
-
);
|
|
4356
|
-
}) }),
|
|
4357
|
-
footer && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.footer, { borderTopColor: dividerColor }], children: footer })
|
|
4358
|
-
] });
|
|
4359
|
-
}
|
|
4360
|
-
var styles14 = import_react_native26.StyleSheet.create({
|
|
4361
|
-
container: {
|
|
4362
|
-
flex: 1
|
|
4363
|
-
},
|
|
4364
|
-
header: {
|
|
4365
|
-
padding: 16,
|
|
4366
|
-
borderBottomWidth: 0.5
|
|
4367
|
-
},
|
|
4368
|
-
item: {
|
|
4369
|
-
flexDirection: "row",
|
|
4370
|
-
alignItems: "center",
|
|
4371
|
-
paddingHorizontal: 16,
|
|
4372
|
-
paddingVertical: 12,
|
|
4373
|
-
marginHorizontal: 8,
|
|
4374
|
-
marginVertical: 2,
|
|
4375
|
-
borderRadius: 8
|
|
4376
|
-
},
|
|
4377
|
-
iconContainer: {
|
|
4378
|
-
width: 32,
|
|
4379
|
-
alignItems: "center",
|
|
4380
|
-
marginRight: 8
|
|
4381
|
-
},
|
|
4382
|
-
label: {
|
|
4383
|
-
flex: 1,
|
|
4384
|
-
fontSize: 16
|
|
4385
|
-
},
|
|
4386
|
-
activeLabel: {
|
|
4387
|
-
fontWeight: "600"
|
|
4388
|
-
},
|
|
4389
|
-
badge: {
|
|
4390
|
-
minWidth: 20,
|
|
4391
|
-
height: 20,
|
|
4392
|
-
borderRadius: 10,
|
|
4393
|
-
justifyContent: "center",
|
|
4394
|
-
alignItems: "center",
|
|
4395
|
-
paddingHorizontal: 6
|
|
4396
|
-
},
|
|
4397
|
-
badgeText: {
|
|
4398
|
-
color: "#fff",
|
|
4399
|
-
fontSize: 12,
|
|
4400
|
-
fontWeight: "bold"
|
|
4401
|
-
},
|
|
4402
|
-
footer: {
|
|
4403
|
-
marginTop: "auto",
|
|
4404
|
-
padding: 16,
|
|
4405
|
-
borderTopWidth: 0.5
|
|
4406
|
-
}
|
|
4407
|
-
});
|
|
4408
|
-
|
|
4409
|
-
// src/navigation/hooks/useNavigation.ts
|
|
4410
|
-
var import_react36 = require("react");
|
|
4411
|
-
var import_native2 = require("@react-navigation/native");
|
|
4412
|
-
function useNavigation() {
|
|
4413
|
-
return (0, import_native2.useNavigation)();
|
|
4414
|
-
}
|
|
4415
|
-
function useStackNavigation() {
|
|
4416
|
-
return (0, import_native2.useNavigation)();
|
|
4417
|
-
}
|
|
4418
|
-
function useTabNavigation() {
|
|
4419
|
-
return (0, import_native2.useNavigation)();
|
|
4420
|
-
}
|
|
4421
|
-
function useDrawerNavigation() {
|
|
4422
|
-
return (0, import_native2.useNavigation)();
|
|
4423
|
-
}
|
|
4424
|
-
function useBackHandler(handler) {
|
|
4425
|
-
const navigation = (0, import_native2.useNavigation)();
|
|
4426
|
-
(0, import_react36.useEffect)(() => {
|
|
4427
|
-
const unsubscribe = navigation.addListener("beforeRemove", (e) => {
|
|
4428
|
-
if (!handler()) {
|
|
4429
|
-
e.preventDefault();
|
|
4430
|
-
}
|
|
4431
|
-
});
|
|
4432
|
-
return unsubscribe;
|
|
4433
|
-
}, [navigation, handler]);
|
|
4434
|
-
}
|
|
4435
|
-
|
|
4436
|
-
// src/navigation/hooks/useRoute.ts
|
|
4437
|
-
var import_native3 = require("@react-navigation/native");
|
|
4438
|
-
function useRoute() {
|
|
4439
|
-
return (0, import_native3.useRoute)();
|
|
4440
|
-
}
|
|
4441
|
-
|
|
4442
|
-
// src/navigation/hooks/useNavigationState.ts
|
|
4443
|
-
var import_native4 = require("@react-navigation/native");
|
|
4444
|
-
function useNavigationState(selector) {
|
|
4445
|
-
return (0, import_native4.useNavigationState)(selector);
|
|
4446
|
-
}
|
|
4447
|
-
|
|
4448
|
-
// src/navigation/index.ts
|
|
4449
|
-
var import_native5 = require("@react-navigation/native");
|
|
4198
|
+
var import_react_native30 = require("react-native");
|
|
4199
|
+
var import_react_native_safe_area_context4 = require("react-native-safe-area-context");
|
|
4450
4200
|
|
|
4451
4201
|
// src/overlay/AppProvider.tsx
|
|
4452
|
-
var
|
|
4202
|
+
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
4453
4203
|
|
|
4454
4204
|
// src/overlay/AppStatusBar.tsx
|
|
4455
|
-
var
|
|
4456
|
-
var
|
|
4457
|
-
var
|
|
4205
|
+
var import_react_native25 = require("react-native");
|
|
4206
|
+
var import_native2 = require("@react-navigation/native");
|
|
4207
|
+
var import_jsx_runtime36 = require("nativewind/jsx-runtime");
|
|
4458
4208
|
function AppStatusBar({
|
|
4459
4209
|
barStyle = "auto",
|
|
4460
4210
|
backgroundColor,
|
|
@@ -4464,8 +4214,8 @@ function AppStatusBar({
|
|
|
4464
4214
|
const { theme, isDark } = useTheme();
|
|
4465
4215
|
const resolvedBarStyle = barStyle === "auto" ? isDark ? "light-content" : "dark-content" : barStyle;
|
|
4466
4216
|
const resolvedBackgroundColor = backgroundColor ?? (translucent ? "transparent" : theme.colors.background?.[500] || "#ffffff");
|
|
4467
|
-
return /* @__PURE__ */ (0,
|
|
4468
|
-
|
|
4217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
4218
|
+
import_react_native25.StatusBar,
|
|
4469
4219
|
{
|
|
4470
4220
|
barStyle: resolvedBarStyle,
|
|
4471
4221
|
backgroundColor: resolvedBackgroundColor,
|
|
@@ -4475,33 +4225,33 @@ function AppStatusBar({
|
|
|
4475
4225
|
);
|
|
4476
4226
|
}
|
|
4477
4227
|
function AppFocusedStatusBar(props) {
|
|
4478
|
-
const isFocused = (0,
|
|
4228
|
+
const isFocused = (0, import_native2.useIsFocused)();
|
|
4479
4229
|
if (!isFocused) return null;
|
|
4480
|
-
return /* @__PURE__ */ (0,
|
|
4230
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppStatusBar, { ...props });
|
|
4481
4231
|
}
|
|
4482
4232
|
|
|
4483
4233
|
// src/overlay/loading/provider.tsx
|
|
4484
|
-
var
|
|
4234
|
+
var import_react37 = require("react");
|
|
4485
4235
|
|
|
4486
4236
|
// src/overlay/loading/context.ts
|
|
4487
|
-
var
|
|
4488
|
-
var LoadingContext = (0,
|
|
4237
|
+
var import_react36 = require("react");
|
|
4238
|
+
var LoadingContext = (0, import_react36.createContext)(null);
|
|
4489
4239
|
function useLoadingContext() {
|
|
4490
|
-
const ctx = (0,
|
|
4240
|
+
const ctx = (0, import_react36.useContext)(LoadingContext);
|
|
4491
4241
|
if (!ctx) throw new Error("useLoading must be used within OverlayProvider");
|
|
4492
4242
|
return ctx;
|
|
4493
4243
|
}
|
|
4494
4244
|
|
|
4495
4245
|
// src/overlay/loading/component.tsx
|
|
4496
|
-
var
|
|
4497
|
-
var
|
|
4498
|
-
function LoadingModal({ visible, text }) {
|
|
4499
|
-
return /* @__PURE__ */ (0,
|
|
4500
|
-
/* @__PURE__ */ (0,
|
|
4501
|
-
text && /* @__PURE__ */ (0,
|
|
4246
|
+
var import_react_native26 = require("react-native");
|
|
4247
|
+
var import_jsx_runtime37 = require("nativewind/jsx-runtime");
|
|
4248
|
+
function LoadingModal({ visible, text }) {
|
|
4249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.Modal, { transparent: true, visible, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: styles13.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_native26.View, { style: [styles13.loadingBox, { backgroundColor: "rgba(0,0,0,0.8)" }], children: [
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.ActivityIndicator, { size: "large", color: "#fff" }),
|
|
4251
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppText, { className: "text-white mt-3 text-sm", children: text })
|
|
4502
4252
|
] }) }) });
|
|
4503
4253
|
}
|
|
4504
|
-
var
|
|
4254
|
+
var styles13 = import_react_native26.StyleSheet.create({
|
|
4505
4255
|
overlay: {
|
|
4506
4256
|
flex: 1,
|
|
4507
4257
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4517,45 +4267,45 @@ var styles15 = import_react_native28.StyleSheet.create({
|
|
|
4517
4267
|
});
|
|
4518
4268
|
|
|
4519
4269
|
// src/overlay/loading/provider.tsx
|
|
4520
|
-
var
|
|
4270
|
+
var import_jsx_runtime38 = require("nativewind/jsx-runtime");
|
|
4521
4271
|
function LoadingProvider({ children }) {
|
|
4522
|
-
const [state, setState] = (0,
|
|
4523
|
-
const show = (0,
|
|
4272
|
+
const [state, setState] = (0, import_react37.useState)({ visible: false });
|
|
4273
|
+
const show = (0, import_react37.useCallback)((text) => {
|
|
4524
4274
|
setState({ visible: true, text });
|
|
4525
4275
|
}, []);
|
|
4526
|
-
const hide = (0,
|
|
4276
|
+
const hide = (0, import_react37.useCallback)(() => {
|
|
4527
4277
|
setState({ visible: false });
|
|
4528
4278
|
}, []);
|
|
4529
|
-
return /* @__PURE__ */ (0,
|
|
4279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(LoadingContext.Provider, { value: { show, hide }, children: [
|
|
4530
4280
|
children,
|
|
4531
|
-
/* @__PURE__ */ (0,
|
|
4281
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(LoadingModal, { ...state })
|
|
4532
4282
|
] });
|
|
4533
4283
|
}
|
|
4534
4284
|
|
|
4535
4285
|
// src/overlay/toast/provider.tsx
|
|
4536
|
-
var
|
|
4537
|
-
var
|
|
4286
|
+
var import_react40 = require("react");
|
|
4287
|
+
var import_react_native28 = require("react-native");
|
|
4538
4288
|
|
|
4539
4289
|
// src/overlay/toast/context.ts
|
|
4540
|
-
var
|
|
4541
|
-
var ToastContext = (0,
|
|
4290
|
+
var import_react38 = require("react");
|
|
4291
|
+
var ToastContext = (0, import_react38.createContext)(null);
|
|
4542
4292
|
function useToastContext() {
|
|
4543
|
-
const ctx = (0,
|
|
4293
|
+
const ctx = (0, import_react38.useContext)(ToastContext);
|
|
4544
4294
|
if (!ctx) throw new Error("useToast must be used within OverlayProvider");
|
|
4545
4295
|
return ctx;
|
|
4546
4296
|
}
|
|
4547
4297
|
|
|
4548
4298
|
// src/overlay/toast/component.tsx
|
|
4549
|
-
var
|
|
4550
|
-
var
|
|
4551
|
-
var
|
|
4299
|
+
var import_react39 = require("react");
|
|
4300
|
+
var import_react_native27 = require("react-native");
|
|
4301
|
+
var import_jsx_runtime39 = require("nativewind/jsx-runtime");
|
|
4552
4302
|
function ToastItemView({ message, type, onHide }) {
|
|
4553
|
-
const fadeAnim = (0,
|
|
4554
|
-
(0,
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4303
|
+
const fadeAnim = (0, import_react39.useRef)(new import_react_native27.Animated.Value(0)).current;
|
|
4304
|
+
(0, import_react39.useEffect)(() => {
|
|
4305
|
+
import_react_native27.Animated.sequence([
|
|
4306
|
+
import_react_native27.Animated.timing(fadeAnim, { toValue: 1, duration: 200, useNativeDriver: true }),
|
|
4307
|
+
import_react_native27.Animated.delay(2500),
|
|
4308
|
+
import_react_native27.Animated.timing(fadeAnim, { toValue: 0, duration: 200, useNativeDriver: true })
|
|
4559
4309
|
]).start(onHide);
|
|
4560
4310
|
}, []);
|
|
4561
4311
|
const bgColors = {
|
|
@@ -4564,8 +4314,8 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4564
4314
|
warning: "bg-warning-500",
|
|
4565
4315
|
info: "bg-primary-500"
|
|
4566
4316
|
};
|
|
4567
|
-
return /* @__PURE__ */ (0,
|
|
4568
|
-
|
|
4317
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4318
|
+
import_react_native27.Animated.View,
|
|
4569
4319
|
{
|
|
4570
4320
|
style: {
|
|
4571
4321
|
opacity: fadeAnim,
|
|
@@ -4578,17 +4328,17 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4578
4328
|
}
|
|
4579
4329
|
]
|
|
4580
4330
|
},
|
|
4581
|
-
children: /* @__PURE__ */ (0,
|
|
4331
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppView, { className: `${bgColors[type]} px-4 py-3 rounded-lg mb-2 mx-4 shadow-lg`, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppText, { className: "text-white text-center", children: message }) })
|
|
4582
4332
|
}
|
|
4583
4333
|
);
|
|
4584
4334
|
}
|
|
4585
4335
|
|
|
4586
4336
|
// src/overlay/toast/provider.tsx
|
|
4587
|
-
var
|
|
4337
|
+
var import_jsx_runtime40 = require("nativewind/jsx-runtime");
|
|
4588
4338
|
function ToastProvider({ children }) {
|
|
4589
|
-
const [toasts, setToasts] = (0,
|
|
4590
|
-
const timersRef = (0,
|
|
4591
|
-
const remove = (0,
|
|
4339
|
+
const [toasts, setToasts] = (0, import_react40.useState)([]);
|
|
4340
|
+
const timersRef = (0, import_react40.useRef)(/* @__PURE__ */ new Map());
|
|
4341
|
+
const remove = (0, import_react40.useCallback)((id) => {
|
|
4592
4342
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
4593
4343
|
const timer = timersRef.current.get(id);
|
|
4594
4344
|
if (timer) {
|
|
@@ -4596,7 +4346,7 @@ function ToastProvider({ children }) {
|
|
|
4596
4346
|
timersRef.current.delete(id);
|
|
4597
4347
|
}
|
|
4598
4348
|
}, []);
|
|
4599
|
-
const show = (0,
|
|
4349
|
+
const show = (0, import_react40.useCallback)(
|
|
4600
4350
|
(message, type = "info", duration = 3e3) => {
|
|
4601
4351
|
const id = Math.random().toString(36).substring(7);
|
|
4602
4352
|
const toast = { id, message, type, duration };
|
|
@@ -4606,28 +4356,28 @@ function ToastProvider({ children }) {
|
|
|
4606
4356
|
},
|
|
4607
4357
|
[remove]
|
|
4608
4358
|
);
|
|
4609
|
-
const success = (0,
|
|
4359
|
+
const success = (0, import_react40.useCallback)(
|
|
4610
4360
|
(message, duration) => show(message, "success", duration),
|
|
4611
4361
|
[show]
|
|
4612
4362
|
);
|
|
4613
|
-
const error = (0,
|
|
4363
|
+
const error = (0, import_react40.useCallback)(
|
|
4614
4364
|
(message, duration) => show(message, "error", duration),
|
|
4615
4365
|
[show]
|
|
4616
4366
|
);
|
|
4617
|
-
const info = (0,
|
|
4367
|
+
const info = (0, import_react40.useCallback)(
|
|
4618
4368
|
(message, duration) => show(message, "info", duration),
|
|
4619
4369
|
[show]
|
|
4620
4370
|
);
|
|
4621
|
-
const warning = (0,
|
|
4371
|
+
const warning = (0, import_react40.useCallback)(
|
|
4622
4372
|
(message, duration) => show(message, "warning", duration),
|
|
4623
4373
|
[show]
|
|
4624
4374
|
);
|
|
4625
|
-
return /* @__PURE__ */ (0,
|
|
4375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(ToastContext.Provider, { value: { show, success, error, info, warning }, children: [
|
|
4626
4376
|
children,
|
|
4627
|
-
/* @__PURE__ */ (0,
|
|
4377
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_react_native28.View, { style: styles14.toastContainer, pointerEvents: "none", children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ToastItemView, { ...toast, onHide: () => remove(toast.id) }, toast.id)) })
|
|
4628
4378
|
] });
|
|
4629
4379
|
}
|
|
4630
|
-
var
|
|
4380
|
+
var styles14 = import_react_native28.StyleSheet.create({
|
|
4631
4381
|
toastContainer: {
|
|
4632
4382
|
position: "absolute",
|
|
4633
4383
|
top: 60,
|
|
@@ -4638,20 +4388,20 @@ var styles16 = import_react_native30.StyleSheet.create({
|
|
|
4638
4388
|
});
|
|
4639
4389
|
|
|
4640
4390
|
// src/overlay/alert/provider.tsx
|
|
4641
|
-
var
|
|
4391
|
+
var import_react42 = require("react");
|
|
4642
4392
|
|
|
4643
4393
|
// src/overlay/alert/context.ts
|
|
4644
|
-
var
|
|
4645
|
-
var AlertContext = (0,
|
|
4394
|
+
var import_react41 = require("react");
|
|
4395
|
+
var AlertContext = (0, import_react41.createContext)(null);
|
|
4646
4396
|
function useAlertContext() {
|
|
4647
|
-
const ctx = (0,
|
|
4397
|
+
const ctx = (0, import_react41.useContext)(AlertContext);
|
|
4648
4398
|
if (!ctx) throw new Error("useAlert must be used within OverlayProvider");
|
|
4649
4399
|
return ctx;
|
|
4650
4400
|
}
|
|
4651
4401
|
|
|
4652
4402
|
// src/overlay/alert/component.tsx
|
|
4653
|
-
var
|
|
4654
|
-
var
|
|
4403
|
+
var import_react_native29 = require("react-native");
|
|
4404
|
+
var import_jsx_runtime41 = require("nativewind/jsx-runtime");
|
|
4655
4405
|
function AlertModal({
|
|
4656
4406
|
visible,
|
|
4657
4407
|
title,
|
|
@@ -4663,16 +4413,16 @@ function AlertModal({
|
|
|
4663
4413
|
onCancel
|
|
4664
4414
|
}) {
|
|
4665
4415
|
if (!visible) return null;
|
|
4666
|
-
return /* @__PURE__ */ (0,
|
|
4667
|
-
title && /* @__PURE__ */ (0,
|
|
4668
|
-
message && /* @__PURE__ */ (0,
|
|
4669
|
-
/* @__PURE__ */ (0,
|
|
4670
|
-
showCancel && /* @__PURE__ */ (0,
|
|
4671
|
-
/* @__PURE__ */ (0,
|
|
4416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native29.Modal, { transparent: true, visible: true, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react_native29.View, { style: styles15.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native29.View, { style: styles15.alertBox, children: [
|
|
4417
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppText, { className: "text-lg font-semibold text-center mb-2", children: title }),
|
|
4418
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppText, { className: "text-gray-600 text-center mb-4", children: message }),
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(AppView, { row: true, gap: 3, className: "mt-2", children: [
|
|
4420
|
+
showCancel && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppPressable, { onPress: onCancel, className: "flex-1 py-3 bg-gray-100 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppText, { className: "text-center text-gray-700", children: cancelText || "\u53D6\u6D88" }) }),
|
|
4421
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppPressable, { onPress: onConfirm, className: "flex-1 py-3 bg-primary-500 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppText, { className: "text-center text-white", children: confirmText || "\u786E\u5B9A" }) })
|
|
4672
4422
|
] })
|
|
4673
4423
|
] }) }) });
|
|
4674
4424
|
}
|
|
4675
|
-
var
|
|
4425
|
+
var styles15 = import_react_native29.StyleSheet.create({
|
|
4676
4426
|
overlay: {
|
|
4677
4427
|
flex: 1,
|
|
4678
4428
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4694,32 +4444,32 @@ var styles17 = import_react_native31.StyleSheet.create({
|
|
|
4694
4444
|
});
|
|
4695
4445
|
|
|
4696
4446
|
// src/overlay/alert/provider.tsx
|
|
4697
|
-
var
|
|
4447
|
+
var import_jsx_runtime42 = require("nativewind/jsx-runtime");
|
|
4698
4448
|
function AlertProvider({ children }) {
|
|
4699
|
-
const [alert, setAlert] = (0,
|
|
4700
|
-
const showAlert = (0,
|
|
4449
|
+
const [alert, setAlert] = (0, import_react42.useState)(null);
|
|
4450
|
+
const showAlert = (0, import_react42.useCallback)((options) => {
|
|
4701
4451
|
setAlert({ ...options, visible: true });
|
|
4702
4452
|
}, []);
|
|
4703
|
-
const confirm = (0,
|
|
4453
|
+
const confirm = (0, import_react42.useCallback)(
|
|
4704
4454
|
(options) => {
|
|
4705
4455
|
showAlert({ ...options, showCancel: true });
|
|
4706
4456
|
},
|
|
4707
4457
|
[showAlert]
|
|
4708
4458
|
);
|
|
4709
|
-
const hide = (0,
|
|
4459
|
+
const hide = (0, import_react42.useCallback)(() => {
|
|
4710
4460
|
setAlert(null);
|
|
4711
4461
|
}, []);
|
|
4712
|
-
const handleConfirm = (0,
|
|
4462
|
+
const handleConfirm = (0, import_react42.useCallback)(() => {
|
|
4713
4463
|
alert?.onConfirm?.();
|
|
4714
4464
|
hide();
|
|
4715
4465
|
}, [alert, hide]);
|
|
4716
|
-
const handleCancel = (0,
|
|
4466
|
+
const handleCancel = (0, import_react42.useCallback)(() => {
|
|
4717
4467
|
alert?.onCancel?.();
|
|
4718
4468
|
hide();
|
|
4719
4469
|
}, [alert, hide]);
|
|
4720
|
-
return /* @__PURE__ */ (0,
|
|
4470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(AlertContext.Provider, { value: { alert: showAlert, confirm }, children: [
|
|
4721
4471
|
children,
|
|
4722
|
-
/* @__PURE__ */ (0,
|
|
4472
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
4723
4473
|
AlertModal,
|
|
4724
4474
|
{
|
|
4725
4475
|
visible: alert?.visible ?? false,
|
|
@@ -4736,13 +4486,13 @@ function AlertProvider({ children }) {
|
|
|
4736
4486
|
}
|
|
4737
4487
|
|
|
4738
4488
|
// src/overlay/provider.tsx
|
|
4739
|
-
var
|
|
4489
|
+
var import_jsx_runtime43 = require("nativewind/jsx-runtime");
|
|
4740
4490
|
function OverlayProvider({ children }) {
|
|
4741
|
-
return /* @__PURE__ */ (0,
|
|
4491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(LoadingProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ToastProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AlertProvider, { children }) }) });
|
|
4742
4492
|
}
|
|
4743
4493
|
|
|
4744
4494
|
// src/overlay/AppProvider.tsx
|
|
4745
|
-
var
|
|
4495
|
+
var import_jsx_runtime44 = require("nativewind/jsx-runtime");
|
|
4746
4496
|
var defaultLightTheme = {
|
|
4747
4497
|
colors: {
|
|
4748
4498
|
primary: "#f38b32",
|
|
@@ -4779,21 +4529,21 @@ function AppProvider({
|
|
|
4779
4529
|
}) {
|
|
4780
4530
|
let content = children;
|
|
4781
4531
|
if (enableOverlay) {
|
|
4782
|
-
content = /* @__PURE__ */ (0,
|
|
4532
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(OverlayProvider, { children: content });
|
|
4783
4533
|
}
|
|
4784
4534
|
if (enableNavigation) {
|
|
4785
|
-
content = /* @__PURE__ */ (0,
|
|
4535
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(NavigationProvider, { ...navigationProps, children: content });
|
|
4786
4536
|
}
|
|
4787
4537
|
if (enableTheme) {
|
|
4788
|
-
content = /* @__PURE__ */ (0,
|
|
4789
|
-
enableStatusBar && /* @__PURE__ */ (0,
|
|
4538
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ThemeProvider, { light: lightTheme, dark: darkTheme, defaultDark, isDark, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
|
|
4539
|
+
enableStatusBar && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(AppStatusBar, { testID: "status-bar", ...statusBarProps }),
|
|
4790
4540
|
content
|
|
4791
4541
|
] }) });
|
|
4792
4542
|
}
|
|
4793
4543
|
if (enableSafeArea) {
|
|
4794
|
-
content = /* @__PURE__ */ (0,
|
|
4544
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react_native_safe_area_context3.SafeAreaProvider, { children: content });
|
|
4795
4545
|
}
|
|
4796
|
-
return /* @__PURE__ */ (0,
|
|
4546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: content });
|
|
4797
4547
|
}
|
|
4798
4548
|
|
|
4799
4549
|
// src/overlay/loading/hooks.ts
|
|
@@ -4811,6 +4561,280 @@ function useAlert() {
|
|
|
4811
4561
|
return useAlertContext();
|
|
4812
4562
|
}
|
|
4813
4563
|
|
|
4564
|
+
// src/navigation/components/AppHeader.tsx
|
|
4565
|
+
var import_jsx_runtime45 = require("nativewind/jsx-runtime");
|
|
4566
|
+
function AppHeader({
|
|
4567
|
+
title,
|
|
4568
|
+
subtitle,
|
|
4569
|
+
leftIcon = "chevron-left",
|
|
4570
|
+
onLeftPress,
|
|
4571
|
+
rightIcons = [],
|
|
4572
|
+
transparent = false,
|
|
4573
|
+
safeArea = true,
|
|
4574
|
+
style
|
|
4575
|
+
}) {
|
|
4576
|
+
const colors = useThemeColors();
|
|
4577
|
+
const insets = (0, import_react_native_safe_area_context4.useSafeAreaInsets)();
|
|
4578
|
+
const backgroundColor = transparent ? "transparent" : colors.card;
|
|
4579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
4580
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppFocusedStatusBar, { translucent: true, backgroundColor: "transparent" }),
|
|
4581
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4582
|
+
AppView,
|
|
4583
|
+
{
|
|
4584
|
+
style: [
|
|
4585
|
+
{
|
|
4586
|
+
backgroundColor,
|
|
4587
|
+
paddingTop: safeArea ? insets.top : 0
|
|
4588
|
+
},
|
|
4589
|
+
style
|
|
4590
|
+
],
|
|
4591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AppView, { row: true, items: "center", px: 4, style: styles16.container, children: [
|
|
4592
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppView, { style: [styles16.sideContainer, styles16.leftContainer], children: leftIcon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppPressable, { onPress: onLeftPress, style: styles16.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: leftIcon, size: 24, color: colors.text }) }) }),
|
|
4593
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AppView, { style: styles16.centerContainer, children: [
|
|
4594
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4595
|
+
AppText,
|
|
4596
|
+
{
|
|
4597
|
+
size: "lg",
|
|
4598
|
+
weight: "semibold",
|
|
4599
|
+
style: [styles16.title, { color: colors.text }],
|
|
4600
|
+
numberOfLines: 1,
|
|
4601
|
+
children: title
|
|
4602
|
+
}
|
|
4603
|
+
),
|
|
4604
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4605
|
+
AppText,
|
|
4606
|
+
{
|
|
4607
|
+
size: "xs",
|
|
4608
|
+
style: [styles16.subtitle, { color: colors.textMuted }],
|
|
4609
|
+
numberOfLines: 1,
|
|
4610
|
+
children: subtitle
|
|
4611
|
+
}
|
|
4612
|
+
)
|
|
4613
|
+
] }),
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppView, { row: true, items: "center", style: [styles16.sideContainer, styles16.rightContainer], children: rightIcons.map((icon, index) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppPressable, { onPress: icon.onPress, style: styles16.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(AppView, { children: [
|
|
4615
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: icon.icon, size: 24, color: colors.text }),
|
|
4616
|
+
icon.badge ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppView, { style: styles16.badge, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AppText, { size: "xs", color: "white", style: styles16.badgeText, children: icon.badge > 99 ? "99+" : icon.badge }) }) : null
|
|
4617
|
+
] }) }, index)) })
|
|
4618
|
+
] })
|
|
4619
|
+
}
|
|
4620
|
+
)
|
|
4621
|
+
] });
|
|
4622
|
+
}
|
|
4623
|
+
var styles16 = import_react_native30.StyleSheet.create({
|
|
4624
|
+
container: {
|
|
4625
|
+
height: 44
|
|
4626
|
+
// iOS 标准导航栏高度
|
|
4627
|
+
},
|
|
4628
|
+
sideContainer: {
|
|
4629
|
+
width: 70,
|
|
4630
|
+
// 固定宽度,确保标题居中
|
|
4631
|
+
flexDirection: "row",
|
|
4632
|
+
alignItems: "center"
|
|
4633
|
+
},
|
|
4634
|
+
leftContainer: {
|
|
4635
|
+
justifyContent: "flex-start"
|
|
4636
|
+
},
|
|
4637
|
+
rightContainer: {
|
|
4638
|
+
justifyContent: "flex-end"
|
|
4639
|
+
},
|
|
4640
|
+
centerContainer: {
|
|
4641
|
+
flex: 1,
|
|
4642
|
+
alignItems: "center",
|
|
4643
|
+
justifyContent: "center"
|
|
4644
|
+
},
|
|
4645
|
+
title: {
|
|
4646
|
+
textAlign: "center"
|
|
4647
|
+
},
|
|
4648
|
+
subtitle: {
|
|
4649
|
+
textAlign: "center",
|
|
4650
|
+
marginTop: 2
|
|
4651
|
+
},
|
|
4652
|
+
iconButton: {
|
|
4653
|
+
padding: 8
|
|
4654
|
+
},
|
|
4655
|
+
badge: {
|
|
4656
|
+
position: "absolute",
|
|
4657
|
+
top: -4,
|
|
4658
|
+
right: -4,
|
|
4659
|
+
minWidth: 16,
|
|
4660
|
+
height: 16,
|
|
4661
|
+
borderRadius: 8,
|
|
4662
|
+
backgroundColor: "#ef4444",
|
|
4663
|
+
alignItems: "center",
|
|
4664
|
+
justifyContent: "center",
|
|
4665
|
+
paddingHorizontal: 4
|
|
4666
|
+
},
|
|
4667
|
+
badgeText: {
|
|
4668
|
+
fontSize: 10,
|
|
4669
|
+
fontWeight: "bold"
|
|
4670
|
+
}
|
|
4671
|
+
});
|
|
4672
|
+
|
|
4673
|
+
// src/navigation/components/DrawerContent.tsx
|
|
4674
|
+
var import_react_native31 = require("react-native");
|
|
4675
|
+
var import_drawer2 = require("@react-navigation/drawer");
|
|
4676
|
+
var import_jsx_runtime46 = require("nativewind/jsx-runtime");
|
|
4677
|
+
function DrawerContent({
|
|
4678
|
+
state,
|
|
4679
|
+
descriptors,
|
|
4680
|
+
navigation,
|
|
4681
|
+
header,
|
|
4682
|
+
footer,
|
|
4683
|
+
items,
|
|
4684
|
+
activeBackgroundColor,
|
|
4685
|
+
activeTintColor,
|
|
4686
|
+
inactiveTintColor
|
|
4687
|
+
}) {
|
|
4688
|
+
const { theme, isDark } = useTheme();
|
|
4689
|
+
const colors = useThemeColors();
|
|
4690
|
+
const activeBgColor = activeBackgroundColor || (isDark ? colors.primarySurface : theme.colors.primary?.[50] || "#fff7ed");
|
|
4691
|
+
const activeColor = activeTintColor || colors.primary;
|
|
4692
|
+
const inactiveColor = inactiveTintColor || (isDark ? "#d1d5db" : "#4b5563");
|
|
4693
|
+
const backgroundColor = colors.card;
|
|
4694
|
+
const dividerColor = colors.divider;
|
|
4695
|
+
const drawerItems = items || state.routes.map((route) => {
|
|
4696
|
+
const descriptor = descriptors[route.key];
|
|
4697
|
+
const options = descriptor.options;
|
|
4698
|
+
return {
|
|
4699
|
+
name: route.name,
|
|
4700
|
+
label: options.drawerLabel || options.title || route.name,
|
|
4701
|
+
icon: options.drawerIcon?.({ size: 24, color: inactiveColor })?.props?.name,
|
|
4702
|
+
badge: options.tabBarBadge
|
|
4703
|
+
};
|
|
4704
|
+
});
|
|
4705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_drawer2.DrawerContentScrollView, { style: [styles17.container, { backgroundColor }], children: [
|
|
4706
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native31.View, { style: [styles17.header, { borderBottomColor: dividerColor }], children: header }),
|
|
4707
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AppView, { className: "py-2", children: drawerItems.map((item) => {
|
|
4708
|
+
const isFocused = state.routes[state.index].name === item.name;
|
|
4709
|
+
const onPress = () => {
|
|
4710
|
+
navigation.navigate(item.name);
|
|
4711
|
+
};
|
|
4712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
4713
|
+
import_react_native31.TouchableOpacity,
|
|
4714
|
+
{
|
|
4715
|
+
onPress,
|
|
4716
|
+
style: [styles17.item, isFocused && { backgroundColor: activeBgColor }],
|
|
4717
|
+
children: [
|
|
4718
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native31.View, { style: styles17.iconContainer, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4719
|
+
Icon,
|
|
4720
|
+
{
|
|
4721
|
+
name: item.icon,
|
|
4722
|
+
size: "md",
|
|
4723
|
+
color: isFocused ? activeColor : inactiveColor
|
|
4724
|
+
}
|
|
4725
|
+
) }),
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
4727
|
+
AppText,
|
|
4728
|
+
{
|
|
4729
|
+
style: [
|
|
4730
|
+
styles17.label,
|
|
4731
|
+
{ color: isFocused ? activeColor : inactiveColor },
|
|
4732
|
+
isFocused && styles17.activeLabel
|
|
4733
|
+
],
|
|
4734
|
+
numberOfLines: 1,
|
|
4735
|
+
children: item.label
|
|
4736
|
+
}
|
|
4737
|
+
),
|
|
4738
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native31.View, { style: [styles17.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AppText, { style: styles17.badgeText, children: typeof item.badge === "number" && item.badge > 99 ? "99+" : item.badge }) })
|
|
4739
|
+
]
|
|
4740
|
+
},
|
|
4741
|
+
item.name
|
|
4742
|
+
);
|
|
4743
|
+
}) }),
|
|
4744
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native31.View, { style: [styles17.footer, { borderTopColor: dividerColor }], children: footer })
|
|
4745
|
+
] });
|
|
4746
|
+
}
|
|
4747
|
+
var styles17 = import_react_native31.StyleSheet.create({
|
|
4748
|
+
container: {
|
|
4749
|
+
flex: 1
|
|
4750
|
+
},
|
|
4751
|
+
header: {
|
|
4752
|
+
padding: 16,
|
|
4753
|
+
borderBottomWidth: 0.5
|
|
4754
|
+
},
|
|
4755
|
+
item: {
|
|
4756
|
+
flexDirection: "row",
|
|
4757
|
+
alignItems: "center",
|
|
4758
|
+
paddingHorizontal: 16,
|
|
4759
|
+
paddingVertical: 12,
|
|
4760
|
+
marginHorizontal: 8,
|
|
4761
|
+
marginVertical: 2,
|
|
4762
|
+
borderRadius: 8
|
|
4763
|
+
},
|
|
4764
|
+
iconContainer: {
|
|
4765
|
+
width: 32,
|
|
4766
|
+
alignItems: "center",
|
|
4767
|
+
marginRight: 8
|
|
4768
|
+
},
|
|
4769
|
+
label: {
|
|
4770
|
+
flex: 1,
|
|
4771
|
+
fontSize: 16
|
|
4772
|
+
},
|
|
4773
|
+
activeLabel: {
|
|
4774
|
+
fontWeight: "600"
|
|
4775
|
+
},
|
|
4776
|
+
badge: {
|
|
4777
|
+
minWidth: 20,
|
|
4778
|
+
height: 20,
|
|
4779
|
+
borderRadius: 10,
|
|
4780
|
+
justifyContent: "center",
|
|
4781
|
+
alignItems: "center",
|
|
4782
|
+
paddingHorizontal: 6
|
|
4783
|
+
},
|
|
4784
|
+
badgeText: {
|
|
4785
|
+
color: "#fff",
|
|
4786
|
+
fontSize: 12,
|
|
4787
|
+
fontWeight: "bold"
|
|
4788
|
+
},
|
|
4789
|
+
footer: {
|
|
4790
|
+
marginTop: "auto",
|
|
4791
|
+
padding: 16,
|
|
4792
|
+
borderTopWidth: 0.5
|
|
4793
|
+
}
|
|
4794
|
+
});
|
|
4795
|
+
|
|
4796
|
+
// src/navigation/hooks/useNavigation.ts
|
|
4797
|
+
var import_react43 = require("react");
|
|
4798
|
+
var import_native3 = require("@react-navigation/native");
|
|
4799
|
+
function useNavigation() {
|
|
4800
|
+
return (0, import_native3.useNavigation)();
|
|
4801
|
+
}
|
|
4802
|
+
function useStackNavigation() {
|
|
4803
|
+
return (0, import_native3.useNavigation)();
|
|
4804
|
+
}
|
|
4805
|
+
function useTabNavigation() {
|
|
4806
|
+
return (0, import_native3.useNavigation)();
|
|
4807
|
+
}
|
|
4808
|
+
function useDrawerNavigation() {
|
|
4809
|
+
return (0, import_native3.useNavigation)();
|
|
4810
|
+
}
|
|
4811
|
+
function useBackHandler(handler) {
|
|
4812
|
+
const navigation = (0, import_native3.useNavigation)();
|
|
4813
|
+
(0, import_react43.useEffect)(() => {
|
|
4814
|
+
const unsubscribe = navigation.addListener("beforeRemove", (e) => {
|
|
4815
|
+
if (!handler()) {
|
|
4816
|
+
e.preventDefault();
|
|
4817
|
+
}
|
|
4818
|
+
});
|
|
4819
|
+
return unsubscribe;
|
|
4820
|
+
}, [navigation, handler]);
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4823
|
+
// src/navigation/hooks/useRoute.ts
|
|
4824
|
+
var import_native4 = require("@react-navigation/native");
|
|
4825
|
+
function useRoute() {
|
|
4826
|
+
return (0, import_native4.useRoute)();
|
|
4827
|
+
}
|
|
4828
|
+
|
|
4829
|
+
// src/navigation/hooks/useNavigationState.ts
|
|
4830
|
+
var import_native5 = require("@react-navigation/native");
|
|
4831
|
+
function useNavigationState(selector) {
|
|
4832
|
+
return (0, import_native5.useNavigationState)(selector);
|
|
4833
|
+
}
|
|
4834
|
+
|
|
4835
|
+
// src/navigation/index.ts
|
|
4836
|
+
var import_native6 = require("@react-navigation/native");
|
|
4837
|
+
|
|
4814
4838
|
// src/index.ts
|
|
4815
4839
|
var import_react_native_safe_area_context5 = require("react-native-safe-area-context");
|
|
4816
4840
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -4829,6 +4853,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4829
4853
|
AppScrollView,
|
|
4830
4854
|
AppStatusBar,
|
|
4831
4855
|
AppText,
|
|
4856
|
+
AppTextInput,
|
|
4832
4857
|
AppView,
|
|
4833
4858
|
BottomTabBar,
|
|
4834
4859
|
Card,
|