@gaozh1024/rn-kit 0.2.0-beta.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.
@@ -0,0 +1,3465 @@
1
+ import { ClassValue } from 'clsx';
2
+ export { ClassValue, clsx } from 'clsx';
3
+ import { ZodError, z, ZodSchema } from 'zod';
4
+ export { z } from 'zod';
5
+ import * as react_jsx_runtime from 'react/jsx-runtime';
6
+ import * as React$1 from 'react';
7
+ import React__default from 'react';
8
+ export { useMutation, useQuery } from '@tanstack/react-query';
9
+ import { ViewProps, ScrollViewProps, TextProps, PressableProps, StyleProp, TextStyle, ImageSourcePropType, ImageStyle, ListRenderItem, ViewStyle, TextInputProps, TextInput, StatusBarProps, StatusBarStyle } from 'react-native';
10
+ import * as _react_navigation_native from '@react-navigation/native';
11
+ import { LinkingOptions, Theme as Theme$1, NavigationProp, ParamListBase as ParamListBase$1, RouteProp, NavigationState } from '@react-navigation/native';
12
+ export { NavigationContainer, NavigationContainerRef, NavigationProp, NavigationState, RouteProp, useFocusEffect, useIsFocused, useScrollToTop } from '@react-navigation/native';
13
+ import * as _react_navigation_stack from '@react-navigation/stack';
14
+ import { StackNavigationProp, StackScreenProps as StackScreenProps$1 } from '@react-navigation/stack';
15
+ export { StackNavigationProp as NativeStackNavigationProp, StackScreenProps as NativeStackScreenProps } from '@react-navigation/stack';
16
+ import * as _react_navigation_routers from '@react-navigation/routers';
17
+ import * as _react_navigation_bottom_tabs from '@react-navigation/bottom-tabs';
18
+ import { BottomTabNavigationProp, BottomTabScreenProps, BottomTabBarProps } from '@react-navigation/bottom-tabs';
19
+ export { BottomTabNavigationProp, BottomTabScreenProps } from '@react-navigation/bottom-tabs';
20
+ import * as _react_navigation_drawer from '@react-navigation/drawer';
21
+ import { DrawerNavigationProp, DrawerScreenProps as DrawerScreenProps$1, DrawerContentComponentProps } from '@react-navigation/drawer';
22
+ export { DrawerNavigationProp, DrawerScreenProps as NativeDrawerScreenProps } from '@react-navigation/drawer';
23
+ export { SafeAreaProvider } from 'react-native-safe-area-context';
24
+ export { twMerge } from 'tailwind-merge';
25
+
26
+ /**
27
+ * 合并 Tailwind CSS 类名,自动处理类名冲突
28
+ *
29
+ * 使用 clsx 进行条件类名合并,使用 tailwind-merge 解决 Tailwind 类名冲突
30
+ *
31
+ * @param inputs - 要合并的类名数组,支持字符串、对象、数组等多种格式
32
+ * @returns 合并后的类名字符串
33
+ * @example
34
+ * ```ts
35
+ * cn('px-4 py-2', 'bg-blue-500', { 'text-white': true })
36
+ * // => 'px-4 py-2 bg-blue-500 text-white'
37
+ *
38
+ * cn('px-4', 'px-6') // 后者覆盖前者
39
+ * // => 'px-6'
40
+ * ```
41
+ */
42
+ declare function cn(...inputs: ClassValue[]): string;
43
+
44
+ /**
45
+ * RGB 颜色对象
46
+ */
47
+ interface RgbObject {
48
+ /** 红色通道值 (0-255) */
49
+ r: number;
50
+ /** 绿色通道值 (0-255) */
51
+ g: number;
52
+ /** 蓝色通道值 (0-255) */
53
+ b: number;
54
+ }
55
+ /**
56
+ * 调色板对象,包含从 0 到 950 的色阶
57
+ * 兼容 Record<string, string> 类型
58
+ */
59
+ interface ColorPalette$1 {
60
+ /** 最亮色 */
61
+ 0: string;
62
+ /** 50 色阶 */
63
+ 50: string;
64
+ /** 100 色阶 */
65
+ 100: string;
66
+ /** 200 色阶 */
67
+ 200: string;
68
+ /** 300 色阶 */
69
+ 300: string;
70
+ /** 400 色阶 */
71
+ 400: string;
72
+ /** 500 色阶(基准色) */
73
+ 500: string;
74
+ /** 600 色阶 */
75
+ 600: string;
76
+ /** 700 色阶 */
77
+ 700: string;
78
+ /** 800 色阶 */
79
+ 800: string;
80
+ /** 900 色阶 */
81
+ 900: string;
82
+ /** 最暗色 */
83
+ 950: string;
84
+ /** 索引签名,兼容 Record<string, string> */
85
+ [key: string]: string;
86
+ }
87
+ /**
88
+ * 将十六进制颜色转换为 RGB 对象
89
+ *
90
+ * @param hex - 十六进制颜色字符串(如 '#FF5733' 或 'FF5733')
91
+ * @returns RGB 颜色对象
92
+ * @example
93
+ * ```ts
94
+ * hexToRgb('#FF5733')
95
+ * // => { r: 255, g: 87, b: 51 }
96
+ * ```
97
+ */
98
+ declare function hexToRgb(hex: string): RgbObject;
99
+ /**
100
+ * 将 RGB 对象转换为十六进制颜色字符串
101
+ *
102
+ * @param rgb - RGB 颜色对象
103
+ * @returns 十六进制颜色字符串(如 '#FF5733')
104
+ * @example
105
+ * ```ts
106
+ * rgbToHex({ r: 255, g: 87, b: 51 })
107
+ * // => '#ff5733'
108
+ * ```
109
+ */
110
+ declare function rgbToHex(rgb: RgbObject): string;
111
+ /**
112
+ * 调整 RGB 颜色的亮度
113
+ *
114
+ * @param rgb - RGB 颜色对象
115
+ * @param factor - 亮度调整因子,正数变亮,负数变暗,范围建议在 -1 到 1 之间
116
+ * @returns 调整后的 RGB 颜色对象
117
+ * @example
118
+ * ```ts
119
+ * adjustBrightness({ r: 128, g: 128, b: 128 }, 0.5)
120
+ * // => { r: 191, g: 191, b: 191 }
121
+ *
122
+ * adjustBrightness({ r: 128, g: 128, b: 128 }, -0.5)
123
+ * // => { r: 64, g: 64, b: 64 }
124
+ * ```
125
+ */
126
+ declare function adjustBrightness(rgb: RgbObject, factor: number): RgbObject;
127
+ /**
128
+ * 基于基准色生成完整的调色板
129
+ *
130
+ * 生成包含 12 个色阶(0-950)的调色板,其中 500 为基准色
131
+ *
132
+ * @param baseHex - 基准十六进制颜色字符串
133
+ * @returns 完整的调色板对象
134
+ * @example
135
+ * ```ts
136
+ * generateColorPalette('#3B82F6')
137
+ * // => {
138
+ * // 0: '#e6f0fe',
139
+ * // 50: '#dbeafe',
140
+ * // 100: '#bfdbfe',
141
+ * // ...
142
+ * // 500: '#3b82f6',
143
+ * // ...
144
+ * // 950: '#172554'
145
+ * // }
146
+ * ```
147
+ */
148
+ declare function generateColorPalette(baseHex: string): ColorPalette$1;
149
+
150
+ /**
151
+ * 检查当前是否为开发环境
152
+ *
153
+ * 通过检查 process.env.NODE_ENV 是否为 'development' 来判断
154
+ *
155
+ * @returns 如果当前是开发环境返回 true,否则返回 false
156
+ * @example
157
+ * ```ts
158
+ * if (isDevelopment()) {
159
+ * console.log('Running in development mode');
160
+ * }
161
+ * ```
162
+ */
163
+ declare function isDevelopment(): boolean;
164
+
165
+ /**
166
+ * 将日期格式化为指定格式的字符串
167
+ *
168
+ * @param date - 要格式化的日期对象
169
+ * @param format - 格式化模板,支持 'yyyy'(年)、'MM'(月)、'dd'(日),默认为 'yyyy-MM-dd'
170
+ * @returns 格式化后的日期字符串
171
+ * @example
172
+ * ```ts
173
+ * formatDate(new Date('2024-01-15'))
174
+ * // => '2024-01-15'
175
+ *
176
+ * formatDate(new Date('2024-01-15'), 'yyyy年MM月dd日')
177
+ * // => '2024年01月15日'
178
+ * ```
179
+ */
180
+ declare function formatDate(date: Date, format?: string): string;
181
+ /**
182
+ * 格式化日期为相对时间(如"刚刚"、"5分钟前"等)
183
+ *
184
+ * @param date - 要格式化的日期对象
185
+ * @returns 相对时间字符串
186
+ * @example
187
+ * ```ts
188
+ * formatRelativeTime(new Date()) // => '刚刚'
189
+ * formatRelativeTime(new Date(Date.now() - 5 * 60000)) // => '5分钟前'
190
+ * formatRelativeTime(new Date(Date.now() - 2 * 3600000)) // => '2小时前'
191
+ * formatRelativeTime(new Date(Date.now() - 3 * 86400000)) // => '3天前'
192
+ * formatRelativeTime(new Date('2023-01-01')) // => '2023-01-01'
193
+ * ```
194
+ */
195
+ declare function formatRelativeTime(date: Date): string;
196
+
197
+ /**
198
+ * 截断字符串,超出指定长度时添加后缀
199
+ *
200
+ * @param str - 要截断的字符串
201
+ * @param length - 目标长度(包含后缀长度)
202
+ * @param suffix - 截断后添加的后缀,默认为 '...'
203
+ * @returns 截断后的字符串
204
+ * @example
205
+ * ```ts
206
+ * truncate('Hello World', 8)
207
+ * // => 'Hello...'
208
+ *
209
+ * truncate('Hello World', 8, '>>')
210
+ * // => 'Hello >>'
211
+ *
212
+ * truncate('Hi', 8)
213
+ * // => 'Hi'
214
+ * ```
215
+ */
216
+ declare function truncate(str: string, length: number, suffix?: string): string;
217
+ /**
218
+ * 将字符串转换为 URL 友好的 slug 格式
219
+ *
220
+ * 移除特殊字符,将空格转换为连字符,合并多个连字符
221
+ *
222
+ * @param str - 要转换的字符串
223
+ * @returns slug 格式的字符串
224
+ * @example
225
+ * ```ts
226
+ * slugify('Hello World!')
227
+ * // => 'hello-world'
228
+ *
229
+ * slugify('This is a -- test!!!')
230
+ * // => 'this-is-a-test'
231
+ * ```
232
+ */
233
+ declare function slugify(str: string): string;
234
+ /**
235
+ * 将字符串首字母大写
236
+ *
237
+ * @param str - 要转换的字符串
238
+ * @returns 首字母大写的字符串
239
+ * @example
240
+ * ```ts
241
+ * capitalize('hello world')
242
+ * // => 'Hello world'
243
+ *
244
+ * capitalize('HELLO')
245
+ * // => 'HELLO'
246
+ * ```
247
+ */
248
+ declare function capitalize(str: string): string;
249
+
250
+ /**
251
+ * 将数字格式化为中文地区的字符串表示
252
+ *
253
+ * 使用千分位分隔符格式化数字
254
+ *
255
+ * @param num - 要格式化的数字
256
+ * @returns 格式化后的字符串
257
+ * @example
258
+ * ```ts
259
+ * formatNumber(1234567.89)
260
+ * // => '1,234,567.89'
261
+ *
262
+ * formatNumber(1000)
263
+ * // => '1,000'
264
+ * ```
265
+ */
266
+ declare function formatNumber(num: number): string;
267
+ /**
268
+ * 将数字格式化为货币字符串
269
+ *
270
+ * @param num - 要格式化的数字
271
+ * @param currency - 货币符号,默认为 '¥'
272
+ * @returns 格式化后的货币字符串
273
+ * @example
274
+ * ```ts
275
+ * formatCurrency(1234.5)
276
+ * // => '¥1,234.5'
277
+ *
278
+ * formatCurrency(1234.5, '$')
279
+ * // => '$1,234.5'
280
+ * ```
281
+ */
282
+ declare function formatCurrency(num: number, currency?: string): string;
283
+ /**
284
+ * 将小数格式化为百分比字符串
285
+ *
286
+ * @param num - 要格式化的小数(如 0.25 表示 25%)
287
+ * @param decimals - 小数位数,默认为 2
288
+ * @returns 格式化后的百分比字符串
289
+ * @example
290
+ * ```ts
291
+ * formatPercent(0.25)
292
+ * // => '25.00%'
293
+ *
294
+ * formatPercent(0.25, 0)
295
+ * // => '25%'
296
+ *
297
+ * formatPercent(0.1234, 1)
298
+ * // => '12.3%'
299
+ * ```
300
+ */
301
+ declare function formatPercent(num: number, decimals?: number): string;
302
+ /**
303
+ * 将数字限制在指定的最小值和最大值之间
304
+ *
305
+ * @param num - 要限制的数字
306
+ * @param min - 最小值
307
+ * @param max - 最大值
308
+ * @returns 限制后的数字
309
+ * @example
310
+ * ```ts
311
+ * clamp(50, 0, 100) // => 50
312
+ * clamp(150, 0, 100) // => 100
313
+ * clamp(-10, 0, 100) // => 0
314
+ * ```
315
+ */
316
+ declare function clamp(num: number, min: number, max: number): number;
317
+
318
+ /**
319
+ * 深度合并两个对象
320
+ *
321
+ * 递归合并 source 对象的属性到 target 对象,嵌套对象也会被合并
322
+ *
323
+ * @param target - 目标对象
324
+ * @param source - 源对象
325
+ * @returns 合并后的新对象
326
+ * @example
327
+ * ```ts
328
+ * deepMerge({ a: 1, b: { x: 1 } }, { b: { y: 2 }, c: 3 })
329
+ * // => { a: 1, b: { x: 1, y: 2 }, c: 3 }
330
+ * ```
331
+ */
332
+ declare function deepMerge<T extends Record<string, any>>(target: T, source: Partial<T>): T;
333
+ /**
334
+ * 从对象中选取指定的属性
335
+ *
336
+ * @param obj - 源对象
337
+ * @param keys - 要选取的属性键数组
338
+ * @returns 仅包含指定属性的新对象
339
+ * @example
340
+ * ```ts
341
+ * pick({ a: 1, b: 2, c: 3 }, ['a', 'c'])
342
+ * // => { a: 1, c: 3 }
343
+ * ```
344
+ */
345
+ declare function pick<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
346
+ /**
347
+ * 从对象中排除指定的属性
348
+ *
349
+ * @param obj - 源对象
350
+ * @param keys - 要排除的属性键数组
351
+ * @returns 不包含指定属性的新对象
352
+ * @example
353
+ * ```ts
354
+ * omit({ a: 1, b: 2, c: 3 }, ['b'])
355
+ * // => { a: 1, c: 3 }
356
+ * ```
357
+ */
358
+ declare function omit<T extends Record<string, any>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
359
+
360
+ /**
361
+ * 将 Zod 验证错误转换为字段错误映射对象
362
+ *
363
+ * @param error - ZodError 实例
364
+ * @returns 字段路径到错误消息的映射对象
365
+ * @example
366
+ * ```ts
367
+ * const schema = z.object({
368
+ * email: z.string().email(),
369
+ * age: z.number().min(18)
370
+ * });
371
+ *
372
+ * const result = schema.safeParse({ email: 'invalid', age: 16 });
373
+ * if (!result.success) {
374
+ * getValidationErrors(result.error)
375
+ * // => { email: 'Invalid email', age: 'Number must be greater than or equal to 18' }
376
+ * }
377
+ * ```
378
+ */
379
+ declare function getValidationErrors(error: ZodError): Record<string, string>;
380
+ /**
381
+ * 验证邮箱地址格式是否有效
382
+ *
383
+ * @param email - 要验证的邮箱地址
384
+ * @returns 是否为有效的邮箱格式
385
+ * @example
386
+ * ```ts
387
+ * isValidEmail('user@example.com') // => true
388
+ * isValidEmail('invalid-email') // => false
389
+ * ```
390
+ */
391
+ declare function isValidEmail(email: string): boolean;
392
+ /**
393
+ * 验证中国手机号码格式是否有效
394
+ *
395
+ * 支持以 1 开头,第二位为 3-9 的 11 位手机号码
396
+ *
397
+ * @param phone - 要验证的手机号码
398
+ * @returns 是否为有效的手机号码格式
399
+ * @example
400
+ * ```ts
401
+ * isValidPhone('13800138000') // => true
402
+ * isValidPhone('12345678901') // => false
403
+ * ```
404
+ */
405
+ declare function isValidPhone(phone: string): boolean;
406
+
407
+ interface ColorPalette {
408
+ 0: string;
409
+ 50: string;
410
+ 100: string;
411
+ 200: string;
412
+ 300: string;
413
+ 400: string;
414
+ 500: string;
415
+ 600: string;
416
+ 700: string;
417
+ 800: string;
418
+ 900: string;
419
+ 950: string;
420
+ [key: string]: string;
421
+ }
422
+ type ColorToken = string | ColorPalette;
423
+ interface ThemeConfig {
424
+ colors: Record<string, ColorToken>;
425
+ spacing?: Record<string, number>;
426
+ borderRadius?: Record<string, number>;
427
+ }
428
+ interface Theme {
429
+ colors: Record<string, ColorPalette>;
430
+ spacing: Record<string, number>;
431
+ borderRadius: Record<string, number>;
432
+ }
433
+
434
+ declare function createTheme(config: ThemeConfig): Theme;
435
+
436
+ interface ThemeContextValue {
437
+ theme: Theme;
438
+ isDark: boolean;
439
+ toggleTheme: () => void;
440
+ }
441
+ interface ThemeProviderProps {
442
+ children: React__default.ReactNode;
443
+ light: ThemeConfig;
444
+ dark?: ThemeConfig;
445
+ defaultDark?: boolean;
446
+ /**
447
+ * 受控暗色模式。
448
+ * 传入后会以该值为准,不再依赖内部 state。
449
+ */
450
+ isDark?: boolean;
451
+ /**
452
+ * 主题切换回调。
453
+ * 受控/非受控模式下都会在 toggleTheme 时触发。
454
+ */
455
+ onThemeChange?: (isDark: boolean) => void;
456
+ }
457
+ declare function ThemeProvider({ children, light, dark, defaultDark, isDark: controlledIsDark, onThemeChange, }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
458
+ declare function useTheme(): ThemeContextValue;
459
+
460
+ interface ThemeColorTokens {
461
+ primary: string;
462
+ primarySurface: string;
463
+ background: string;
464
+ card: string;
465
+ cardElevated: string;
466
+ text: string;
467
+ textSecondary: string;
468
+ textMuted: string;
469
+ textInverse: string;
470
+ border: string;
471
+ divider: string;
472
+ iconMuted: string;
473
+ }
474
+ declare function getThemeColors(theme: Theme, isDark: boolean): ThemeColorTokens;
475
+ declare function useThemeColors(): ThemeColorTokens;
476
+
477
+ /**
478
+ * @fileoverview 错误类型定义模块
479
+ * @module core/error/types
480
+ * @description 定义应用错误码枚举和错误对象接口
481
+ */
482
+ /**
483
+ * 应用错误码枚举
484
+ * @enum {string}
485
+ * @example
486
+ * ```typescript
487
+ * if (error.code === ErrorCode.UNAUTHORIZED) {
488
+ * redirectToLogin();
489
+ * }
490
+ * ```
491
+ */
492
+ declare enum ErrorCode {
493
+ /** 数据校验错误 */
494
+ VALIDATION = "VALIDATION",
495
+ /** 网络连接错误 */
496
+ NETWORK = "NETWORK",
497
+ /** 未授权访问 */
498
+ UNAUTHORIZED = "UNAUTHORIZED",
499
+ /** 禁止访问 */
500
+ FORBIDDEN = "FORBIDDEN",
501
+ /** 服务器内部错误 */
502
+ SERVER = "SERVER",
503
+ /** 业务逻辑错误 */
504
+ BUSINESS = "BUSINESS",
505
+ /** 未知错误 */
506
+ UNKNOWN = "UNKNOWN"
507
+ }
508
+ /**
509
+ * 应用错误对象接口
510
+ * @example
511
+ * ```typescript
512
+ * const error: AppError = {
513
+ * code: ErrorCode.VALIDATION,
514
+ * message: 'Email format is invalid',
515
+ * field: 'email',
516
+ * retryable: false
517
+ * };
518
+ * ```
519
+ */
520
+ interface AppError {
521
+ /** 错误码 */
522
+ code: ErrorCode;
523
+ /** 错误消息 */
524
+ message: string;
525
+ /** HTTP 状态码(如适用) */
526
+ statusCode?: number;
527
+ /** 相关字段(如校验错误) */
528
+ field?: string;
529
+ /** 是否可重试 */
530
+ retryable?: boolean;
531
+ /** 原始错误对象 */
532
+ original?: any;
533
+ }
534
+
535
+ /**
536
+ * @fileoverview 错误处理辅助函数模块
537
+ * @module core/error/helpers
538
+ * @description 提供 HTTP 状态码映射和错误对象增强功能
539
+ */
540
+
541
+ /**
542
+ * 将 HTTP 状态码映射为应用错误码
543
+ * @param status - HTTP 状态码
544
+ * @returns 对应的 ErrorCode 枚举值
545
+ * @example
546
+ * ```typescript
547
+ * const errorCode = mapHttpStatus(404); // ErrorCode.VALIDATION
548
+ * const errorCode = mapHttpStatus(500); // ErrorCode.SERVER
549
+ * const errorCode = mapHttpStatus(401); // ErrorCode.UNAUTHORIZED
550
+ * ```
551
+ */
552
+ declare function mapHttpStatus(status: number): ErrorCode;
553
+ /**
554
+ * 增强错误对象,添加便捷的判断属性
555
+ * @param error - 基础应用错误对象
556
+ * @returns 增强后的错误对象,包含 isValidation、isNetwork、isAuth、isRetryable 等属性
557
+ * @example
558
+ * ```typescript
559
+ * const enhanced = enhanceError({
560
+ * code: ErrorCode.NETWORK,
561
+ * message: 'Connection timeout'
562
+ * });
563
+ *
564
+ * if (enhanced.isNetwork) {
565
+ * showRetryButton();
566
+ * }
567
+ *
568
+ * if (enhanced.isRetryable) {
569
+ * await retryRequest();
570
+ * }
571
+ * ```
572
+ */
573
+ declare function enhanceError(error: AppError): AppError & {
574
+ isValidation: boolean;
575
+ isNetwork: boolean;
576
+ isAuth: boolean;
577
+ isRetryable: boolean;
578
+ };
579
+
580
+ /**
581
+ * @fileoverview 异步状态管理 Hook
582
+ * @module core/hooks/useAsyncState
583
+ * @description 提供用于异步操作状态管理的 React Hook
584
+ */
585
+
586
+ /**
587
+ * useAsyncState Hook 返回的状态接口
588
+ * @template T - 数据的类型
589
+ * @example
590
+ * ```typescript
591
+ * const { data, error, loading, execute, reset } = useAsyncState<User>();
592
+ * ```
593
+ */
594
+ interface UseAsyncState<T> {
595
+ /** 异步操作返回的数据 */
596
+ data: T | null;
597
+ /** 错误对象(如果发生错误) */
598
+ error: (AppError & {
599
+ isValidation: boolean;
600
+ isNetwork: boolean;
601
+ isAuth: boolean;
602
+ isRetryable: boolean;
603
+ }) | null;
604
+ /** 是否正在加载 */
605
+ loading: boolean;
606
+ }
607
+ /**
608
+ * 管理异步操作状态的 React Hook
609
+ * @template T - 异步操作返回数据的类型,默认为 any
610
+ * @returns 包含数据、错误、加载状态和操作方法的对象
611
+ * @example
612
+ * ```typescript
613
+ * function UserProfile({ userId }: { userId: number }) {
614
+ * const { data: user, error, loading, execute } = useAsyncState<User>();
615
+ *
616
+ * useEffect(() => {
617
+ * execute(fetchUser(userId));
618
+ * }, [userId, execute]);
619
+ *
620
+ * if (loading) return <Loading />;
621
+ * if (error?.isAuth) return <RedirectToLogin />;
622
+ * if (error) return <ErrorMessage error={error} />;
623
+ *
624
+ * return <UserCard user={user} />;
625
+ * }
626
+ * ```
627
+ */
628
+ declare function useAsyncState<T = any>(): {
629
+ data: T | null;
630
+ error: (AppError & {
631
+ isValidation: boolean;
632
+ isNetwork: boolean;
633
+ isAuth: boolean;
634
+ isRetryable: boolean;
635
+ }) | null;
636
+ loading: boolean;
637
+ execute: (promise: Promise<T>) => Promise<T>;
638
+ reset: () => void;
639
+ };
640
+
641
+ /**
642
+ * @fileoverview API 类型定义模块
643
+ * @module core/api/types
644
+ * @description 定义 API 端点和配置的核心类型接口
645
+ */
646
+
647
+ type ApiMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
648
+ interface ApiErrorContext {
649
+ /** 当前调用的 endpoint 名称 */
650
+ endpointName: string;
651
+ /** 当前 endpoint 的 path */
652
+ path: string;
653
+ /** HTTP 方法 */
654
+ method: ApiMethod;
655
+ /** 调用入参 */
656
+ input?: unknown;
657
+ /** 原始响应对象 */
658
+ response?: Response;
659
+ /** 已解析的响应数据 */
660
+ responseData?: unknown;
661
+ }
662
+ type ApiErrorHandler = (error: AppError, context: ApiErrorContext) => void | Promise<void>;
663
+ type ApiBusinessErrorParser = (data: unknown, response: Response) => AppError | null;
664
+ /**
665
+ * API 端点配置接口
666
+ * @template TInput - 请求输入数据的类型
667
+ * @template TOutput - 响应输出数据的类型
668
+ * @example
669
+ * ```typescript
670
+ * const userEndpoint: ApiEndpointConfig<{ id: number }, User> = {
671
+ * method: 'GET',
672
+ * path: '/users/:id',
673
+ * input: z.object({ id: z.number() }),
674
+ * output: z.instanceof(User)
675
+ * };
676
+ * ```
677
+ */
678
+ interface ApiEndpointConfig<TInput, TOutput> {
679
+ /** HTTP 请求方法 */
680
+ method: ApiMethod;
681
+ /** API 路径(相对于 baseURL) */
682
+ path: string;
683
+ /** 请求数据的 Zod 校验模式(可选) */
684
+ input?: z.ZodSchema<TInput>;
685
+ /** 响应数据的 Zod 校验模式(可选) */
686
+ output?: z.ZodSchema<TOutput>;
687
+ /** 当前 endpoint 的业务错误解析器(可选) */
688
+ parseBusinessError?: ApiBusinessErrorParser;
689
+ /** 当前 endpoint 的错误监听器(可选) */
690
+ onError?: ApiErrorHandler;
691
+ }
692
+ /**
693
+ * API 配置接口
694
+ * @template TEndpoints - 端点配置映射类型
695
+ * @example
696
+ * ```typescript
697
+ * const config: ApiConfig<typeof myEndpoints> = {
698
+ * baseURL: 'https://api.example.com/v1',
699
+ * endpoints: {
700
+ * getUser: { method: 'GET', path: '/users/:id' },
701
+ * createUser: { method: 'POST', path: '/users' }
702
+ * }
703
+ * };
704
+ * ```
705
+ */
706
+ interface ApiConfig<TEndpoints extends Record<string, ApiEndpointConfig<any, any>>> {
707
+ /** API 基础 URL */
708
+ baseURL: string;
709
+ /** 端点配置映射 */
710
+ endpoints: TEndpoints;
711
+ /** 自定义 fetch 实现(可选) */
712
+ fetcher?: typeof fetch;
713
+ /** 全局业务错误解析器(可选) */
714
+ parseBusinessError?: ApiBusinessErrorParser;
715
+ /** 全局错误监听器(可选) */
716
+ onError?: ApiErrorHandler;
717
+ }
718
+
719
+ /**
720
+ * @fileoverview API 创建模块
721
+ * @module core/api/create-api
722
+ * @description 提供类型安全的 API 客户端创建功能,支持请求/响应数据的 Zod 校验
723
+ */
724
+
725
+ /**
726
+ * 创建类型安全的 API 客户端
727
+ * @template TEndpoints - 端点配置映射类型
728
+ * @param config - API 配置对象,包含基础 URL 和端点定义
729
+ * @returns 代理对象,其方法对应配置的各个 API 端点
730
+ * @example
731
+ * ```typescript
732
+ * const api = createAPI({
733
+ * baseURL: 'https://api.example.com',
734
+ * endpoints: {
735
+ * getUser: {
736
+ * method: 'GET',
737
+ * path: '/users/:id',
738
+ * output: z.object({ id: z.number(), name: z.string() })
739
+ * },
740
+ * createUser: {
741
+ * method: 'POST',
742
+ * path: '/users',
743
+ * input: z.object({ name: z.string(), email: z.string().email() }),
744
+ * output: z.object({ id: z.number(), name: z.string(), email: z.string() })
745
+ * }
746
+ * }
747
+ * });
748
+ *
749
+ * // 调用会自动进行类型检查和数据校验
750
+ * const user = await api.getUser({ id: 1 });
751
+ * const newUser = await api.createUser({ name: 'John', email: 'john@example.com' });
752
+ * ```
753
+ */
754
+ declare function createAPI<TEndpoints extends Record<string, ApiEndpointConfig<any, any>>>(config: ApiConfig<TEndpoints>): {
755
+ [K in keyof TEndpoints]: (input?: any) => Promise<any>;
756
+ };
757
+
758
+ /**
759
+ * @fileoverview 内存存储实现模块
760
+ * @module core/storage/memory-storage
761
+ * @description 提供基于内存的键值存储实现,适用于测试环境或不需要持久化的场景
762
+ */
763
+ /**
764
+ * 内存存储类
765
+ * @description 使用 Map 实现的异步键值存储,数据仅在内存中保存,应用重启后丢失
766
+ * @example
767
+ * ```typescript
768
+ * const storage = new MemoryStorage();
769
+ *
770
+ * // 存储数据
771
+ * await storage.setItem('user', JSON.stringify({ id: 1, name: 'John' }));
772
+ *
773
+ * // 读取数据
774
+ * const userData = await storage.getItem('user');
775
+ * console.log(userData); // '{"id":1,"name":"John"}'
776
+ *
777
+ * // 删除数据
778
+ * await storage.removeItem('user');
779
+ *
780
+ * // 检查数据是否存在
781
+ * const exists = await storage.getItem('user'); // null
782
+ * ```
783
+ */
784
+ declare class MemoryStorage {
785
+ /** 内部存储的 Map 实例 */
786
+ private memory;
787
+ /**
788
+ * 存储键值对
789
+ * @param key - 存储键名
790
+ * @param value - 要存储的字符串值
791
+ * @returns 解析为 void 的 Promise
792
+ */
793
+ setItem(key: string, value: string): Promise<void>;
794
+ /**
795
+ * 根据键名获取值
796
+ * @param key - 存储键名
797
+ * @returns 存储的字符串值,如果不存在则返回 null
798
+ */
799
+ getItem(key: string): Promise<string | null>;
800
+ /**
801
+ * 删除指定键名的存储项
802
+ * @param key - 要删除的键名
803
+ * @returns 解析为 void 的 Promise
804
+ */
805
+ removeItem(key: string): Promise<void>;
806
+ }
807
+ /**
808
+ * 默认的内存存储实例
809
+ * @description 全局共享的内存存储单例,可用于跨模块的简单数据共享
810
+ * @example
811
+ * ```typescript
812
+ * import { storage } from './memory-storage';
813
+ *
814
+ * // 模块 A
815
+ * await storage.setItem('session', 'abc123');
816
+ *
817
+ * // 模块 B
818
+ * const session = await storage.getItem('session');
819
+ * console.log(session); // 'abc123'
820
+ * ```
821
+ */
822
+ declare const storage: MemoryStorage;
823
+
824
+ interface UseRequestOptions<T, P extends any[]> {
825
+ manual?: boolean;
826
+ deps?: any[];
827
+ defaultParams?: P;
828
+ onSuccess?: (data: T, params: P) => void;
829
+ onError?: (error: Error, params: P) => void;
830
+ onFinally?: (params: P) => void;
831
+ retryCount?: number;
832
+ retryDelay?: number;
833
+ }
834
+ declare function useRequest<T, P extends any[] = any[]>(service: (...params: P) => Promise<T>, options?: UseRequestOptions<T, P>): {
835
+ data: T | undefined;
836
+ loading: boolean;
837
+ error: Error | undefined;
838
+ run: (...params: P) => Promise<T>;
839
+ refresh: () => Promise<T>;
840
+ cancel: () => void;
841
+ mutate: (newData: T | ((prev: T | undefined) => T)) => void;
842
+ };
843
+
844
+ /**
845
+ * 分页参数
846
+ */
847
+ interface PaginationParams {
848
+ /** 当前页码 */
849
+ current: number;
850
+ /** 每页数量 */
851
+ pageSize: number;
852
+ /** 其他自定义参数 */
853
+ [key: string]: any;
854
+ }
855
+ /**
856
+ * 分页结果
857
+ * 支持 data 或 list 作为数据字段
858
+ */
859
+ interface PaginationResult<T> {
860
+ /** 数据列表(推荐) */
861
+ data?: T[];
862
+ /** 数据列表(兼容旧版本) */
863
+ list?: T[];
864
+ /** 总数据条数 */
865
+ total: number;
866
+ }
867
+ /**
868
+ * 分页选项
869
+ */
870
+ interface UsePaginationOptions {
871
+ /** 默认当前页码 */
872
+ defaultCurrent?: number;
873
+ /** 默认每页数量 */
874
+ defaultPageSize?: number;
875
+ /** 依赖数组 */
876
+ deps?: any[];
877
+ }
878
+ /**
879
+ * 分页返回值
880
+ */
881
+ interface UsePaginationReturn<T> {
882
+ /** 数据列表 */
883
+ data: T[];
884
+ /** 当前页码 */
885
+ current: number;
886
+ /** 每页数量 */
887
+ pageSize: number;
888
+ /** 总数据条数 */
889
+ total: number;
890
+ /** 是否还有更多数据 */
891
+ hasMore: boolean;
892
+ /** 是否加载中 */
893
+ loading: boolean;
894
+ /** 是否刷新中 */
895
+ refreshing: boolean;
896
+ /** 是否加载更多中 */
897
+ loadingMore: boolean;
898
+ /** 错误信息 */
899
+ error: Error | null;
900
+ /** 刷新数据 */
901
+ refresh: () => Promise<void>;
902
+ /** 加载更多数据 */
903
+ loadMore: () => Promise<void>;
904
+ /** 切换页码 */
905
+ changePage: (page: number) => Promise<void>;
906
+ }
907
+ /**
908
+ * 分页逻辑 Hook
909
+ * @param service - 分页数据请求函数
910
+ * @param options - 配置选项
911
+ * @returns 分页状态和控制方法
912
+ *
913
+ * @example
914
+ * ```tsx
915
+ * const {
916
+ * data,
917
+ * current,
918
+ * total,
919
+ * hasMore,
920
+ * loading,
921
+ * refreshing,
922
+ * loadingMore,
923
+ * refresh,
924
+ * loadMore,
925
+ * } = usePagination(
926
+ * async ({ current, pageSize, keyword }) => {
927
+ * const res = await api.getList({ page: current, size: pageSize, keyword });
928
+ * return { data: res.items, total: res.total };
929
+ * },
930
+ * { defaultPageSize: 20 }
931
+ * );
932
+ * ```
933
+ */
934
+ declare function usePagination<T>(service: (params: PaginationParams) => Promise<PaginationResult<T>>, options?: UsePaginationOptions): UsePaginationReturn<T>;
935
+
936
+ declare function usePrevious<T>(value: T): T | undefined;
937
+
938
+ declare function useSetState<T extends Record<string, any>>(initialState: T): [T, (patch: Partial<T> | ((prev: T) => Partial<T>)) => void, () => void];
939
+
940
+ declare function useMemoizedFn<T extends (...args: any[]) => any>(fn: T): T;
941
+
942
+ declare function useUpdateEffect(effect: React.EffectCallback, deps?: React.DependencyList): void;
943
+
944
+ /**
945
+ * 本地存储同步 Hook
946
+ * @param key - 存储键名
947
+ * @param defaultValue - 默认值
948
+ * @returns [值, 设置值, 删除值]
949
+ *
950
+ * @example
951
+ * ```tsx
952
+ * const [darkMode, setDarkMode] = useStorage('settings.darkMode', false);
953
+ *
954
+ * <Switch value={darkMode} onValueChange={setDarkMode} />
955
+ * ```
956
+ */
957
+ declare function useStorage<T>(key: string, defaultValue: T): [T, (value: T | ((prev: T) => T)) => void, () => void];
958
+
959
+ interface UseRefreshReturn<T> {
960
+ /** 数据 */
961
+ data: T | undefined;
962
+ /** 是否刷新中 */
963
+ refreshing: boolean;
964
+ /** 错误信息 */
965
+ error: Error | undefined;
966
+ /** 触发刷新 */
967
+ refresh: () => Promise<void>;
968
+ }
969
+ /**
970
+ * 下拉刷新逻辑 Hook
971
+ * @param fetcher - 数据获取函数
972
+ * @returns 刷新状态和触发方法
973
+ *
974
+ * @example
975
+ * ```tsx
976
+ * const { data, refreshing, refresh } = useRefresh(() => fetchUserList());
977
+ *
978
+ * <FlatList
979
+ * refreshing={refreshing}
980
+ * onRefresh={refresh}
981
+ * data={data}
982
+ * />
983
+ * ```
984
+ */
985
+ declare function useRefresh<T>(fetcher: () => Promise<T>): UseRefreshReturn<T>;
986
+
987
+ interface UseInfiniteOptions {
988
+ /** 默认页码 */
989
+ defaultPage?: number;
990
+ /** 每页数量 */
991
+ pageSize?: number;
992
+ /** 是否自动加载 */
993
+ autoLoad?: boolean;
994
+ }
995
+ interface UseInfiniteReturn<T> {
996
+ /** 累积的数据列表 */
997
+ data: T[];
998
+ /** 当前页码 */
999
+ page: number;
1000
+ /** 是否初始加载中 */
1001
+ loading: boolean;
1002
+ /** 是否加载更多中 */
1003
+ loadingMore: boolean;
1004
+ /** 是否还有更多数据 */
1005
+ hasMore: boolean;
1006
+ /** 错误信息 */
1007
+ error: Error | undefined;
1008
+ /** 加载数据 */
1009
+ load: () => Promise<void>;
1010
+ /** 加载更多 */
1011
+ loadMore: () => Promise<void>;
1012
+ /** 刷新(重置到第一页) */
1013
+ refresh: () => Promise<void>;
1014
+ /** 重置 */
1015
+ reset: () => void;
1016
+ }
1017
+ /**
1018
+ * 无限滚动获取参数
1019
+ * 支持扩展自定义参数
1020
+ */
1021
+ interface InfiniteFetchParams {
1022
+ /** 当前页码 */
1023
+ page: number;
1024
+ /** 每页数量 */
1025
+ pageSize: number;
1026
+ /** 其他自定义参数 */
1027
+ [key: string]: any;
1028
+ }
1029
+ /**
1030
+ * 无限滚动获取结果
1031
+ * 支持 data 或 list 作为数据字段
1032
+ */
1033
+ interface InfiniteFetchResult<T> {
1034
+ /** 数据列表(推荐) */
1035
+ data?: T[];
1036
+ /** 数据列表(兼容旧版本) */
1037
+ list?: T[];
1038
+ /** 是否还有更多数据 */
1039
+ hasMore: boolean;
1040
+ }
1041
+ /**
1042
+ * 无限滚动逻辑 Hook
1043
+ * @param fetcher - 数据获取函数,接收 { page, pageSize, ...其他参数 } 参数
1044
+ * @param options - 配置选项
1045
+ * @returns 无限滚动状态和控制方法
1046
+ *
1047
+ * @example
1048
+ * ```tsx
1049
+ * const { data, loading, loadingMore, hasMore, loadMore, refresh } = useInfinite(
1050
+ * async ({ page, pageSize, keyword }) => {
1051
+ * const res = await api.getList({ page, size: pageSize, keyword });
1052
+ * return { data: res.items, hasMore: res.hasMore };
1053
+ * },
1054
+ * { pageSize: 20 }
1055
+ * );
1056
+ *
1057
+ * <FlatList
1058
+ * data={data}
1059
+ * onEndReached={hasMore && !loadingMore ? loadMore : null}
1060
+ * refreshing={loading}
1061
+ * onRefresh={refresh}
1062
+ * />
1063
+ * ```
1064
+ */
1065
+ declare function useInfinite<T>(fetcher: (params: InfiniteFetchParams) => Promise<InfiniteFetchResult<T>>, options?: UseInfiniteOptions): UseInfiniteReturn<T>;
1066
+
1067
+ /**
1068
+ * AppView 组件属性接口
1069
+ */
1070
+ interface AppViewProps extends ViewProps {
1071
+ /** 是否使用 flex 布局,设为 true 使用 flex-1,设为数字使用 flex-${number} */
1072
+ flex?: boolean | number;
1073
+ /** 是否使用水平排列(flex-direction: row) */
1074
+ row?: boolean;
1075
+ /** 是否居中显示(items-center justify-center) */
1076
+ center?: boolean;
1077
+ /** 是否两端对齐(justify-between) */
1078
+ between?: boolean;
1079
+ /** 交叉轴对齐方式(align-items) */
1080
+ items?: 'start' | 'center' | 'end' | 'stretch';
1081
+ /** 主轴对齐方式(justify-content) */
1082
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around';
1083
+ /** 内边距 */
1084
+ p?: number;
1085
+ /** 水平内边距 */
1086
+ px?: number;
1087
+ /** 垂直内边距 */
1088
+ py?: number;
1089
+ /** 子元素间距 */
1090
+ gap?: number;
1091
+ /** 背景颜色 */
1092
+ bg?: string;
1093
+ /** 语义化背景 */
1094
+ surface?: 'background' | 'card' | 'muted';
1095
+ /** 圆角大小 */
1096
+ rounded?: string;
1097
+ /** 自定义类名 */
1098
+ className?: string;
1099
+ }
1100
+ /**
1101
+ * AppView - 基础视图容器组件
1102
+ *
1103
+ * 基于 React Native 的 View 组件封装,提供便捷的 Flexbox 布局属性
1104
+ * 和 Tailwind CSS 类名支持,简化日常布局开发
1105
+ *
1106
+ * @example
1107
+ * ```tsx
1108
+ * // 基础使用
1109
+ * <AppView>
1110
+ * <Text>内容</Text>
1111
+ * </AppView>
1112
+ *
1113
+ * // Flex 布局
1114
+ * <AppView flex row>
1115
+ * <Text>左侧</Text>
1116
+ * <Text>右侧</Text>
1117
+ * </AppView>
1118
+ *
1119
+ * // 居中对齐
1120
+ * <AppView center className="h-full">
1121
+ * <Text>居中内容</Text>
1122
+ * </AppView>
1123
+ *
1124
+ * // 带间距和背景
1125
+ * <AppView p={4} gap={2} bg="gray-100" rounded="lg">
1126
+ * <Text>带样式的容器</Text>
1127
+ * </AppView>
1128
+ * ```
1129
+ */
1130
+ declare function AppView({ flex, row, center, between, items, justify, p, px, py, gap, bg, surface, rounded, className, children, style, ...props }: AppViewProps): react_jsx_runtime.JSX.Element;
1131
+
1132
+ interface AppScrollViewProps extends ScrollViewProps {
1133
+ /** 是否使用 flex 布局 */
1134
+ flex?: boolean;
1135
+ /** 背景颜色 */
1136
+ bg?: string;
1137
+ /** 语义化背景 */
1138
+ surface?: 'background' | 'card' | 'muted';
1139
+ /** 内边距 */
1140
+ p?: number;
1141
+ /** 水平内边距 */
1142
+ px?: number;
1143
+ /** 垂直内边距 */
1144
+ py?: number;
1145
+ /** 子元素间距 */
1146
+ gap?: number;
1147
+ /** 圆角大小 */
1148
+ rounded?: string;
1149
+ /** 自定义类名 */
1150
+ className?: string;
1151
+ }
1152
+ /**
1153
+ * AppScrollView - 带 Tailwind/快捷布局能力的滚动容器
1154
+ */
1155
+ declare function AppScrollView({ flex, bg, p, px, py, gap, surface, rounded, className, children, style, ...props }: AppScrollViewProps): react_jsx_runtime.JSX.Element;
1156
+
1157
+ /**
1158
+ * AppText 组件属性接口
1159
+ */
1160
+ interface AppTextProps extends TextProps {
1161
+ /** 字体大小:xs(12px)、sm(14px)、md(16px)、lg(18px)、xl(20px)、2xl(24px)、3xl(30px) */
1162
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
1163
+ /** 字重:normal(400)、medium(500)、semibold(600)、bold(700) */
1164
+ weight?: 'normal' | 'medium' | 'semibold' | 'bold';
1165
+ /** 文字颜色,支持 Tailwind 颜色类名 */
1166
+ color?: string;
1167
+ /** 语义化文字色 */
1168
+ tone?: 'default' | 'muted' | 'inverse' | 'primary' | 'secondary' | 'success' | 'warning' | 'error';
1169
+ /** 自定义类名 */
1170
+ className?: string;
1171
+ }
1172
+ /**
1173
+ * AppText - 基础文本组件
1174
+ *
1175
+ * 基于 React Native 的 Text 组件封装,提供预设的字体大小、字重和颜色选项
1176
+ * 支持 Tailwind CSS 类名,简化文本样式定义
1177
+ *
1178
+ * @example
1179
+ * ```tsx
1180
+ * // 基础使用
1181
+ * <AppText>默认文本</AppText>
1182
+ *
1183
+ * // 不同大小
1184
+ * <AppText size="xs">超小文本</AppText>
1185
+ * <AppText size="lg">大文本</AppText>
1186
+ * <AppText size="2xl">超大文本</AppText>
1187
+ *
1188
+ * // 不同字重
1189
+ * <AppText weight="bold">粗体文本</AppText>
1190
+ * <AppText weight="semibold">半粗文本</AppText>
1191
+ *
1192
+ * // 自定义颜色
1193
+ * <AppText color="primary-500">主题色文本</AppText>
1194
+ * <AppText color="red-500">红色文本</AppText>
1195
+ *
1196
+ * // 组合使用
1197
+ * <AppText size="xl" weight="bold" color="gray-800">
1198
+ * 标题文本
1199
+ * </AppText>
1200
+ * ```
1201
+ */
1202
+ declare function AppText({ size, weight, color, tone, className, children, style, ...props }: AppTextProps): react_jsx_runtime.JSX.Element;
1203
+
1204
+ /**
1205
+ * AppPressable 组件属性接口
1206
+ */
1207
+ interface AppPressableProps extends PressableProps {
1208
+ /** 自定义类名 */
1209
+ className?: string;
1210
+ /** 按下状态时的类名 */
1211
+ pressedClassName?: string;
1212
+ }
1213
+ /**
1214
+ * AppPressable - 可按压组件
1215
+ *
1216
+ * 基于 React Native 的 Pressable 组件封装,支持按下状态样式切换
1217
+ * 自动管理按下状态,支持自定义普通状态和按下状态的样式
1218
+ *
1219
+ * @example
1220
+ * ```tsx
1221
+ * // 基础使用
1222
+ * <AppPressable onPress={() => console.log('pressed')}>
1223
+ * <Text>点击我</Text>
1224
+ * </AppPressable>
1225
+ *
1226
+ * // 带按下效果
1227
+ * <AppPressable
1228
+ * className="p-4 bg-blue-500"
1229
+ * pressedClassName="bg-blue-600"
1230
+ * onPress={handlePress}
1231
+ * >
1232
+ * <Text className="text-white">按钮</Text>
1233
+ * </AppPressable>
1234
+ *
1235
+ * // 带透明度变化
1236
+ * <AppPressable
1237
+ * className="p-3 rounded-lg"
1238
+ * pressedClassName="opacity-70"
1239
+ * onPress={handlePress}
1240
+ * >
1241
+ * <Icon name="arrow-forward" />
1242
+ * </AppPressable>
1243
+ * ```
1244
+ */
1245
+ declare function AppPressable({ className, pressedClassName, children, ...props }: AppPressableProps): react_jsx_runtime.JSX.Element;
1246
+
1247
+ /**
1248
+ * Row 组件属性接口
1249
+ */
1250
+ interface RowProps extends AppViewProps {
1251
+ /** 主轴对齐方式(justify-content) */
1252
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around';
1253
+ /** 交叉轴对齐方式(align-items) */
1254
+ items?: 'start' | 'center' | 'end' | 'stretch';
1255
+ }
1256
+ /**
1257
+ * Row - 水平布局组件
1258
+ *
1259
+ * 基于 AppView 封装的水平排列布局组件,默认使用 flex-row
1260
+ * 提供便捷的 justify 和 items 属性控制对齐方式
1261
+ *
1262
+ * @example
1263
+ * ```tsx
1264
+ * // 基础使用
1265
+ * <Row>
1266
+ * <Text>左侧</Text>
1267
+ * <Text>右侧</Text>
1268
+ * </Row>
1269
+ *
1270
+ * // 两端对齐
1271
+ * <Row justify="between">
1272
+ * <Text>标题</Text>
1273
+ * <Icon name="arrow-forward" />
1274
+ * </Row>
1275
+ *
1276
+ * // 居中对齐
1277
+ * <Row justify="center" items="center" gap={4}>
1278
+ * <Icon name="star" />
1279
+ * <Text>评分</Text>
1280
+ * </Row>
1281
+ *
1282
+ * // 带间距
1283
+ * <Row gap={3}>
1284
+ * <Button>取消</Button>
1285
+ * <Button>确认</Button>
1286
+ * </Row>
1287
+ *
1288
+ * // 组合使用
1289
+ * <Row justify="between" items="center" className="p-4">
1290
+ * <AppView row gap={2}>
1291
+ * <Avatar source={avatar} />
1292
+ * <AppView>
1293
+ * <AppText weight="bold">用户名</AppText>
1294
+ * <AppText size="sm" color="gray-500">描述信息</AppText>
1295
+ * </AppView>
1296
+ * </AppView>
1297
+ * <Icon name="more-vert" />
1298
+ * </Row>
1299
+ * ```
1300
+ */
1301
+ declare function Row({ justify, items, className, ...props }: RowProps): react_jsx_runtime.JSX.Element;
1302
+
1303
+ /**
1304
+ * Col 组件属性接口
1305
+ */
1306
+ interface ColProps extends AppViewProps {
1307
+ /** 主轴对齐方式(justify-content) */
1308
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around';
1309
+ /** 交叉轴对齐方式(align-items) */
1310
+ items?: 'start' | 'center' | 'end' | 'stretch';
1311
+ }
1312
+ /**
1313
+ * Col - 垂直布局组件
1314
+ *
1315
+ * 基于 AppView 封装的垂直排列布局组件,默认使用 flex-col
1316
+ * 提供便捷的 justify 和 items 属性控制对齐方式
1317
+ *
1318
+ * @example
1319
+ * ```tsx
1320
+ * // 基础使用
1321
+ * <Col>
1322
+ * <Text>第一行</Text>
1323
+ * <Text>第二行</Text>
1324
+ * </Col>
1325
+ *
1326
+ * // 两端对齐
1327
+ * <Col justify="between" flex>
1328
+ * <Text>顶部内容</Text>
1329
+ * <Text>底部内容</Text>
1330
+ * </Col>
1331
+ *
1332
+ * // 水平居中
1333
+ * <Col items="center" gap={3}>
1334
+ * <Icon name="check-circle" size="xl" color="success-500" />
1335
+ * <AppText weight="bold">操作成功</AppText>
1336
+ * <AppText color="gray-500">您的订单已提交</AppText>
1337
+ * </Col>
1338
+ *
1339
+ * // 带间距
1340
+ * <Col gap={4}>
1341
+ * <Input placeholder="用户名" />
1342
+ * <Input placeholder="密码" secureTextEntry />
1343
+ * <Button>登录</Button>
1344
+ * </Col>
1345
+ *
1346
+ * // 组合使用
1347
+ * <Col className="p-4 bg-white rounded-lg">
1348
+ * <AppText size="lg" weight="bold">订单详情</AppText>
1349
+ * <Row justify="between" className="mt-2">
1350
+ * <AppText color="gray-500">订单号</AppText>
1351
+ * <AppText>12345678</AppText>
1352
+ * </Row>
1353
+ * <Row justify="between" className="mt-2">
1354
+ * <AppText color="gray-500">金额</AppText>
1355
+ * <AppText color="danger-500" weight="bold">¥99.00</AppText>
1356
+ * </Row>
1357
+ * </Col>
1358
+ * ```
1359
+ */
1360
+ declare function Col({ justify, items, className, ...props }: ColProps): react_jsx_runtime.JSX.Element;
1361
+
1362
+ /**
1363
+ * Center 组件属性接口
1364
+ */
1365
+ interface CenterProps extends Omit<AppViewProps, 'center'> {
1366
+ /** 是否使用 flex 布局,默认为 true */
1367
+ flex?: boolean | number;
1368
+ }
1369
+ /**
1370
+ * Center - 居中布局组件
1371
+ *
1372
+ * 基于 AppView 封装的居中布局组件,内容在水平和垂直方向都居中
1373
+ * 常用于空状态、加载状态等需要居中对齐的场景
1374
+ *
1375
+ * @example
1376
+ * ```tsx
1377
+ * // 基础使用
1378
+ * <Center>
1379
+ * <Text>居中内容</Text>
1380
+ * </Center>
1381
+ *
1382
+ * // 全屏居中
1383
+ * <Center flex>
1384
+ * <Icon name="inbox" size="xl" />
1385
+ * <Text>暂无数据</Text>
1386
+ * </Center>
1387
+ *
1388
+ * // 指定 flex 值
1389
+ * <Center flex={2}>
1390
+ * <Text>占据更多空间</Text>
1391
+ * </Center>
1392
+ *
1393
+ * // 组合使用
1394
+ * <Center flex className="bg-gray-50">
1395
+ * <AppImage source={emptyImage} width={120} height={120} />
1396
+ * <AppText size="lg" weight="bold" className="mt-4">暂无订单</AppText>
1397
+ * <AppText color="gray-500" className="mt-2">快去选购商品吧</AppText>
1398
+ * <AppButton className="mt-6" onPress={goShopping}>去购物</AppButton>
1399
+ * </Center>
1400
+ * ```
1401
+ */
1402
+ declare function Center({ flex, ...props }: CenterProps): react_jsx_runtime.JSX.Element;
1403
+
1404
+ interface SafeScreenProps extends ViewProps {
1405
+ /** 是否包含顶部安全区域 */
1406
+ top?: boolean;
1407
+ /** 是否包含底部安全区域 */
1408
+ bottom?: boolean;
1409
+ /** 是否包含左侧安全区域 */
1410
+ left?: boolean;
1411
+ /** 是否包含右侧安全区域 */
1412
+ right?: boolean;
1413
+ /** 背景颜色 */
1414
+ bg?: string;
1415
+ /** 是否使用 flex: 1 */
1416
+ flex?: boolean;
1417
+ /** 自定义样式类 */
1418
+ className?: string;
1419
+ /** 子元素 */
1420
+ children: React__default.ReactNode;
1421
+ }
1422
+ /**
1423
+ * 安全屏幕组件 - 自动适配刘海屏/全面屏的安全区域
1424
+ *
1425
+ * @example
1426
+ * ```tsx
1427
+ * <SafeScreen flex bg="white">
1428
+ * <AppText>内容在安全区域内</AppText>
1429
+ * </SafeScreen>
1430
+ * ```
1431
+ */
1432
+ declare function SafeScreen({ top, bottom, left, right, bg, flex, className, children, style, ...props }: SafeScreenProps): react_jsx_runtime.JSX.Element;
1433
+ /**
1434
+ * 页面容器组件 - 包含安全区域和基础布局
1435
+ *
1436
+ * @example
1437
+ * ```tsx
1438
+ * <Page>
1439
+ * <AppHeader title="首页" />
1440
+ * <AppView flex p={4}>
1441
+ * <AppText>页面内容</AppText>
1442
+ * </AppView>
1443
+ * </Page>
1444
+ * ```
1445
+ */
1446
+ declare function Page({ children, className, ...props }: Omit<SafeScreenProps, 'top' | 'bottom' | 'left' | 'right'>): react_jsx_runtime.JSX.Element;
1447
+ /**
1448
+ * 底部安全区域组件 - 只在底部添加安全距离
1449
+ * 注意:此组件不会铺满全屏,只占据内容高度
1450
+ *
1451
+ * @example
1452
+ * ```tsx
1453
+ * <SafeBottom>
1454
+ * <AppButton>底部按钮</AppButton>
1455
+ * </SafeBottom>
1456
+ * ```
1457
+ */
1458
+ declare function SafeBottom({ children, className, ...props }: Omit<SafeScreenProps, 'top' | 'bottom' | 'left' | 'right'>): react_jsx_runtime.JSX.Element;
1459
+
1460
+ /**
1461
+ * AppButton 组件属性接口
1462
+ */
1463
+ interface AppButtonProps {
1464
+ /** 按钮样式变体:solid(实心)、outline(描边)、ghost(透明) */
1465
+ variant?: 'solid' | 'outline' | 'ghost';
1466
+ /** 按钮尺寸:sm(小)、md(中)、lg(大) */
1467
+ size?: 'sm' | 'md' | 'lg';
1468
+ /** 按钮颜色主题 */
1469
+ color?: 'primary' | 'secondary' | 'danger';
1470
+ /** 是否显示加载状态 */
1471
+ loading?: boolean;
1472
+ /** 是否禁用 */
1473
+ disabled?: boolean;
1474
+ /** 点击回调 */
1475
+ onPress?: () => void;
1476
+ /** 按钮内容 */
1477
+ children: React.ReactNode;
1478
+ /** 自定义类名 */
1479
+ className?: string;
1480
+ }
1481
+ /**
1482
+ * AppButton - 按钮组件
1483
+ *
1484
+ * 功能完善的按钮组件,支持多种样式变体、尺寸和颜色主题
1485
+ * 内置加载状态和禁用状态处理,提供统一的用户交互体验
1486
+ *
1487
+ * @example
1488
+ * ```tsx
1489
+ * // 基础使用
1490
+ * <AppButton onPress={handlePress}>确定</AppButton>
1491
+ *
1492
+ * // 不同变体
1493
+ * <AppButton variant="solid">实心按钮</AppButton>
1494
+ * <AppButton variant="outline">描边按钮</AppButton>
1495
+ * <AppButton variant="ghost">透明按钮</AppButton>
1496
+ *
1497
+ * // 不同尺寸
1498
+ * <AppButton size="sm">小按钮</AppButton>
1499
+ * <AppButton size="md">中按钮</AppButton>
1500
+ * <AppButton size="lg">大按钮</AppButton>
1501
+ *
1502
+ * // 不同颜色
1503
+ * <AppButton color="primary">主题色</AppButton>
1504
+ * <AppButton color="secondary">次要色</AppButton>
1505
+ * <AppButton color="danger">危险操作</AppButton>
1506
+ *
1507
+ * // 加载状态
1508
+ * <AppButton loading>加载中</AppButton>
1509
+ *
1510
+ * // 禁用状态
1511
+ * <AppButton disabled>不可用</AppButton>
1512
+ *
1513
+ * // 组合使用
1514
+ * <AppButton
1515
+ * variant="outline"
1516
+ * color="danger"
1517
+ * size="lg"
1518
+ * onPress={handleDelete}
1519
+ * >
1520
+ * 删除账号
1521
+ * </AppButton>
1522
+ * ```
1523
+ */
1524
+ declare function AppButton({ variant, size, color, loading, disabled, onPress, children, className, }: AppButtonProps): react_jsx_runtime.JSX.Element;
1525
+
1526
+ /**
1527
+ * Toast 组件属性接口
1528
+ */
1529
+ interface ToastProps {
1530
+ /** 提示消息内容 */
1531
+ message: string;
1532
+ /** 提示类型,决定背景颜色 */
1533
+ type?: 'success' | 'error' | 'warning' | 'info';
1534
+ /** 是否显示 */
1535
+ visible?: boolean;
1536
+ }
1537
+ /**
1538
+ * Toast - 轻提示组件
1539
+ *
1540
+ * 用于显示简短的操作反馈信息,自动根据类型显示不同颜色
1541
+ * 通常配合 Toast 管理器使用,支持自动消失
1542
+ *
1543
+ * @example
1544
+ * ```tsx
1545
+ * // 基础使用
1546
+ * <Toast message="操作成功" />
1547
+ *
1548
+ * // 不同类型
1549
+ * <Toast message="保存成功" type="success" />
1550
+ * <Toast message="网络错误" type="error" />
1551
+ * <Toast message="请注意" type="warning" />
1552
+ * <Toast message="提示信息" type="info" />
1553
+ *
1554
+ * // 控制显示
1555
+ * <Toast
1556
+ * message="正在加载..."
1557
+ * type="info"
1558
+ * visible={isLoading}
1559
+ * />
1560
+ *
1561
+ * // 配合管理器使用
1562
+ * const { showToast } = useToast();
1563
+ * showToast({ message: '操作成功', type: 'success' });
1564
+ * ```
1565
+ */
1566
+ declare function Toast({ message, type, visible }: ToastProps): react_jsx_runtime.JSX.Element | null;
1567
+
1568
+ /**
1569
+ * Alert 按钮配置
1570
+ */
1571
+ interface AlertButton {
1572
+ text: string;
1573
+ onPress?: () => void;
1574
+ style?: 'default' | 'cancel' | 'destructive';
1575
+ }
1576
+ /**
1577
+ * Alert 组件属性接口
1578
+ */
1579
+ interface AlertProps {
1580
+ /** 是否显示 */
1581
+ visible: boolean;
1582
+ /** 标题 */
1583
+ title: string;
1584
+ /** 消息内容 */
1585
+ message?: string;
1586
+ /** 按钮配置 */
1587
+ buttons: AlertButton[];
1588
+ /** 关闭回调 */
1589
+ onClose?: () => void;
1590
+ }
1591
+ /**
1592
+ * Alert - 对话框组件,支持浅色/深色主题
1593
+ */
1594
+ declare function Alert({ visible, title, message, buttons, onClose }: AlertProps): react_jsx_runtime.JSX.Element;
1595
+
1596
+ /**
1597
+ * Loading 组件属性接口
1598
+ */
1599
+ interface LoadingProps {
1600
+ /** 加载提示文字 */
1601
+ text?: string;
1602
+ /** 指示器颜色 */
1603
+ color?: string;
1604
+ /** 是否显示遮罩层 */
1605
+ overlay?: boolean;
1606
+ /** 是否显示 */
1607
+ visible?: boolean;
1608
+ /** 测试 ID */
1609
+ testID?: string;
1610
+ }
1611
+ /**
1612
+ * Loading - 加载指示器组件
1613
+ *
1614
+ * 用于显示操作正在进行的视觉反馈,支持内联和遮罩两种模式
1615
+ * 遮罩模式会覆盖整个屏幕,阻止用户操作
1616
+ *
1617
+ * @example
1618
+ * ```tsx
1619
+ * // 基础使用
1620
+ * <Loading />
1621
+ *
1622
+ * // 带提示文字
1623
+ * <Loading text="正在加载..." />
1624
+ *
1625
+ * // 遮罩模式(全屏)
1626
+ * <Loading overlay text="保存中..." />
1627
+ *
1628
+ * // 条件显示
1629
+ * {isLoading && <Loading text="加载中" />}
1630
+ *
1631
+ * // 配合请求使用
1632
+ * const [loading, setLoading] = useState(false);
1633
+ *
1634
+ * const fetchData = async () => {
1635
+ * setLoading(true);
1636
+ * try {
1637
+ * const data = await api.getData();
1638
+ * setData(data);
1639
+ * } finally {
1640
+ * setLoading(false);
1641
+ * }
1642
+ * };
1643
+ *
1644
+ * return (
1645
+ * <>
1646
+ * <FlatList data={data} renderItem={renderItem} />
1647
+ * <Loading overlay visible={loading} text="加载中..." />
1648
+ * </>
1649
+ * );
1650
+ * ```
1651
+ */
1652
+ declare function Loading({ text, color, overlay, visible, testID, }: LoadingProps): react_jsx_runtime.JSX.Element | null;
1653
+
1654
+ /**
1655
+ * Progress 组件属性接口
1656
+ */
1657
+ interface ProgressProps {
1658
+ /** 当前进度值 */
1659
+ value: number;
1660
+ /** 最大值,默认为 100 */
1661
+ max?: number;
1662
+ /** 进度条高度:xs(4px)、sm(6px)、md(8px)、lg(12px)、xl(16px) */
1663
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
1664
+ /** 进度条颜色 */
1665
+ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'error';
1666
+ /** 测试 ID */
1667
+ testID?: string;
1668
+ /** 自定义容器样式 */
1669
+ className?: string;
1670
+ /** 自定义进度条样式 */
1671
+ barClassName?: string;
1672
+ }
1673
+ /**
1674
+ * Progress - 进度条组件
1675
+ *
1676
+ * 用于展示操作进度的可视化组件,支持浅色/深色主题
1677
+ *
1678
+ * @example
1679
+ * ```tsx
1680
+ * // 基础使用
1681
+ * <Progress value={50} />
1682
+ *
1683
+ * // 不同尺寸
1684
+ * <Progress value={30} size="sm" />
1685
+ * <Progress value={60} size="lg" />
1686
+ *
1687
+ * // 不同颜色
1688
+ * <Progress value={75} color="success" />
1689
+ * <Progress value={90} color="warning" />
1690
+ * ```
1691
+ */
1692
+ declare function Progress({ value, max, size, color, testID, className, barClassName, }: ProgressProps): react_jsx_runtime.JSX.Element;
1693
+
1694
+ /**
1695
+ * Card 组件属性接口
1696
+ */
1697
+ interface CardProps extends ViewProps {
1698
+ /** Tailwind / NativeWind 类名 */
1699
+ className?: string;
1700
+ /** 是否禁用阴影 */
1701
+ noShadow?: boolean;
1702
+ /** 是否禁用边框 */
1703
+ noBorder?: boolean;
1704
+ /** 是否禁用圆角 */
1705
+ noRadius?: boolean;
1706
+ }
1707
+ /**
1708
+ * Card - 卡片容器组件,支持浅色/深色主题
1709
+ */
1710
+ declare function Card({ children, className, style, noShadow, noBorder, noRadius, ...props }: CardProps): react_jsx_runtime.JSX.Element;
1711
+
1712
+ /** 图标尺寸类型 */
1713
+ type IconSize = number | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
1714
+ /**
1715
+ * Icon 组件属性接口
1716
+ */
1717
+ interface IconProps {
1718
+ /** 图标名称,参考 MaterialIcons 图标库 */
1719
+ name: string;
1720
+ /** 图标尺寸:预设值 xs(16px)、sm(20px)、md(24px)、lg(32px)、xl(48px) 或直接指定数字 */
1721
+ size?: IconSize;
1722
+ /** 图标颜色,支持 Tailwind 颜色格式(如 'primary-500'、'gray-600')或十六进制值 */
1723
+ color?: string;
1724
+ /** 自定义样式 */
1725
+ style?: StyleProp<TextStyle>;
1726
+ /** 点击回调,设置了此属性后图标将变为可点击 */
1727
+ onPress?: () => void;
1728
+ /** 测试 ID */
1729
+ testID?: string;
1730
+ }
1731
+ /**
1732
+ * 解析图标颜色
1733
+ * @param color - 颜色值
1734
+ * @param theme - 主题对象
1735
+ * @returns 解析后的颜色值
1736
+ */
1737
+ /**
1738
+ * Icon - 图标组件
1739
+ *
1740
+ * 基于 MaterialIcons 的图标组件,支持主题颜色、多种尺寸和点击交互
1741
+ * 提供了常用的图标常量集合,方便开发使用
1742
+ *
1743
+ * @example
1744
+ * ```tsx
1745
+ * // 基础使用
1746
+ * <Icon name="home" />
1747
+ *
1748
+ * // 指定尺寸
1749
+ * <Icon name="search" size="lg" />
1750
+ * <Icon name="settings" size={32} />
1751
+ *
1752
+ * // 指定颜色
1753
+ * <Icon name="check-circle" color="success-500" />
1754
+ * <Icon name="error" color="red-500" />
1755
+ *
1756
+ * // 可点击图标
1757
+ * <Icon name="close" onPress={() => setVisible(false)} />
1758
+ *
1759
+ * // 使用预设常量
1760
+ * <Icon name={NavigationIcons.home} />
1761
+ * <Icon name={ActionIcons.delete} color="danger-500" />
1762
+ * ```
1763
+ */
1764
+ declare function Icon({ name, size, color, style, onPress, testID }: IconProps): react_jsx_runtime.JSX.Element;
1765
+ /**
1766
+ * 导航图标常量
1767
+ */
1768
+ declare const NavigationIcons: {
1769
+ readonly home: "home";
1770
+ readonly explore: "explore";
1771
+ readonly profile: "person";
1772
+ readonly settings: "settings";
1773
+ readonly back: "arrow-back";
1774
+ readonly forward: "arrow-forward";
1775
+ readonly close: "close";
1776
+ readonly menu: "menu";
1777
+ readonly more: "more-vert";
1778
+ };
1779
+ /**
1780
+ * 操作图标常量
1781
+ */
1782
+ declare const ActionIcons: {
1783
+ readonly add: "add";
1784
+ readonly edit: "edit";
1785
+ readonly delete: "delete";
1786
+ readonly search: "search";
1787
+ readonly share: "share";
1788
+ readonly favorite: "favorite";
1789
+ readonly favoriteBorder: "favorite-border";
1790
+ readonly check: "check";
1791
+ readonly checkCircle: "check-circle";
1792
+ readonly close: "close";
1793
+ readonly closeCircle: "cancel";
1794
+ readonly copy: "content-copy";
1795
+ readonly download: "download";
1796
+ readonly upload: "upload";
1797
+ };
1798
+ /**
1799
+ * 状态图标常量
1800
+ */
1801
+ declare const StatusIcons: {
1802
+ readonly info: "info";
1803
+ readonly success: "check-circle";
1804
+ readonly warning: "warning";
1805
+ readonly error: "error";
1806
+ readonly help: "help";
1807
+ readonly loading: "refresh";
1808
+ };
1809
+ /**
1810
+ * 文件图标常量
1811
+ */
1812
+ declare const FileIcons: {
1813
+ readonly file: "insert-drive-file";
1814
+ readonly image: "image";
1815
+ readonly video: "videocam";
1816
+ readonly audio: "audiotrack";
1817
+ readonly folder: "folder";
1818
+ readonly folderOpen: "folder-open";
1819
+ };
1820
+
1821
+ /** 图片缩放模式 */
1822
+ type ImageResizeMode = 'cover' | 'contain' | 'stretch' | 'center';
1823
+ /**
1824
+ * AppImage 组件属性接口
1825
+ */
1826
+ interface AppImageProps {
1827
+ /** 图片资源,可以是本地资源或远程 URL */
1828
+ source: ImageSourcePropType | {
1829
+ uri: string;
1830
+ };
1831
+ /** 宽度,数字表示像素,字符串表示百分比 */
1832
+ width?: number | string;
1833
+ /** 高度,数字表示像素,'auto' 表示自适应,或使用 'aspect-16/9' 等比例格式 */
1834
+ height?: number | string;
1835
+ /** 圆角大小,支持预设值或数字 */
1836
+ borderRadius?: 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full' | number;
1837
+ /** 加载时的占位图 */
1838
+ placeholder?: ImageSourcePropType;
1839
+ /** 加载失败时的占位图 */
1840
+ errorPlaceholder?: ImageSourcePropType;
1841
+ /** 是否显示加载指示器,设为 true 显示默认指示器,或传入自定义节点 */
1842
+ loadingIndicator?: boolean | React__default.ReactNode;
1843
+ /** 是否在加载失败时显示错误图标 */
1844
+ showError?: boolean;
1845
+ /** 图片缩放模式 */
1846
+ resizeMode?: ImageResizeMode;
1847
+ /** 图片加载成功回调 */
1848
+ onLoad?: () => void;
1849
+ /** 图片加载失败回调 */
1850
+ onError?: (error: any) => void;
1851
+ /** 点击回调 */
1852
+ onPress?: () => void;
1853
+ /** 长按回调 */
1854
+ onLongPress?: () => void;
1855
+ /** 自定义类名 */
1856
+ className?: string;
1857
+ /** 自定义样式 */
1858
+ style?: StyleProp<ImageStyle>;
1859
+ }
1860
+ /**
1861
+ * AppImage - 图片组件
1862
+ *
1863
+ * 功能丰富的图片组件,支持加载状态、错误处理、圆角、点击交互等
1864
+ * 自动处理图片加载过程中的各种状态,提供良好的用户体验
1865
+ *
1866
+ * @example
1867
+ * ```tsx
1868
+ * // 基础使用
1869
+ * <AppImage source={{ uri: 'https://example.com/image.jpg' }} />
1870
+ *
1871
+ * // 指定尺寸和圆角
1872
+ * <AppImage
1873
+ * source={require('./photo.png')}
1874
+ * width={200}
1875
+ * height={150}
1876
+ * borderRadius="lg"
1877
+ * />
1878
+ *
1879
+ * // 显示加载指示器
1880
+ * <AppImage
1881
+ * source={{ uri: 'https://example.com/large-image.jpg' }}
1882
+ * loadingIndicator={true}
1883
+ * showError={true}
1884
+ * />
1885
+ *
1886
+ * // 可点击图片
1887
+ * <AppImage
1888
+ * source={{ uri: 'https://example.com/photo.jpg' }}
1889
+ * onPress={() => navigation.navigate('Detail')}
1890
+ * onLongPress={() => showContextMenu()}
1891
+ * />
1892
+ *
1893
+ * // 使用占位图
1894
+ * <AppImage
1895
+ * source={{ uri: user.avatar }}
1896
+ * placeholder={require('./default-avatar.png')}
1897
+ * errorPlaceholder={require('./error-avatar.png')}
1898
+ * borderRadius="full"
1899
+ * />
1900
+ * ```
1901
+ */
1902
+ declare function AppImage({ source, width, height, borderRadius, placeholder, errorPlaceholder, loadingIndicator, showError, resizeMode, onLoad, onError, onPress, onLongPress, className, style, }: AppImageProps): react_jsx_runtime.JSX.Element;
1903
+
1904
+ interface AppListProps<T = any> {
1905
+ data: T[];
1906
+ renderItem: ListRenderItem<T>;
1907
+ keyExtractor?: (item: T, index: number) => string;
1908
+ loading?: boolean;
1909
+ refreshing?: boolean;
1910
+ onRefresh?: () => void | Promise<void>;
1911
+ hasMore?: boolean;
1912
+ onEndReached?: () => void | Promise<void>;
1913
+ onEndReachedThreshold?: number;
1914
+ error?: Error | null;
1915
+ onRetry?: () => void;
1916
+ emptyTitle?: string;
1917
+ emptyDescription?: string;
1918
+ emptyIcon?: string;
1919
+ EmptyComponent?: React__default.ComponentType;
1920
+ divider?: boolean;
1921
+ dividerStyle?: StyleProp<ViewStyle>;
1922
+ skeletonCount?: number;
1923
+ skeletonRender?: () => React__default.ReactElement;
1924
+ ListHeaderComponent?: React__default.ComponentType | React__default.ReactElement | null;
1925
+ ListFooterComponent?: React__default.ComponentType | React__default.ReactElement | null;
1926
+ contentContainerStyle?: StyleProp<ViewStyle>;
1927
+ style?: StyleProp<ViewStyle>;
1928
+ numColumns?: number;
1929
+ columnWrapperStyle?: StyleProp<ViewStyle>;
1930
+ horizontal?: boolean;
1931
+ showsVerticalScrollIndicator?: boolean;
1932
+ showsHorizontalScrollIndicator?: boolean;
1933
+ }
1934
+ declare function AppList<T = any>({ data, renderItem, keyExtractor, loading, refreshing, onRefresh, hasMore, onEndReached, onEndReachedThreshold, error, onRetry, emptyTitle, emptyDescription, emptyIcon, EmptyComponent, divider, dividerStyle, skeletonCount, skeletonRender, ListHeaderComponent, ListFooterComponent, contentContainerStyle, style, numColumns, columnWrapperStyle, horizontal, showsVerticalScrollIndicator, showsHorizontalScrollIndicator, }: AppListProps<T>): react_jsx_runtime.JSX.Element;
1935
+
1936
+ /**
1937
+ * AppInput 组件属性接口
1938
+ */
1939
+ interface AppInputProps extends Omit<TextInputProps, 'editable'> {
1940
+ /** 标签文本 */
1941
+ label?: string;
1942
+ /** 错误信息 */
1943
+ error?: string;
1944
+ /** 是否禁用 */
1945
+ disabled?: boolean;
1946
+ /** 左侧图标 */
1947
+ leftIcon?: React.ReactNode;
1948
+ /** 右侧图标 */
1949
+ rightIcon?: React.ReactNode;
1950
+ /** 自定义样式 */
1951
+ className?: string;
1952
+ }
1953
+ /**
1954
+ * AppInput - 输入框组件,支持浅色/深色主题
1955
+ */
1956
+ declare const AppInput: React$1.ForwardRefExoticComponent<AppInputProps & React$1.RefAttributes<TextInput>>;
1957
+
1958
+ /**
1959
+ * Checkbox 组件属性接口
1960
+ */
1961
+ interface CheckboxProps {
1962
+ checked?: boolean;
1963
+ defaultChecked?: boolean;
1964
+ onChange?: (checked: boolean) => void;
1965
+ disabled?: boolean;
1966
+ children?: React.ReactNode;
1967
+ className?: string;
1968
+ testID?: string;
1969
+ }
1970
+ /**
1971
+ * Checkbox - 复选框组件,支持浅色/深色主题
1972
+ */
1973
+ declare function Checkbox({ checked, defaultChecked, onChange, disabled, children, className, testID, }: CheckboxProps): react_jsx_runtime.JSX.Element;
1974
+
1975
+ interface Option$1 {
1976
+ label: string;
1977
+ value: string;
1978
+ disabled?: boolean;
1979
+ }
1980
+ interface CheckboxGroupProps {
1981
+ value?: string[];
1982
+ onChange?: (value: string[]) => void;
1983
+ options?: Option$1[];
1984
+ direction?: 'row' | 'column';
1985
+ disabled?: boolean;
1986
+ }
1987
+ declare function CheckboxGroup({ value, onChange, options, direction, disabled, }: CheckboxGroupProps): react_jsx_runtime.JSX.Element;
1988
+
1989
+ /**
1990
+ * Radio 组件属性接口
1991
+ */
1992
+ interface RadioProps {
1993
+ checked?: boolean;
1994
+ defaultChecked?: boolean;
1995
+ onChange?: (checked: boolean) => void;
1996
+ disabled?: boolean;
1997
+ children?: React.ReactNode;
1998
+ className?: string;
1999
+ testID?: string;
2000
+ }
2001
+ /**
2002
+ * Radio - 单选框组件,支持浅色/深色主题
2003
+ */
2004
+ declare function Radio({ checked, defaultChecked, onChange, disabled, children, className, testID, }: RadioProps): react_jsx_runtime.JSX.Element;
2005
+
2006
+ interface Option {
2007
+ label: string;
2008
+ value: string;
2009
+ disabled?: boolean;
2010
+ }
2011
+ interface RadioGroupProps {
2012
+ value?: string;
2013
+ onChange?: (value: string) => void;
2014
+ options?: Option[];
2015
+ direction?: 'row' | 'column';
2016
+ disabled?: boolean;
2017
+ }
2018
+ declare function RadioGroup({ value, onChange, options, direction, disabled, }: RadioGroupProps): react_jsx_runtime.JSX.Element;
2019
+
2020
+ /**
2021
+ * Switch 组件属性接口
2022
+ */
2023
+ interface SwitchProps {
2024
+ checked?: boolean;
2025
+ defaultChecked?: boolean;
2026
+ onChange?: (checked: boolean) => void;
2027
+ disabled?: boolean;
2028
+ size?: 'sm' | 'md' | 'lg';
2029
+ className?: string;
2030
+ testID?: string;
2031
+ style?: ViewStyle;
2032
+ }
2033
+ /**
2034
+ * Switch - 开关组件,支持浅色/深色主题
2035
+ */
2036
+ declare function Switch({ checked, defaultChecked, onChange, disabled, size, className, testID, style, }: SwitchProps): react_jsx_runtime.JSX.Element;
2037
+
2038
+ /**
2039
+ * Slider 组件属性接口
2040
+ */
2041
+ interface SliderProps {
2042
+ value?: number;
2043
+ defaultValue?: number;
2044
+ min?: number;
2045
+ max?: number;
2046
+ step?: number;
2047
+ disabled?: boolean;
2048
+ showTooltip?: boolean;
2049
+ onChange?: (value: number) => void;
2050
+ onChangeEnd?: (value: number) => void;
2051
+ className?: string;
2052
+ }
2053
+ /**
2054
+ * Slider - 滑块组件,支持浅色/深色主题
2055
+ */
2056
+ declare function Slider({ value, defaultValue, min, max, step, disabled, showTooltip, onChange, onChangeEnd, className, }: SliderProps): react_jsx_runtime.JSX.Element;
2057
+
2058
+ interface SelectOption {
2059
+ label: string;
2060
+ value: string;
2061
+ }
2062
+ interface SelectProps {
2063
+ /** 选中值 */
2064
+ value?: string | string[];
2065
+ /** 变化回调 */
2066
+ onChange?: (value: string | string[]) => void;
2067
+ /** 选项列表 */
2068
+ options: SelectOption[];
2069
+ /** 占位文字 */
2070
+ placeholder?: string;
2071
+ /** 是否多选 */
2072
+ multiple?: boolean;
2073
+ /** 是否可搜索 */
2074
+ searchable?: boolean;
2075
+ /** 搜索回调(异步搜索时使用) */
2076
+ onSearch?: (keyword: string) => void;
2077
+ /** 是否禁用 */
2078
+ disabled?: boolean;
2079
+ /** 是否可清空 */
2080
+ clearable?: boolean;
2081
+ /** 自定义样式 */
2082
+ className?: string;
2083
+ }
2084
+ /**
2085
+ * 底部弹出选择器组件,支持浅色/深色主题
2086
+ */
2087
+ declare function Select({ value, onChange, options, placeholder, multiple, searchable, onSearch, disabled, clearable, className, }: SelectProps): react_jsx_runtime.JSX.Element;
2088
+
2089
+ /**
2090
+ * DatePicker 组件属性接口
2091
+ */
2092
+ interface DatePickerProps {
2093
+ /** 选中日期 */
2094
+ value?: Date;
2095
+ /** 变化回调 */
2096
+ onChange?: (date: Date) => void;
2097
+ /** 占位文字 */
2098
+ placeholder?: string;
2099
+ /** 是否禁用 */
2100
+ disabled?: boolean;
2101
+ /** 日期格式 */
2102
+ format?: string;
2103
+ /** 最小日期 */
2104
+ minDate?: Date;
2105
+ /** 最大日期 */
2106
+ maxDate?: Date;
2107
+ /** 自定义样式 */
2108
+ className?: string;
2109
+ }
2110
+ /**
2111
+ * DatePicker - 日期选择器组件,支持浅色/深色主题
2112
+ */
2113
+ declare function DatePicker({ value, onChange, placeholder, disabled, format, minDate, maxDate, className, }: DatePickerProps): react_jsx_runtime.JSX.Element;
2114
+
2115
+ interface FormItemProps {
2116
+ name: string;
2117
+ label?: string;
2118
+ error?: string;
2119
+ help?: string;
2120
+ required?: boolean;
2121
+ children: React.ReactNode;
2122
+ /** 自定义样式 */
2123
+ className?: string;
2124
+ /** 标签样式 */
2125
+ labelClassName?: string;
2126
+ }
2127
+ declare function FormItem({ name: _name, label, error, help, required, children, className, labelClassName, }: FormItemProps): react_jsx_runtime.JSX.Element;
2128
+
2129
+ interface UseFormOptions<T extends Record<string, any>> {
2130
+ schema: ZodSchema<T>;
2131
+ defaultValues: T;
2132
+ }
2133
+ interface FormErrors {
2134
+ [key: string]: string;
2135
+ }
2136
+ declare function useForm<T extends Record<string, any>>({ schema, defaultValues, }: UseFormOptions<T>): {
2137
+ values: T;
2138
+ errors: FormErrors;
2139
+ isValid: boolean;
2140
+ isDirty: boolean;
2141
+ isSubmitting: boolean;
2142
+ setValue: (name: keyof T, value: any) => void;
2143
+ getValue: (name: keyof T) => T[keyof T];
2144
+ validate: () => Promise<boolean>;
2145
+ validateField: (name: keyof T) => Promise<boolean>;
2146
+ reset: () => void;
2147
+ handleSubmit: (onSubmit?: (values: T) => void | Promise<void>) => Promise<void>;
2148
+ };
2149
+
2150
+ interface UseToggleActions {
2151
+ /** 切换布尔值 */
2152
+ toggle: () => void;
2153
+ /** 设置为指定值 */
2154
+ set: (value: boolean) => void;
2155
+ /** 设置为 true */
2156
+ setTrue: () => void;
2157
+ /** 设置为 false */
2158
+ setFalse: () => void;
2159
+ }
2160
+ /**
2161
+ * 布尔值切换 Hook
2162
+ * @param defaultValue - 默认值
2163
+ * @returns [当前值, 操作集合]
2164
+ *
2165
+ * @example
2166
+ * ```tsx
2167
+ * const [visible, { toggle, setTrue, setFalse }] = useToggle(false);
2168
+ *
2169
+ * <Button onPress={toggle}>{visible ? '隐藏' : '显示'}</Button>
2170
+ * {visible && <Modal onClose={setFalse} />}
2171
+ * ```
2172
+ */
2173
+ declare function useToggle(defaultValue?: boolean): [boolean, UseToggleActions];
2174
+
2175
+ /**
2176
+ * 防抖 Hook
2177
+ * @param value - 需要防抖的值
2178
+ * @param delay - 延迟时间(毫秒),默认 500ms
2179
+ * @returns 防抖后的值
2180
+ *
2181
+ * @example
2182
+ * ```tsx
2183
+ * const [keyword, setKeyword] = useState('');
2184
+ * const debouncedKeyword = useDebounce(keyword, 500);
2185
+ *
2186
+ * // 使用 debouncedKeyword 进行搜索
2187
+ * useEffect(() => {
2188
+ * search(debouncedKeyword);
2189
+ * }, [debouncedKeyword]);
2190
+ * ```
2191
+ */
2192
+ declare function useDebounce<T>(value: T, delay?: number): T;
2193
+
2194
+ /**
2195
+ * 节流 Hook
2196
+ * @param value - 需要节流的值
2197
+ * @param delay - 节流间隔(毫秒),默认 200ms
2198
+ * @returns 节流后的值
2199
+ *
2200
+ * @example
2201
+ * ```tsx
2202
+ * const [scrollY, setScrollY] = useState(0);
2203
+ * const throttledScrollY = useThrottle(scrollY, 200);
2204
+ *
2205
+ * // 使用 throttledScrollY 更新 UI(如头部透明度)
2206
+ * const headerOpacity = Math.min(throttledScrollY / 200, 1);
2207
+ * ```
2208
+ */
2209
+ declare function useThrottle<T>(value: T, delay?: number): T;
2210
+
2211
+ interface UseKeyboardReturn {
2212
+ /** 键盘是否显示 */
2213
+ visible: boolean;
2214
+ /** 键盘高度 */
2215
+ height: number;
2216
+ /** 关闭键盘 */
2217
+ dismiss: () => void;
2218
+ }
2219
+ /**
2220
+ * 键盘状态监听 Hook
2221
+ * @returns 键盘状态和控制方法
2222
+ *
2223
+ * @example
2224
+ * ```tsx
2225
+ * const { visible, height, dismiss } = useKeyboard();
2226
+ *
2227
+ * <ScrollView contentContainerStyle={{ paddingBottom: visible ? height : 0 }}>
2228
+ * {\/* 内容 *\/}
2229
+ * </ScrollView>
2230
+ * ```
2231
+ */
2232
+ declare function useKeyboard(): UseKeyboardReturn;
2233
+
2234
+ interface UseDimensionsReturn {
2235
+ /** 屏幕宽度 */
2236
+ width: number;
2237
+ /** 屏幕高度 */
2238
+ height: number;
2239
+ /** 屏幕像素密度 */
2240
+ scale: number;
2241
+ /** 字体缩放比例 */
2242
+ fontScale: number;
2243
+ }
2244
+ /**
2245
+ * 屏幕尺寸变化监听 Hook
2246
+ * @returns 屏幕尺寸信息
2247
+ *
2248
+ * @example
2249
+ * ```tsx
2250
+ * const { width, height } = useDimensions();
2251
+ *
2252
+ * // 根据宽度决定列数
2253
+ * const numColumns = width > 600 ? 3 : 2;
2254
+ * ```
2255
+ */
2256
+ declare function useDimensions(): UseDimensionsReturn;
2257
+
2258
+ type Orientation = 'portrait' | 'landscape';
2259
+ interface UseOrientationReturn {
2260
+ /** 当前方向 */
2261
+ orientation: Orientation;
2262
+ /** 是否为竖屏 */
2263
+ isPortrait: boolean;
2264
+ /** 是否为横屏 */
2265
+ isLandscape: boolean;
2266
+ }
2267
+ /**
2268
+ * 横竖屏切换监听 Hook
2269
+ * @returns 方向状态
2270
+ *
2271
+ * @example
2272
+ * ```tsx
2273
+ * const { orientation, isPortrait } = useOrientation();
2274
+ *
2275
+ * <View style={{ flexDirection: isPortrait ? 'column' : 'row' }}>
2276
+ * {\/* 内容 *\/}
2277
+ * </View>
2278
+ * ```
2279
+ */
2280
+ declare function useOrientation(): UseOrientationReturn;
2281
+
2282
+ /**
2283
+ * 导航提供者组件 Props
2284
+ */
2285
+ interface NavigationProviderProps {
2286
+ /** 子元素(导航器组件) */
2287
+ children: React__default.ReactNode;
2288
+ /** 深度链接配置(可选) */
2289
+ linking?: LinkingOptions<any>;
2290
+ /** 加载时的回退组件 */
2291
+ fallback?: React__default.ReactNode;
2292
+ /** 导航准备就绪时的回调 */
2293
+ onReady?: () => void;
2294
+ /** 状态变化时的回调 */
2295
+ onStateChange?: (state: any) => void;
2296
+ /** 未处理动作时的回调 */
2297
+ onUnhandledAction?: (action: any) => void;
2298
+ /** 自定义导航主题(覆盖默认主题) */
2299
+ theme?: Theme$1;
2300
+ }
2301
+ /**
2302
+ * 导航提供者组件
2303
+ *
2304
+ * 封装 NavigationContainer,自动集成应用主题。
2305
+ * 所有导航器必须包裹在 NavigationProvider 内。
2306
+ *
2307
+ * @example
2308
+ * ```tsx
2309
+ * // 基础使用
2310
+ * export default function App() {
2311
+ * return (
2312
+ * <NavigationProvider>
2313
+ * <StackNavigator>
2314
+ * <StackNavigator.Screen name="Home" component={HomeScreen} />
2315
+ * </StackNavigator>
2316
+ * </NavigationProvider>
2317
+ * );
2318
+ * }
2319
+ *
2320
+ * // 带深度链接
2321
+ * export default function App() {
2322
+ * return (
2323
+ * <NavigationProvider
2324
+ * linking={{
2325
+ * prefixes: ['myapp://', 'https://myapp.com'],
2326
+ * config: {
2327
+ * screens: {
2328
+ * Home: 'home',
2329
+ * Detail: 'detail/:id',
2330
+ * },
2331
+ * },
2332
+ * }}
2333
+ * fallback={<LoadingScreen />}
2334
+ * >
2335
+ * <RootNavigator />
2336
+ * </NavigationProvider>
2337
+ * );
2338
+ * }
2339
+ * ```
2340
+ */
2341
+ declare function NavigationProvider({ children, linking, fallback, onReady, onStateChange, onUnhandledAction, theme: customTheme, }: NavigationProviderProps): react_jsx_runtime.JSX.Element;
2342
+
2343
+ /**
2344
+ * 导航基础类型
2345
+ * @module navigation/types/base
2346
+ */
2347
+ /**
2348
+ * 路由参数基础类型
2349
+ * 所有路由参数列表都应继承此类型
2350
+ */
2351
+ type ParamListBase = {
2352
+ [key: string]: object | undefined;
2353
+ };
2354
+ /**
2355
+ * 堆栈导航参数列表
2356
+ * 用户应扩展此类型来定义自己的路由参数
2357
+ *
2358
+ * @example
2359
+ * ```ts
2360
+ * declare module '@gaozh1024/rn-kit' {
2361
+ * interface StackParamList {
2362
+ * Home: undefined;
2363
+ * Detail: { id: string };
2364
+ * }
2365
+ * }
2366
+ * ```
2367
+ */
2368
+ interface StackParamList extends ParamListBase {
2369
+ }
2370
+ /**
2371
+ * 标签导航参数列表
2372
+ * 用户应扩展此类型来定义自己的路由参数
2373
+ */
2374
+ interface TabParamList extends ParamListBase {
2375
+ }
2376
+ /**
2377
+ * 抽屉导航参数列表
2378
+ * 用户应扩展此类型来定义自己的路由参数
2379
+ */
2380
+ interface DrawerParamList extends ParamListBase {
2381
+ }
2382
+
2383
+ /**
2384
+ * 屏幕选项类型
2385
+ * @module navigation/types/screens
2386
+ */
2387
+ /**
2388
+ * 屏幕选项配置 - 堆栈
2389
+ */
2390
+ interface StackScreenOptions {
2391
+ /** 标题 */
2392
+ title?: string;
2393
+ /** 是否显示头部 */
2394
+ headerShown?: boolean;
2395
+ /** 自定义头部 */
2396
+ header?: (props: any) => React.ReactElement | null;
2397
+ /** 动画类型 */
2398
+ animation?: 'default' | 'fade' | 'slide_from_right' | 'slide_from_left' | 'slide_from_bottom' | 'none';
2399
+ /** 是否支持全屏手势返回(主要用于 iOS) */
2400
+ fullScreenGestureEnabled?: boolean;
2401
+ /** 自定义后退按钮标题(iOS) */
2402
+ headerBackTitle?: string;
2403
+ /** 是否显示后退按钮 */
2404
+ headerBackVisible?: boolean;
2405
+ /** 内容样式 */
2406
+ contentStyle?: object;
2407
+ }
2408
+ /**
2409
+ * 屏幕选项配置 - 标签
2410
+ */
2411
+ interface TabScreenOptions {
2412
+ /** 标签标题 */
2413
+ title?: string;
2414
+ /** 标签栏标签 */
2415
+ tabBarLabel?: string | ((props: {
2416
+ focused: boolean;
2417
+ color: string;
2418
+ }) => React.ReactNode);
2419
+ /** 标签栏图标 */
2420
+ tabBarIcon?: (props: {
2421
+ focused: boolean;
2422
+ color: string;
2423
+ size: number;
2424
+ }) => React.ReactNode;
2425
+ /** 是否显示标签栏 */
2426
+ tabBarVisible?: boolean;
2427
+ /** 是否支持滑动切换 */
2428
+ swipeEnabled?: boolean;
2429
+ }
2430
+ /**
2431
+ * 标签栏配置
2432
+ */
2433
+ interface TabBarOptions {
2434
+ /** 是否显示标签 */
2435
+ showLabel?: boolean;
2436
+ /** 激活状态颜色 */
2437
+ activeTintColor?: string;
2438
+ /** 非激活状态颜色 */
2439
+ inactiveTintColor?: string;
2440
+ /** 激活背景色 */
2441
+ activeBackgroundColor?: string;
2442
+ /** 非激活背景色 */
2443
+ inactiveBackgroundColor?: string;
2444
+ /** 键盘弹出时是否隐藏 */
2445
+ hideOnKeyboard?: boolean;
2446
+ /** 标签位置 */
2447
+ labelPosition?: 'below-icon' | 'beside-icon';
2448
+ /** 标签样式 */
2449
+ labelStyle?: TextStyle;
2450
+ /** 图标样式 */
2451
+ iconStyle?: ViewStyle;
2452
+ /** 标签栏样式 */
2453
+ style?: ViewStyle;
2454
+ /** 标签栏高度(不含底部安全区,默认 65) */
2455
+ height?: number;
2456
+ }
2457
+ /**
2458
+ * 屏幕选项配置 - 抽屉
2459
+ */
2460
+ interface DrawerScreenOptions {
2461
+ /** 标题 */
2462
+ title?: string;
2463
+ /** 是否显示头部 */
2464
+ headerShown?: boolean;
2465
+ /** 抽屉标签 */
2466
+ drawerLabel?: string | ((props: {
2467
+ focused: boolean;
2468
+ color: string;
2469
+ }) => React.ReactNode);
2470
+ /** 抽屉图标 */
2471
+ drawerIcon?: (props: {
2472
+ focused: boolean;
2473
+ size: number;
2474
+ color: string;
2475
+ }) => React.ReactNode;
2476
+ /** 激活状态颜色 */
2477
+ drawerActiveTintColor?: string;
2478
+ /** 非激活状态颜色 */
2479
+ drawerInactiveTintColor?: string;
2480
+ /** 激活背景色 */
2481
+ drawerActiveBackgroundColor?: string;
2482
+ /** 非激活背景色 */
2483
+ drawerInactiveBackgroundColor?: string;
2484
+ }
2485
+ /**
2486
+ * 抽屉配置
2487
+ */
2488
+ interface DrawerOptions {
2489
+ /** 抽屉类型 */
2490
+ drawerType?: 'front' | 'back' | 'slide' | 'permanent';
2491
+ /** 抽屉宽度 */
2492
+ drawerWidth?: number;
2493
+ /** 遮罩层颜色 */
2494
+ overlayColor?: string;
2495
+ /** 是否支持边缘滑动打开 */
2496
+ edgeWidth?: number;
2497
+ /** 最小滑动距离 */
2498
+ minSwipeDistance?: number;
2499
+ /** 隐藏状态下是否响应手势 */
2500
+ gestureHandlerProps?: object;
2501
+ }
2502
+
2503
+ /**
2504
+ * 路由配置类型
2505
+ * @module navigation/types/routes
2506
+ */
2507
+
2508
+ /**
2509
+ * 路由屏幕配置
2510
+ */
2511
+ interface RouteConfig {
2512
+ /** 屏幕名称 */
2513
+ name: string;
2514
+ /** 屏幕组件 */
2515
+ component: React.ComponentType<any>;
2516
+ /** 屏幕选项 */
2517
+ options?: StackScreenOptions | TabScreenOptions | DrawerScreenOptions;
2518
+ /** 初始参数 */
2519
+ initialParams?: Record<string, any>;
2520
+ /** 嵌套路由 */
2521
+ children?: RouteConfig[];
2522
+ }
2523
+ /**
2524
+ * 堆栈路由配置
2525
+ */
2526
+ interface StackRouteConfig extends RouteConfig {
2527
+ options?: StackScreenOptions;
2528
+ }
2529
+ /**
2530
+ * 标签路由配置
2531
+ */
2532
+ interface TabRouteConfig extends RouteConfig {
2533
+ options?: TabScreenOptions;
2534
+ }
2535
+ /**
2536
+ * 抽屉路由配置
2537
+ */
2538
+ interface DrawerRouteConfig extends RouteConfig {
2539
+ options?: DrawerScreenOptions;
2540
+ }
2541
+
2542
+ /**
2543
+ * 深度链接配置类型
2544
+ * @module navigation/types/linking
2545
+ */
2546
+ /**
2547
+ * 路径配置
2548
+ */
2549
+ interface PathConfig {
2550
+ /** 路径模板 */
2551
+ path?: string;
2552
+ /** 是否精确匹配 */
2553
+ exact?: boolean;
2554
+ /** 解析参数 */
2555
+ parse?: Record<string, (value: string) => any>;
2556
+ /** 序列化参数 */
2557
+ stringify?: Record<string, (value: any) => string>;
2558
+ /** 嵌套屏幕配置 */
2559
+ screens?: Record<string, PathConfig>;
2560
+ }
2561
+ /**
2562
+ * 深度链接配置
2563
+ */
2564
+ interface LinkingConfig {
2565
+ /** 前缀列表 */
2566
+ prefixes: string[];
2567
+ /** 屏幕路径配置 */
2568
+ config: {
2569
+ /** 初始路由 */
2570
+ initialRouteName?: string;
2571
+ /** 屏幕路径映射 */
2572
+ screens: Record<string, PathConfig>;
2573
+ };
2574
+ /** 获取初始 URL */
2575
+ getInitialURL?: () => Promise<string | null | undefined>;
2576
+ /** 订阅 URL 变化 */
2577
+ subscribe?: (listener: (url: string) => void) => () => void;
2578
+ }
2579
+
2580
+ /**
2581
+ * 堆栈导航器 Props
2582
+ */
2583
+ interface StackNavigatorProps {
2584
+ /** 初始路由名称 */
2585
+ initialRouteName?: string;
2586
+ /** 屏幕选项配置 */
2587
+ screenOptions?: StackScreenOptions;
2588
+ /** 子元素 */
2589
+ children?: React.ReactNode;
2590
+ }
2591
+ /**
2592
+ * 标签导航器 Props
2593
+ */
2594
+ interface TabNavigatorProps {
2595
+ /** 初始路由名称 */
2596
+ initialRouteName?: string;
2597
+ /** 标签栏选项配置 */
2598
+ tabBarOptions?: TabBarOptions;
2599
+ /** 自定义标签栏组件 */
2600
+ tabBar?: (props: _react_navigation_bottom_tabs.BottomTabBarProps) => React.ReactNode;
2601
+ /** 屏幕选项配置 */
2602
+ screenOptions?: TabScreenOptions;
2603
+ /** 子元素 */
2604
+ children?: React.ReactNode;
2605
+ }
2606
+ /**
2607
+ * 抽屉导航器 Props
2608
+ */
2609
+ interface DrawerNavigatorProps {
2610
+ /** 初始路由名称 */
2611
+ initialRouteName?: string;
2612
+ /** 屏幕选项配置 */
2613
+ screenOptions?: DrawerScreenOptions;
2614
+ /** 自定义抽屉内容组件 */
2615
+ drawerContent?: (props: any) => React.ReactNode;
2616
+ /** 抽屉配置 */
2617
+ drawerOptions?: DrawerOptions;
2618
+ /** 子元素 */
2619
+ children?: React.ReactNode;
2620
+ }
2621
+
2622
+ /**
2623
+ * 导航 Hook 返回类型
2624
+ * @module navigation/types/navigation
2625
+ */
2626
+
2627
+ /**
2628
+ * 堆栈屏幕组件 Props
2629
+ * @template T - 路由名称
2630
+ */
2631
+ type StackScreenProps<T extends keyof StackParamList> = StackScreenProps$1<StackParamList, T>;
2632
+ /**
2633
+ * 标签屏幕组件 Props
2634
+ * @template T - 路由名称
2635
+ */
2636
+ type TabScreenProps<T extends keyof TabParamList> = BottomTabScreenProps<TabParamList, T>;
2637
+ /**
2638
+ * 抽屉屏幕组件 Props
2639
+ * @template T - 路由名称
2640
+ */
2641
+ type DrawerScreenProps<T extends keyof DrawerParamList> = DrawerScreenProps$1<DrawerParamList, T>;
2642
+ /**
2643
+ * 堆栈导航 Hook 返回类型
2644
+ */
2645
+ type StackNavigation = StackNavigationProp<StackParamList>;
2646
+ /**
2647
+ * 标签导航 Hook 返回类型
2648
+ */
2649
+ type TabNavigation = BottomTabNavigationProp<TabParamList>;
2650
+ /**
2651
+ * 抽屉导航 Hook 返回类型
2652
+ */
2653
+ type DrawerNavigation = DrawerNavigationProp<DrawerParamList>;
2654
+ /**
2655
+ * 通用导航 Hook 返回类型
2656
+ */
2657
+ type AppNavigation = NavigationProp<StackParamList & TabParamList & DrawerParamList>;
2658
+
2659
+ /**
2660
+ * 导航模块类型定义
2661
+ *
2662
+ * @module navigation/types
2663
+ * @description 提供完整的导航类型定义,支持类型安全的路由配置
2664
+ */
2665
+
2666
+ declare global {
2667
+ namespace ReactNavigation {
2668
+ interface RootParamList extends StackParamList, TabParamList, DrawerParamList {
2669
+ }
2670
+ }
2671
+ }
2672
+
2673
+ /**
2674
+ * 堆栈导航器组件
2675
+ *
2676
+ * 封装 React Navigation 的 JS Stack Navigator,默认使用 iOS 风格的右滑推进转场。
2677
+ * 如需覆盖默认转场,请在 screenOptions 或单个 Screen options 中显式传入。
2678
+ *
2679
+ * @example
2680
+ * ```tsx
2681
+ * // JSX 方式
2682
+ * <StackNavigator initialRouteName="Home">
2683
+ * <StackNavigator.Screen
2684
+ * name="Home"
2685
+ * component={HomeScreen}
2686
+ * options={{ title: '首页' }}
2687
+ * />
2688
+ * <StackNavigator.Screen
2689
+ * name="Detail"
2690
+ * component={DetailScreen}
2691
+ * options={{ title: '详情', headerShown: true }}
2692
+ * />
2693
+ * </StackNavigator>
2694
+ * ```
2695
+ */
2696
+ declare function StackNavigator({ initialRouteName, screenOptions, children }: StackNavigatorProps): react_jsx_runtime.JSX.Element;
2697
+ declare namespace StackNavigator {
2698
+ var Screen: <RouteName extends string | number>(_: _react_navigation_native.RouteConfig<StackParamList, RouteName, _react_navigation_routers.StackNavigationState<StackParamList>, _react_navigation_stack.StackNavigationOptions, _react_navigation_stack.StackNavigationEventMap, {
2699
+ [x: string]: _react_navigation_stack.StackNavigationProp<StackParamList, string, string | undefined>;
2700
+ }[RouteName]>) => null;
2701
+ var Group: React__default.ComponentType<_react_navigation_native.RouteGroupConfig<StackParamList, _react_navigation_stack.StackNavigationOptions, _react_navigation_stack.StackNavigationProp<StackParamList, string, string | undefined>>>;
2702
+ }
2703
+ /**
2704
+ * 基于配置创建堆栈导航器
2705
+ * 支持更灵活的路由配置方式
2706
+ *
2707
+ * @example
2708
+ * ```tsx
2709
+ * const stackConfig: StackRouteConfig[] = [
2710
+ * { name: 'Home', component: HomeScreen, options: { title: '首页' } },
2711
+ * { name: 'Detail', component: DetailScreen },
2712
+ * ];
2713
+ *
2714
+ * <StackNavigator initialRouteName="Home">
2715
+ * {createStackScreens(stackConfig)}
2716
+ * </StackNavigator>
2717
+ * ```
2718
+ */
2719
+ declare function createStackScreens(routes: StackRouteConfig[]): React__default.ReactNode[];
2720
+
2721
+ /**
2722
+ * 标签导航器组件
2723
+ *
2724
+ * 封装 React Navigation 的 Bottom Tab Navigator
2725
+ *
2726
+ * @example
2727
+ * ```tsx
2728
+ * // JSX 方式
2729
+ * <TabNavigator
2730
+ * initialRouteName="Home"
2731
+ * tabBarOptions={{ activeTintColor: '#f38b32' }}
2732
+ * >
2733
+ * <TabNavigator.Screen
2734
+ * name="Home"
2735
+ * component={HomeScreen}
2736
+ * options={{
2737
+ * tabBarLabel: '首页',
2738
+ * tabBarIcon: ({ color, size }) => <Icon name="home" color={color} size={size} />
2739
+ * }}
2740
+ * />
2741
+ * <TabNavigator.Screen
2742
+ * name="Profile"
2743
+ * component={ProfileScreen}
2744
+ * options={{ tabBarLabel: '我的' }}
2745
+ * />
2746
+ * </TabNavigator>
2747
+ * ```
2748
+ */
2749
+ declare function TabNavigator({ initialRouteName, tabBarOptions, tabBar, screenOptions, children, }: TabNavigatorProps): react_jsx_runtime.JSX.Element;
2750
+ declare namespace TabNavigator {
2751
+ var Screen: <RouteName extends string | number>(_: _react_navigation_native.RouteConfig<TabParamList, RouteName, _react_navigation_routers.TabNavigationState<TabParamList>, _react_navigation_bottom_tabs.BottomTabNavigationOptions, _react_navigation_bottom_tabs.BottomTabNavigationEventMap, {
2752
+ [x: string]: _react_navigation_bottom_tabs.BottomTabNavigationProp<TabParamList, string, string | undefined>;
2753
+ }[RouteName]>) => null;
2754
+ }
2755
+ /**
2756
+ * 基于配置创建标签屏幕
2757
+ *
2758
+ * @example
2759
+ * ```tsx
2760
+ * const tabConfig: TabRouteConfig[] = [
2761
+ * {
2762
+ * name: 'Home',
2763
+ * component: HomeScreen,
2764
+ * options: { tabBarLabel: '首页', tabBarIcon: HomeIcon }
2765
+ * },
2766
+ * {
2767
+ * name: 'Profile',
2768
+ * component: ProfileScreen,
2769
+ * options: { tabBarLabel: '我的' }
2770
+ * },
2771
+ * ];
2772
+ *
2773
+ * <TabNavigator>
2774
+ * {createTabScreens(tabConfig)}
2775
+ * </TabNavigator>
2776
+ * ```
2777
+ */
2778
+ declare function createTabScreens(routes: TabRouteConfig[]): React__default.ReactNode[];
2779
+
2780
+ /**
2781
+ * 抽屉导航器组件
2782
+ *
2783
+ * 封装 React Navigation 的 Drawer Navigator,自动集成主题
2784
+ *
2785
+ * @example
2786
+ * ```tsx
2787
+ * // 基础使用
2788
+ * <DrawerNavigator>
2789
+ * <DrawerNavigator.Screen name="Home" component={HomeScreen} />
2790
+ * <DrawerNavigator.Screen name="Settings" component={SettingsScreen} />
2791
+ * </DrawerNavigator>
2792
+ *
2793
+ * // 自定义抽屉内容
2794
+ * <DrawerNavigator drawerContent={props => <CustomDrawerContent {...props} />}>
2795
+ * <DrawerNavigator.Screen name="Home" component={HomeScreen} />
2796
+ * </DrawerNavigator>
2797
+ * ```
2798
+ */
2799
+ declare function DrawerNavigator({ initialRouteName, screenOptions, drawerContent, drawerOptions, children, }: DrawerNavigatorProps): react_jsx_runtime.JSX.Element;
2800
+ declare namespace DrawerNavigator {
2801
+ var Screen: <RouteName extends string | number>(_: _react_navigation_native.RouteConfig<DrawerParamList, RouteName, _react_navigation_routers.DrawerNavigationState<DrawerParamList>, _react_navigation_drawer.DrawerNavigationOptions, _react_navigation_drawer.DrawerNavigationEventMap, {
2802
+ [x: string]: _react_navigation_drawer.DrawerNavigationProp<DrawerParamList, string, string | undefined>;
2803
+ }[RouteName]>) => null;
2804
+ }
2805
+ /**
2806
+ * 基于配置创建抽屉屏幕
2807
+ *
2808
+ * @example
2809
+ * ```tsx
2810
+ * const drawerConfig: DrawerRouteConfig[] = [
2811
+ * { name: 'Home', component: HomeScreen, options: { drawerLabel: '首页' } },
2812
+ * { name: 'Settings', component: SettingsScreen },
2813
+ * ];
2814
+ *
2815
+ * <DrawerNavigator>
2816
+ * {createDrawerScreens(drawerConfig)}
2817
+ * </DrawerNavigator>
2818
+ * ```
2819
+ */
2820
+ declare function createDrawerScreens(routes: DrawerRouteConfig[]): React__default.ReactNode[];
2821
+
2822
+ /**
2823
+ * 右侧图标配置
2824
+ */
2825
+ interface RightIcon {
2826
+ /** 图标名称 */
2827
+ icon: string;
2828
+ /** 点击回调 */
2829
+ onPress: () => void;
2830
+ /** 徽标数量(可选) */
2831
+ badge?: number;
2832
+ }
2833
+ /**
2834
+ * 应用头部组件 Props
2835
+ */
2836
+ interface AppHeaderProps {
2837
+ /** 标题 */
2838
+ title?: string;
2839
+ /** 副标题 */
2840
+ subtitle?: string;
2841
+ /** 左侧图标名称(默认为 'chevron-left' iOS风格) */
2842
+ leftIcon?: string | null;
2843
+ /** 左侧图标点击回调 */
2844
+ onLeftPress?: () => void;
2845
+ /** 右侧图标列表 */
2846
+ rightIcons?: RightIcon[];
2847
+ /** 是否透明背景 */
2848
+ transparent?: boolean;
2849
+ /** 是否启用模糊效果(暂未实现) */
2850
+ blur?: boolean;
2851
+ /** 是否包含安全区域(默认为 true) */
2852
+ safeArea?: boolean;
2853
+ /** 自定义样式 */
2854
+ style?: ViewStyle;
2855
+ }
2856
+ /**
2857
+ * 应用头部组件
2858
+ *
2859
+ * iOS 风格的顶部导航栏,标题始终居中,不受左右按钮影响
2860
+ *
2861
+ * @example
2862
+ * ```tsx
2863
+ * // 基本用法
2864
+ * <AppHeader title="首页" />
2865
+ *
2866
+ * // 带右侧按钮
2867
+ * <AppHeader
2868
+ * title="消息"
2869
+ * rightIcons={[
2870
+ * { icon: 'search', onPress: () => {} },
2871
+ * { icon: 'notifications', onPress: () => {}, badge: 5 }
2872
+ * ]}
2873
+ * />
2874
+ *
2875
+ * // 透明背景
2876
+ * <AppHeader title="详情" transparent onLeftPress={() => navigation.goBack()} />
2877
+ *
2878
+ * // 无左侧按钮
2879
+ * <AppHeader title="首页" leftIcon={null} />
2880
+ * ```
2881
+ */
2882
+ declare function AppHeader({ title, subtitle, leftIcon, onLeftPress, rightIcons, transparent, safeArea, style, }: AppHeaderProps): react_jsx_runtime.JSX.Element;
2883
+
2884
+ /**
2885
+ * 自定义底部标签栏组件 Props
2886
+ * 继承自 @react-navigation/bottom-tabs 的 BottomTabBarProps
2887
+ */
2888
+ interface CustomBottomTabBarProps extends BottomTabBarProps {
2889
+ /** 是否显示标签 */
2890
+ showLabel?: boolean;
2891
+ /** 激活颜色 */
2892
+ activeTintColor?: string;
2893
+ /** 未激活颜色 */
2894
+ inactiveTintColor?: string;
2895
+ /** TabBar 高度(默认 65) */
2896
+ height?: number;
2897
+ /** 激活背景色 */
2898
+ activeBackgroundColor?: string;
2899
+ /** 非激活背景色 */
2900
+ inactiveBackgroundColor?: string;
2901
+ /** 图标容器样式 */
2902
+ iconStyle?: ViewStyle;
2903
+ /** 标签样式 */
2904
+ labelStyle?: TextStyle;
2905
+ /** 标签栏样式 */
2906
+ style?: ViewStyle;
2907
+ }
2908
+ /**
2909
+ * 自定义底部标签栏组件
2910
+ *
2911
+ * 自定义样式的底部标签栏,支持徽标、图标、标签等
2912
+ *
2913
+ * @example
2914
+ * ```tsx
2915
+ * <TabNavigator
2916
+ * tabBar={props => <BottomTabBar {...props} showLabel={true} activeTintColor="#f38b32" />}
2917
+ * >
2918
+ * <TabNavigator.Screen name="Home" component={HomeScreen} />
2919
+ * <TabNavigator.Screen name="Profile" component={ProfileScreen} />
2920
+ * </TabNavigator>
2921
+ * ```
2922
+ */
2923
+ declare function BottomTabBar({ state, descriptors, navigation, showLabel, activeTintColor, inactiveTintColor, height, activeBackgroundColor, inactiveBackgroundColor, iconStyle, labelStyle, style, }: CustomBottomTabBarProps): react_jsx_runtime.JSX.Element;
2924
+
2925
+ /**
2926
+ * 抽屉菜单项配置
2927
+ */
2928
+ interface DrawerItem {
2929
+ /** 路由名称 */
2930
+ name: string;
2931
+ /** 显示标签 */
2932
+ label: string;
2933
+ /** 图标名称 */
2934
+ icon?: string;
2935
+ /** 徽标 */
2936
+ badge?: number | string;
2937
+ }
2938
+ /**
2939
+ * 抽屉内容组件 Props
2940
+ */
2941
+ interface DrawerContentProps extends DrawerContentComponentProps {
2942
+ /** 头部内容(如用户信息) */
2943
+ header?: React__default.ReactNode;
2944
+ /** 底部内容(如退出按钮) */
2945
+ footer?: React__default.ReactNode;
2946
+ /** 自定义项目列表(如果不提供则使用路由列表) */
2947
+ items?: DrawerItem[];
2948
+ /** 激活背景色 */
2949
+ activeBackgroundColor?: string;
2950
+ /** 激活文字颜色 */
2951
+ activeTintColor?: string;
2952
+ /** 未激活文字颜色 */
2953
+ inactiveTintColor?: string;
2954
+ }
2955
+ /**
2956
+ * 抽屉内容组件
2957
+ *
2958
+ * 自定义抽屉导航的内容模板,支持头部、底部、自定义菜单项等
2959
+ *
2960
+ * @example
2961
+ * ```tsx
2962
+ * <DrawerNavigator
2963
+ * drawerContent={props => (
2964
+ * <DrawerContent
2965
+ * {...props}
2966
+ * header={<UserInfo name="张三" email="zhangsan@example.com" />}
2967
+ * footer={<LogoutButton />}
2968
+ * items={[
2969
+ * { name: 'Home', label: '首页', icon: 'home' },
2970
+ * { name: 'Settings', label: '设置', icon: 'settings' }
2971
+ * ]}
2972
+ * />
2973
+ * )}
2974
+ * >
2975
+ * <DrawerNavigator.Screen name="Home" component={HomeScreen} />
2976
+ * <DrawerNavigator.Screen name="Settings" component={SettingsScreen} />
2977
+ * </DrawerNavigator>
2978
+ * ```
2979
+ */
2980
+ declare function DrawerContent({ state, descriptors, navigation, header, footer, items, activeBackgroundColor, activeTintColor, inactiveTintColor, }: DrawerContentProps): react_jsx_runtime.JSX.Element;
2981
+
2982
+ /**
2983
+ * 导航 Hooks
2984
+ *
2985
+ * @module navigation/hooks/useNavigation
2986
+ * @description 提供导航相关的 React Hooks
2987
+ */
2988
+
2989
+ /**
2990
+ * 获取 React Navigation 原始导航实例
2991
+ *
2992
+ * 适合业务应用在需要自定义导航参数类型时直接使用。
2993
+ *
2994
+ * @example
2995
+ * ```tsx
2996
+ * type AuthNavigation = NativeStackNavigationProp<AuthStackParamList>;
2997
+ *
2998
+ * function LoginScreen() {
2999
+ * const navigation = useNavigation<AuthNavigation>();
3000
+ * return <Button onPress={() => navigation.navigate('Register')} title="注册" />;
3001
+ * }
3002
+ * ```
3003
+ */
3004
+ declare function useNavigation<T extends NavigationProp<ParamListBase$1> = NavigationProp<ParamListBase$1>>(): T;
3005
+ /**
3006
+ * 获取堆栈导航实例
3007
+ *
3008
+ * @returns 堆栈导航对象,包含 navigate、goBack、push 等方法
3009
+ *
3010
+ * @example
3011
+ * ```tsx
3012
+ * function HomeScreen() {
3013
+ * const navigation = useStackNavigation();
3014
+ *
3015
+ * const goToDetail = () => {
3016
+ * navigation.navigate('Detail', { id: '123' });
3017
+ * };
3018
+ *
3019
+ * return <Button onPress={goToDetail} title="查看详情" />;
3020
+ * }
3021
+ * ```
3022
+ */
3023
+ declare function useStackNavigation(): StackNavigation;
3024
+ /**
3025
+ * 获取标签导航实例
3026
+ *
3027
+ * @returns 标签导航对象
3028
+ *
3029
+ * @example
3030
+ * ```tsx
3031
+ * function ProfileScreen() {
3032
+ * const navigation = useTabNavigation();
3033
+ *
3034
+ * const switchToHome = () => {
3035
+ * navigation.navigate('Home');
3036
+ * };
3037
+ *
3038
+ * return <Button onPress={switchToHome} title="返回首页" />;
3039
+ * }
3040
+ * ```
3041
+ */
3042
+ declare function useTabNavigation(): TabNavigation;
3043
+ /**
3044
+ * 获取抽屉导航实例
3045
+ *
3046
+ * @returns 抽屉导航对象
3047
+ *
3048
+ * @example
3049
+ * ```tsx
3050
+ * function SettingsScreen() {
3051
+ * const navigation = useDrawerNavigation();
3052
+ *
3053
+ * const openDrawer = () => {
3054
+ * navigation.openDrawer();
3055
+ * };
3056
+ *
3057
+ * return <Button onPress={openDrawer} title="打开菜单" />;
3058
+ * }
3059
+ * ```
3060
+ */
3061
+ declare function useDrawerNavigation(): DrawerNavigation;
3062
+ /**
3063
+ * 处理安卓返回键
3064
+ *
3065
+ * 仅在安卓设备上有效,iOS 无效果
3066
+ *
3067
+ * @param handler - 返回 true 阻止默认返回行为,返回 false 允许默认行为
3068
+ *
3069
+ * @example
3070
+ * ```tsx
3071
+ * function ConfirmExitScreen() {
3072
+ * const navigation = useStackNavigation();
3073
+ *
3074
+ * useBackHandler(() => {
3075
+ * // 显示确认对话框
3076
+ * if (hasUnsavedChanges) {
3077
+ * showConfirmDialog();
3078
+ * return true; // 阻止默认返回
3079
+ * }
3080
+ * return false; // 允许默认返回
3081
+ * });
3082
+ *
3083
+ * return <ScreenContent />;
3084
+ * }
3085
+ * ```
3086
+ */
3087
+ declare function useBackHandler(handler: () => boolean): void;
3088
+
3089
+ /**
3090
+ * 路由相关 Hooks
3091
+ * @module navigation/hooks/useRoute
3092
+ */
3093
+
3094
+ /**
3095
+ * 获取当前路由信息
3096
+ *
3097
+ * @returns 当前路由对象,包含 name、params、key 等
3098
+ *
3099
+ * @example
3100
+ * ```tsx
3101
+ * function DetailScreen() {
3102
+ * const route = useRoute<'Detail'>();
3103
+ * const { id } = route.params;
3104
+ *
3105
+ * return <Text>详情 ID: {id}</Text>;
3106
+ * }
3107
+ * ```
3108
+ */
3109
+ declare function useRoute<T extends keyof StackParamList>(): RouteProp<StackParamList, T>;
3110
+
3111
+ /**
3112
+ * 导航状态 Hooks
3113
+ * @module navigation/hooks/useNavigationState
3114
+ */
3115
+
3116
+ /**
3117
+ * 获取导航状态
3118
+ *
3119
+ * @param selector - 状态选择器函数
3120
+ * @returns 选中的状态值
3121
+ *
3122
+ * @example
3123
+ * ```tsx
3124
+ * // 获取当前路由名称
3125
+ * const routeName = useNavigationState(state => state.routes[state.index].name);
3126
+ *
3127
+ * // 获取路由历史
3128
+ * const routes = useNavigationState(state => state.routes);
3129
+ * ```
3130
+ */
3131
+ declare function useNavigationState<T>(selector: (state: NavigationState) => T): T;
3132
+
3133
+ declare function createNavigationTheme(pantherTheme: Theme, isDark: boolean): Theme$1;
3134
+
3135
+ interface AppStatusBarProps extends Omit<StatusBarProps, 'barStyle' | 'backgroundColor' | 'translucent'> {
3136
+ /** 状态栏文字样式,auto 表示跟随当前主题 */
3137
+ barStyle?: StatusBarStyle | 'auto';
3138
+ /** Android 状态栏背景色,默认跟随主题背景色 */
3139
+ backgroundColor?: string;
3140
+ /** 是否启用沉浸式状态栏,默认 false */
3141
+ translucent?: boolean;
3142
+ /** 测试标识 */
3143
+ testID?: string;
3144
+ }
3145
+ /**
3146
+ * 全局状态栏组件
3147
+ *
3148
+ * - 默认根据当前主题自动切换明暗文字
3149
+ * - 默认跟随主题背景色
3150
+ * - 页面可通过手动渲染该组件进行局部覆盖
3151
+ */
3152
+ declare function AppStatusBar({ barStyle, backgroundColor, translucent, ...props }: AppStatusBarProps): react_jsx_runtime.JSX.Element;
3153
+
3154
+ /**
3155
+ * AppProvider Props
3156
+ */
3157
+ interface AppProviderProps extends Omit<NavigationProviderProps, 'children'> {
3158
+ /** 子元素 */
3159
+ children: React__default.ReactNode;
3160
+ /**
3161
+ * 是否启用导航(默认 true)
3162
+ * 如果已在其他地方提供 NavigationContainer,请设为 false
3163
+ */
3164
+ enableNavigation?: boolean;
3165
+ /** 是否启用全局 Overlay(Loading/Toast/Alert,默认 true) */
3166
+ enableOverlay?: boolean;
3167
+ /** 是否启用主题(默认 true) */
3168
+ enableTheme?: boolean;
3169
+ /** 是否启用全局状态栏管理(默认 true) */
3170
+ enableStatusBar?: boolean;
3171
+ /** 是否启用安全区域(默认 true) */
3172
+ enableSafeArea?: boolean;
3173
+ /** 自定义亮色主题 */
3174
+ lightTheme?: ThemeConfig;
3175
+ /** 自定义暗色主题 */
3176
+ darkTheme?: ThemeConfig;
3177
+ /** 默认使用暗色模式 */
3178
+ defaultDark?: boolean;
3179
+ /** 受控暗色模式 */
3180
+ isDark?: boolean;
3181
+ /** 全局状态栏配置 */
3182
+ statusBarProps?: AppStatusBarProps;
3183
+ }
3184
+ /**
3185
+ * 统一应用 Provider
3186
+ *
3187
+ * 整合:SafeAreaProvider + ThemeProvider + NavigationProvider + OverlayProvider
3188
+ * 提供一键式应用初始化方案
3189
+ *
3190
+ * @example
3191
+ * ```tsx
3192
+ * // 基础使用
3193
+ * import { AppProvider } from '@gaozh1024/rn-kit';
3194
+ * import { RootNavigator } from './navigation';
3195
+ *
3196
+ * export default function App() {
3197
+ * return (
3198
+ * <AppProvider>
3199
+ * <RootNavigator />
3200
+ * </AppProvider>
3201
+ * );
3202
+ * }
3203
+ * ```
3204
+ *
3205
+ * @example
3206
+ * ```tsx
3207
+ * // 带深度链接
3208
+ * import { AppProvider } from '@gaozh1024/rn-kit';
3209
+ *
3210
+ * export default function App() {
3211
+ * return (
3212
+ * <AppProvider
3213
+ * linking={{
3214
+ * prefixes: ['myapp://', 'https://myapp.com'],
3215
+ * config: {
3216
+ * screens: {
3217
+ * Home: 'home',
3218
+ * Detail: 'detail/:id',
3219
+ * },
3220
+ * },
3221
+ * }}
3222
+ * fallback={<LoadingScreen />}
3223
+ * >
3224
+ * <RootNavigator />
3225
+ * </AppProvider>
3226
+ * );
3227
+ * }
3228
+ * ```
3229
+ *
3230
+ * @example
3231
+ * ```tsx
3232
+ * // 禁用部分功能
3233
+ * <AppProvider
3234
+ * enableNavigation={true}
3235
+ * enableOverlay={true}
3236
+ * enableTheme={true}
3237
+ * enableSafeArea={true}
3238
+ * >
3239
+ * <YourApp />
3240
+ * </AppProvider>
3241
+ * ```
3242
+ *
3243
+ * @example
3244
+ * ```tsx
3245
+ * // 自定义主题
3246
+ * <AppProvider
3247
+ * lightTheme={{
3248
+ * colors: {
3249
+ * primary: '#1890ff',
3250
+ * success: '#52c41a',
3251
+ * // ... 其他颜色
3252
+ * },
3253
+ * }}
3254
+ * darkTheme={{
3255
+ * colors: {
3256
+ * primary: '#40a9ff',
3257
+ * // ... 其他颜色
3258
+ * },
3259
+ * }}
3260
+ * >
3261
+ * <App />
3262
+ * </AppProvider>
3263
+ * ```
3264
+ *
3265
+ * @example
3266
+ * ```tsx
3267
+ * // 使用外部 NavigationContainer
3268
+ * import { NavigationContainer } from '@react-navigation/native';
3269
+ *
3270
+ * export default function App() {
3271
+ * return (
3272
+ * <NavigationContainer>
3273
+ * <AppProvider enableNavigation={false}>
3274
+ * <RootNavigator />
3275
+ * </AppProvider>
3276
+ * </NavigationContainer>
3277
+ * );
3278
+ * }
3279
+ * ```
3280
+ */
3281
+ declare function AppProvider({ children, enableNavigation, enableOverlay, enableTheme, enableStatusBar, enableSafeArea, lightTheme, darkTheme, defaultDark, isDark, statusBarProps, ...navigationProps }: AppProviderProps): react_jsx_runtime.JSX.Element;
3282
+
3283
+ /**
3284
+ * Overlay Provider Props
3285
+ */
3286
+ interface OverlayProviderProps {
3287
+ children: React__default.ReactNode;
3288
+ }
3289
+ /**
3290
+ * 统一 Overlay Provider
3291
+ *
3292
+ * 整合:LoadingProvider + ToastProvider + AlertProvider
3293
+ * 提供全局 Loading、Toast、Alert 功能
3294
+ */
3295
+ declare function OverlayProvider({ children }: OverlayProviderProps): react_jsx_runtime.JSX.Element;
3296
+
3297
+ /**
3298
+ * Loading 子系统类型定义
3299
+ * @module overlay/loading/types
3300
+ */
3301
+ /**
3302
+ * Loading 状态
3303
+ */
3304
+ interface LoadingState {
3305
+ visible: boolean;
3306
+ text?: string;
3307
+ }
3308
+ /**
3309
+ * Loading 上下文类型
3310
+ */
3311
+ interface LoadingContextType {
3312
+ /** 显示 Loading */
3313
+ show: (text?: string) => void;
3314
+ /** 隐藏 Loading */
3315
+ hide: () => void;
3316
+ }
3317
+
3318
+ /**
3319
+ * Loading 子系统 Hooks
3320
+ * @module overlay/loading/hooks
3321
+ */
3322
+
3323
+ /**
3324
+ * 使用 Loading 控制
3325
+ * @returns Loading 控制方法
3326
+ * @example
3327
+ * ```tsx
3328
+ * function MyComponent() {
3329
+ * const { show, hide } = useLoading();
3330
+ *
3331
+ * const handleSubmit = async () => {
3332
+ * show('提交中...');
3333
+ * await submitData();
3334
+ * hide();
3335
+ * };
3336
+ * }
3337
+ * ```
3338
+ */
3339
+ declare function useLoading(): LoadingContextType;
3340
+
3341
+ /**
3342
+ * Toast 子系统类型定义
3343
+ * @module overlay/toast/types
3344
+ */
3345
+ /**
3346
+ * Toast 类型
3347
+ */
3348
+ type ToastType = 'success' | 'error' | 'info' | 'warning';
3349
+ /**
3350
+ * Toast 项
3351
+ */
3352
+ interface ToastItem {
3353
+ id: string;
3354
+ message: string;
3355
+ type: ToastType;
3356
+ duration?: number;
3357
+ }
3358
+ /**
3359
+ * Toast 上下文类型
3360
+ */
3361
+ interface ToastContextType {
3362
+ /** 显示 Toast */
3363
+ show: (message: string, type?: ToastType, duration?: number) => void;
3364
+ /** 显示成功 Toast */
3365
+ success: (message: string, duration?: number) => void;
3366
+ /** 显示错误 Toast */
3367
+ error: (message: string, duration?: number) => void;
3368
+ /** 显示信息 Toast */
3369
+ info: (message: string, duration?: number) => void;
3370
+ /** 显示警告 Toast */
3371
+ warning: (message: string, duration?: number) => void;
3372
+ }
3373
+
3374
+ /**
3375
+ * Toast 子系统 Hooks
3376
+ * @module overlay/toast/hooks
3377
+ */
3378
+
3379
+ /**
3380
+ * 使用 Toast 控制
3381
+ * @returns Toast 控制方法
3382
+ * @example
3383
+ * ```tsx
3384
+ * function MyComponent() {
3385
+ * const { success, error } = useToast();
3386
+ *
3387
+ * const handleSubmit = async () => {
3388
+ * try {
3389
+ * await submitData();
3390
+ * success('提交成功!');
3391
+ * } catch (e) {
3392
+ * error('提交失败');
3393
+ * }
3394
+ * };
3395
+ * }
3396
+ * ```
3397
+ */
3398
+ declare function useToast(): ToastContextType;
3399
+
3400
+ /**
3401
+ * Alert 子系统类型定义
3402
+ * @module overlay/alert/types
3403
+ */
3404
+ /**
3405
+ * Alert 选项
3406
+ */
3407
+ interface AlertOptions {
3408
+ /** 标题 */
3409
+ title?: string;
3410
+ /** 消息内容 */
3411
+ message?: string;
3412
+ /** 确认按钮文本 */
3413
+ confirmText?: string;
3414
+ /** 取消按钮文本 */
3415
+ cancelText?: string;
3416
+ /** 确认回调 */
3417
+ onConfirm?: () => void;
3418
+ /** 取消回调 */
3419
+ onCancel?: () => void;
3420
+ /** 是否显示取消按钮 */
3421
+ showCancel?: boolean;
3422
+ }
3423
+ /**
3424
+ * Alert 上下文类型
3425
+ */
3426
+ interface AlertContextType {
3427
+ /** 显示 Alert */
3428
+ alert: (options: AlertOptions) => void;
3429
+ /** 显示确认对话框 */
3430
+ confirm: (options: Omit<AlertOptions, 'showCancel'>) => void;
3431
+ }
3432
+
3433
+ /**
3434
+ * Alert 子系统 Hooks
3435
+ * @module overlay/alert/hooks
3436
+ */
3437
+
3438
+ /**
3439
+ * 使用 Alert 控制
3440
+ * @returns Alert 控制方法
3441
+ * @example
3442
+ * ```tsx
3443
+ * function MyComponent() {
3444
+ * const { alert, confirm } = useAlert();
3445
+ *
3446
+ * const handleDelete = () => {
3447
+ * confirm({
3448
+ * title: '确认删除',
3449
+ * message: '此操作不可撤销',
3450
+ * onConfirm: () => deleteItem(),
3451
+ * });
3452
+ * };
3453
+ *
3454
+ * const handleNotify = () => {
3455
+ * alert({
3456
+ * title: '提示',
3457
+ * message: '操作成功',
3458
+ * });
3459
+ * };
3460
+ * }
3461
+ * ```
3462
+ */
3463
+ declare function useAlert(): AlertContextType;
3464
+
3465
+ export { ActionIcons, Alert, type AlertContextType, type AlertOptions, type AlertProps, type ApiBusinessErrorParser, type ApiConfig, type ApiEndpointConfig, type ApiErrorContext, type ApiErrorHandler, type ApiMethod, AppButton, type AppButtonProps, type AppError, AppHeader, type AppHeaderProps, AppImage, type AppImageProps, AppInput, type AppInputProps, AppList, type AppListProps, type AppNavigation, AppPressable, type AppPressableProps, AppProvider, type AppProviderProps, AppScrollView, type AppScrollViewProps, AppStatusBar, type AppStatusBarProps, AppText, type AppTextProps, AppView, type AppViewProps, BottomTabBar, Card, type CardProps, Center, type CenterProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Col, type ColProps, type ColorPalette$1 as ColorPalette, type ColorToken, type CustomBottomTabBarProps, DatePicker, type DatePickerProps, DrawerContent, type DrawerContentProps, type DrawerItem, type DrawerNavigation, DrawerNavigator, type DrawerNavigatorProps, type DrawerOptions, type DrawerParamList, type DrawerRouteConfig, type DrawerScreenOptions, type DrawerScreenProps, ErrorCode, FileIcons, FormItem, type FormItemProps, Icon, type IconProps, type IconSize, type InfiniteFetchParams, type InfiniteFetchResult, type LinkingConfig, Loading, type LoadingContextType, type LoadingProps, type LoadingState, MemoryStorage, NavigationIcons, NavigationProvider, type NavigationProviderProps, type Orientation, OverlayProvider, type OverlayProviderProps, Page, type PaginationParams, type PaginationResult, type ParamListBase, type PathConfig, Progress, type ProgressProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RgbObject, type RouteConfig, Row, type RowProps, SafeBottom, SafeScreen, type SafeScreenProps, Select, type SelectOption, type SelectProps, Slider, type SliderProps, type StackNavigation, StackNavigator, type StackNavigatorProps, type StackParamList, type StackRouteConfig, type StackScreenOptions, type StackScreenProps, StatusIcons, Switch, type SwitchProps, type TabBarOptions, type TabNavigation, TabNavigator, type TabNavigatorProps, type TabParamList, type TabRouteConfig, type TabScreenOptions, type TabScreenProps, type Theme, type ColorPalette as ThemeColorPalette, type ThemeConfig, ThemeProvider, Toast, type ToastContextType, type ToastItem, type ToastProps, type ToastType, type UseAsyncState, type UseDimensionsReturn, type UseInfiniteOptions, type UseInfiniteReturn, type UseKeyboardReturn, type UseOrientationReturn, type UsePaginationOptions, type UsePaginationReturn, type UseRefreshReturn, type UseToggleActions, adjustBrightness, capitalize, clamp, cn, createAPI, createDrawerScreens, createNavigationTheme, createStackScreens, createTabScreens, createTheme, deepMerge, enhanceError, formatCurrency, formatDate, formatNumber, formatPercent, formatRelativeTime, generateColorPalette, getThemeColors, getValidationErrors, hexToRgb, isDevelopment, isValidEmail, isValidPhone, mapHttpStatus, omit, pick, rgbToHex, slugify, storage, truncate, useAlert, useAsyncState, useBackHandler, useDebounce, useDimensions, useDrawerNavigation, useForm, useInfinite, useKeyboard, useLoading, useMemoizedFn, useNavigation, useNavigationState, useOrientation, usePagination, usePrevious, useRefresh, useRequest, useRoute, useSetState, useStackNavigation, useStorage, useTabNavigation, useTheme, useThemeColors, useThrottle, useToast, useToggle, useUpdateEffect };