@gaozh1024/rn-kit 0.2.0-beta.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -34,6 +34,7 @@ yarn add @gaozh1024/rn-kit
34
34
  npm install react react-native
35
35
  npm install react-native-screens react-native-safe-area-context
36
36
  npm install react-native-gesture-handler react-native-reanimated
37
+ npx expo install expo-linear-gradient
37
38
  npm install react-native-svg
38
39
  ```
39
40
 
@@ -158,7 +159,9 @@ import {
158
159
  Card,
159
160
  Icon,
160
161
  AppImage,
161
- AppList, // 数据展示
162
+ AppList,
163
+ GradientView,
164
+ PageDrawer, // 数据展示 / 页面级抽屉
162
165
  Checkbox,
163
166
  Radio,
164
167
  Switch,
@@ -173,6 +176,7 @@ import {
173
176
  import {
174
177
  // UI Hooks
175
178
  useToggle,
179
+ usePageDrawer,
176
180
  useDebounce,
177
181
  useThrottle,
178
182
  useKeyboard,
@@ -225,6 +229,116 @@ import {
225
229
  </TabNavigator>
226
230
  ```
227
231
 
232
+ ### 🧲 抽屉
233
+
234
+ 框架同时提供两类抽屉能力:
235
+
236
+ - **导航级抽屉**:`DrawerNavigator` / `DrawerContent`
237
+ - **页面级抽屉**:`PageDrawer`
238
+
239
+ #### 1. 页面级抽屉
240
+
241
+ 适合当前页面内的筛选面板、操作栏、详情侧栏。
242
+
243
+ ```tsx
244
+ import React from 'react';
245
+ import { AppButton, AppText, AppView, PageDrawer } from '@gaozh1024/rn-kit';
246
+
247
+ function FilterPanel() {
248
+ const [visible, setVisible] = React.useState(false);
249
+
250
+ return (
251
+ <>
252
+ <AppButton onPress={() => setVisible(true)}>打开筛选</AppButton>
253
+
254
+ <PageDrawer
255
+ visible={visible}
256
+ onClose={() => setVisible(false)}
257
+ title="筛选条件"
258
+ placement="right"
259
+ width={320}
260
+ >
261
+ <AppView gap={3}>
262
+ <AppText>这里放筛选项</AppText>
263
+ </AppView>
264
+ </PageDrawer>
265
+ </>
266
+ );
267
+ }
268
+ ```
269
+
270
+ `PageDrawer` 支持:
271
+
272
+ - 左 / 右侧抽屉
273
+ - 点击遮罩关闭
274
+ - 自定义 `header` / `footer`
275
+ - 手势滑动关闭
276
+ - Android 返回键优先关闭抽屉
277
+
278
+ 常用参数:
279
+
280
+ - `placement`: `'left' | 'right'`
281
+ - `width`: 抽屉宽度,默认 `320`
282
+ - `swipeEnabled`: 是否启用手势关闭,默认 `true`
283
+ - `swipeThreshold`: 触发关闭阈值,默认 `80`
284
+ - `closeOnBackdropPress`: 点击遮罩关闭,默认 `true`
285
+
286
+ ### 🌈 渐变背景
287
+
288
+ 框架提供 `GradientView` 作为渐变背景容器,底层封装 `expo-linear-gradient`。
289
+
290
+ ```tsx
291
+ import { GradientView, AppText } from '@gaozh1024/rn-kit';
292
+
293
+ <GradientView
294
+ colors={['#f38b32', '#fb923c']}
295
+ style={{ padding: 24, borderRadius: 16 }}
296
+ >
297
+ <AppText color="white" weight="bold">
298
+ 渐变卡片
299
+ </AppText>
300
+ </GradientView>;
301
+ ```
302
+
303
+ 如果你的应用是手动集成 `@gaozh1024/rn-kit`,请同时安装:
304
+
305
+ ```bash
306
+ npx expo install expo-linear-gradient
307
+ ```
308
+
309
+ 如果你不想在页面里重复写 `useState(false)`,也可以直接使用:
310
+
311
+ ```tsx
312
+ import { AppButton, PageDrawer, usePageDrawer } from '@gaozh1024/rn-kit';
313
+
314
+ const drawer = usePageDrawer();
315
+
316
+ <AppButton onPress={drawer.open}>打开</AppButton>;
317
+ <PageDrawer visible={drawer.visible} onClose={drawer.close} />;
318
+ ```
319
+
320
+ #### 2. 导航级抽屉
321
+
322
+ 适合整个导航结构都交给抽屉接管的场景:
323
+
324
+ ```tsx
325
+ import { DrawerContent, DrawerNavigator } from '@gaozh1024/rn-kit';
326
+
327
+ <DrawerNavigator
328
+ drawerContent={props => (
329
+ <DrawerContent
330
+ {...props}
331
+ items={[
332
+ { name: 'Home', label: '首页', icon: 'home' },
333
+ { name: 'Settings', label: '设置', icon: 'settings' },
334
+ ]}
335
+ />
336
+ )}
337
+ >
338
+ {/* screens */}
339
+ </DrawerNavigator>;
340
+ ```
341
+
228
342
  ### 🔌 API 工厂
229
343
 
230
344
  ```tsx
package/dist/index.d.mts CHANGED
@@ -7,6 +7,7 @@ import * as React$1 from 'react';
7
7
  import React__default from 'react';
8
8
  export { useMutation, useQuery } from '@tanstack/react-query';
9
9
  import { ViewProps, ScrollViewProps, TextProps, PressableProps, StyleProp, TextStyle, ImageSourcePropType, ImageStyle, ListRenderItem, ViewStyle, TextInputProps, TextInput, StatusBarProps, StatusBarStyle } from 'react-native';
10
+ import { LinearGradientProps } from 'expo-linear-gradient';
10
11
  import * as _react_navigation_native from '@react-navigation/native';
11
12
  import { LinkingOptions, Theme as Theme$1, NavigationProp, ParamListBase as ParamListBase$1, RouteProp, NavigationState } from '@react-navigation/native';
12
13
  export { NavigationContainer, NavigationContainerRef, NavigationProp, NavigationState, RouteProp, useFocusEffect, useIsFocused, useScrollToTop } from '@react-navigation/native';
@@ -1649,7 +1650,7 @@ interface LoadingProps {
1649
1650
  * );
1650
1651
  * ```
1651
1652
  */
1652
- declare function Loading({ text, color, overlay, visible, testID, }: LoadingProps): react_jsx_runtime.JSX.Element | null;
1653
+ declare function Loading({ text, color, overlay, visible, testID }: LoadingProps): react_jsx_runtime.JSX.Element | null;
1653
1654
 
1654
1655
  /**
1655
1656
  * Progress 组件属性接口
@@ -1933,6 +1934,65 @@ interface AppListProps<T = any> {
1933
1934
  }
1934
1935
  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
+ interface PageDrawerProps {
1938
+ /** 是否显示 */
1939
+ visible: boolean;
1940
+ /** 关闭回调 */
1941
+ onClose?: () => void;
1942
+ /** 标题 */
1943
+ title?: string;
1944
+ /** 自定义头部 */
1945
+ header?: React__default.ReactNode;
1946
+ /** 自定义底部 */
1947
+ footer?: React__default.ReactNode;
1948
+ /** 抽屉位置 */
1949
+ placement?: 'left' | 'right';
1950
+ /** 抽屉宽度 */
1951
+ width?: number;
1952
+ /** 是否启用手势关闭 */
1953
+ swipeEnabled?: boolean;
1954
+ /** 关闭阈值 */
1955
+ swipeThreshold?: number;
1956
+ /** 点击遮罩是否关闭 */
1957
+ closeOnBackdropPress?: boolean;
1958
+ /** 是否显示关闭按钮 */
1959
+ showCloseButton?: boolean;
1960
+ /** 内容 */
1961
+ children?: React__default.ReactNode;
1962
+ /** 测试 ID */
1963
+ testID?: string;
1964
+ /** 内容测试 ID */
1965
+ contentTestID?: string;
1966
+ /** 遮罩测试 ID */
1967
+ backdropTestID?: string;
1968
+ }
1969
+ declare function PageDrawer({ visible, onClose, title, header, footer, placement, width, swipeEnabled, swipeThreshold, closeOnBackdropPress, showCloseButton, children, testID, contentTestID, backdropTestID, }: PageDrawerProps): react_jsx_runtime.JSX.Element | null;
1970
+
1971
+ interface GradientViewProps extends Omit<LinearGradientProps, 'colors' | 'style' | 'children'> {
1972
+ /** 渐变色列表,至少两个颜色 */
1973
+ colors: readonly [string, string, ...string[]];
1974
+ /** 子元素 */
1975
+ children?: React__default.ReactNode;
1976
+ /** 自定义容器样式 */
1977
+ style?: StyleProp<ViewStyle>;
1978
+ }
1979
+ /**
1980
+ * GradientView - 渐变背景容器
1981
+ *
1982
+ * 对 expo-linear-gradient 的轻量封装,用于页面级/卡片级渐变背景。
1983
+ *
1984
+ * @example
1985
+ * ```tsx
1986
+ * <GradientView
1987
+ * colors={['#f38b32', '#fb923c']}
1988
+ * style={{ padding: 24, borderRadius: 16 }}
1989
+ * >
1990
+ * <AppText color="white">渐变标题</AppText>
1991
+ * </GradientView>
1992
+ * ```
1993
+ */
1994
+ declare function GradientView({ colors, start, end, children, style, ...props }: GradientViewProps): react_jsx_runtime.JSX.Element;
1995
+
1936
1996
  /**
1937
1997
  * AppInput 组件属性接口
1938
1998
  */
@@ -1972,15 +2032,16 @@ interface CheckboxProps {
1972
2032
  */
1973
2033
  declare function Checkbox({ checked, defaultChecked, onChange, disabled, children, className, testID, }: CheckboxProps): react_jsx_runtime.JSX.Element;
1974
2034
 
1975
- interface Option$1 {
2035
+ interface FormGroupOption {
1976
2036
  label: string;
1977
2037
  value: string;
1978
2038
  disabled?: boolean;
1979
2039
  }
2040
+
1980
2041
  interface CheckboxGroupProps {
1981
2042
  value?: string[];
1982
2043
  onChange?: (value: string[]) => void;
1983
- options?: Option$1[];
2044
+ options?: FormGroupOption[];
1984
2045
  direction?: 'row' | 'column';
1985
2046
  disabled?: boolean;
1986
2047
  }
@@ -2003,15 +2064,10 @@ interface RadioProps {
2003
2064
  */
2004
2065
  declare function Radio({ checked, defaultChecked, onChange, disabled, children, className, testID, }: RadioProps): react_jsx_runtime.JSX.Element;
2005
2066
 
2006
- interface Option {
2007
- label: string;
2008
- value: string;
2009
- disabled?: boolean;
2010
- }
2011
2067
  interface RadioGroupProps {
2012
2068
  value?: string;
2013
2069
  onChange?: (value: string) => void;
2014
- options?: Option[];
2070
+ options?: FormGroupOption[];
2015
2071
  direction?: 'row' | 'column';
2016
2072
  disabled?: boolean;
2017
2073
  }
@@ -2126,23 +2182,25 @@ interface FormItemProps {
2126
2182
  }
2127
2183
  declare function FormItem({ name: _name, label, error, help, required, children, className, labelClassName, }: FormItemProps): react_jsx_runtime.JSX.Element;
2128
2184
 
2129
- interface UseFormOptions<T extends Record<string, any>> {
2185
+ type FormValues = Record<string, unknown>;
2186
+ type FieldName<T extends FormValues> = Extract<keyof T, string>;
2187
+ interface UseFormOptions<T extends FormValues> {
2130
2188
  schema: ZodSchema<T>;
2131
2189
  defaultValues: T;
2132
2190
  }
2133
2191
  interface FormErrors {
2134
2192
  [key: string]: string;
2135
2193
  }
2136
- declare function useForm<T extends Record<string, any>>({ schema, defaultValues, }: UseFormOptions<T>): {
2194
+ declare function useForm<T extends FormValues>({ schema, defaultValues }: UseFormOptions<T>): {
2137
2195
  values: T;
2138
2196
  errors: FormErrors;
2139
2197
  isValid: boolean;
2140
2198
  isDirty: boolean;
2141
2199
  isSubmitting: boolean;
2142
- setValue: (name: keyof T, value: any) => void;
2143
- getValue: (name: keyof T) => T[keyof T];
2200
+ setValue: <K extends FieldName<T>>(name: K, value: T[K]) => void;
2201
+ getValue: <K extends FieldName<T>>(name: K) => T[K];
2144
2202
  validate: () => Promise<boolean>;
2145
- validateField: (name: keyof T) => Promise<boolean>;
2203
+ validateField: (name: FieldName<T>) => Promise<boolean>;
2146
2204
  reset: () => void;
2147
2205
  handleSubmit: (onSubmit?: (values: T) => void | Promise<void>) => Promise<void>;
2148
2206
  };
@@ -2172,6 +2230,34 @@ interface UseToggleActions {
2172
2230
  */
2173
2231
  declare function useToggle(defaultValue?: boolean): [boolean, UseToggleActions];
2174
2232
 
2233
+ interface UsePageDrawerReturn {
2234
+ /** 当前是否打开 */
2235
+ visible: boolean;
2236
+ /** 打开抽屉 */
2237
+ open: () => void;
2238
+ /** 关闭抽屉 */
2239
+ close: () => void;
2240
+ /** 切换抽屉开关状态 */
2241
+ toggle: () => void;
2242
+ /** 直接设置抽屉可见状态 */
2243
+ setVisible: (visible: boolean) => void;
2244
+ }
2245
+ /**
2246
+ * 页面级抽屉状态管理 Hook
2247
+ *
2248
+ * @param defaultVisible - 默认是否打开
2249
+ * @returns 抽屉可见状态和控制方法
2250
+ *
2251
+ * @example
2252
+ * ```tsx
2253
+ * const drawer = usePageDrawer();
2254
+ *
2255
+ * <AppButton onPress={drawer.open}>打开筛选</AppButton>
2256
+ * <PageDrawer visible={drawer.visible} onClose={drawer.close} />
2257
+ * ```
2258
+ */
2259
+ declare function usePageDrawer(defaultVisible?: boolean): UsePageDrawerReturn;
2260
+
2175
2261
  /**
2176
2262
  * 防抖 Hook
2177
2263
  * @param value - 需要防抖的值
@@ -3462,4 +3548,4 @@ interface AlertContextType {
3462
3548
  */
3463
3549
  declare function useAlert(): AlertContextType;
3464
3550
 
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 };
3551
+ 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, type FormErrors, type FormGroupOption, FormItem, type FormItemProps, GradientView, type GradientViewProps, 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, PageDrawer, type PageDrawerProps, 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 UseFormOptions, type UseInfiniteOptions, type UseInfiniteReturn, type UseKeyboardReturn, type UseOrientationReturn, type UsePageDrawerReturn, 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, usePageDrawer, usePagination, usePrevious, useRefresh, useRequest, useRoute, useSetState, useStackNavigation, useStorage, useTabNavigation, useTheme, useThemeColors, useThrottle, useToast, useToggle, useUpdateEffect };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import * as React$1 from 'react';
7
7
  import React__default from 'react';
8
8
  export { useMutation, useQuery } from '@tanstack/react-query';
9
9
  import { ViewProps, ScrollViewProps, TextProps, PressableProps, StyleProp, TextStyle, ImageSourcePropType, ImageStyle, ListRenderItem, ViewStyle, TextInputProps, TextInput, StatusBarProps, StatusBarStyle } from 'react-native';
10
+ import { LinearGradientProps } from 'expo-linear-gradient';
10
11
  import * as _react_navigation_native from '@react-navigation/native';
11
12
  import { LinkingOptions, Theme as Theme$1, NavigationProp, ParamListBase as ParamListBase$1, RouteProp, NavigationState } from '@react-navigation/native';
12
13
  export { NavigationContainer, NavigationContainerRef, NavigationProp, NavigationState, RouteProp, useFocusEffect, useIsFocused, useScrollToTop } from '@react-navigation/native';
@@ -1649,7 +1650,7 @@ interface LoadingProps {
1649
1650
  * );
1650
1651
  * ```
1651
1652
  */
1652
- declare function Loading({ text, color, overlay, visible, testID, }: LoadingProps): react_jsx_runtime.JSX.Element | null;
1653
+ declare function Loading({ text, color, overlay, visible, testID }: LoadingProps): react_jsx_runtime.JSX.Element | null;
1653
1654
 
1654
1655
  /**
1655
1656
  * Progress 组件属性接口
@@ -1933,6 +1934,65 @@ interface AppListProps<T = any> {
1933
1934
  }
1934
1935
  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
+ interface PageDrawerProps {
1938
+ /** 是否显示 */
1939
+ visible: boolean;
1940
+ /** 关闭回调 */
1941
+ onClose?: () => void;
1942
+ /** 标题 */
1943
+ title?: string;
1944
+ /** 自定义头部 */
1945
+ header?: React__default.ReactNode;
1946
+ /** 自定义底部 */
1947
+ footer?: React__default.ReactNode;
1948
+ /** 抽屉位置 */
1949
+ placement?: 'left' | 'right';
1950
+ /** 抽屉宽度 */
1951
+ width?: number;
1952
+ /** 是否启用手势关闭 */
1953
+ swipeEnabled?: boolean;
1954
+ /** 关闭阈值 */
1955
+ swipeThreshold?: number;
1956
+ /** 点击遮罩是否关闭 */
1957
+ closeOnBackdropPress?: boolean;
1958
+ /** 是否显示关闭按钮 */
1959
+ showCloseButton?: boolean;
1960
+ /** 内容 */
1961
+ children?: React__default.ReactNode;
1962
+ /** 测试 ID */
1963
+ testID?: string;
1964
+ /** 内容测试 ID */
1965
+ contentTestID?: string;
1966
+ /** 遮罩测试 ID */
1967
+ backdropTestID?: string;
1968
+ }
1969
+ declare function PageDrawer({ visible, onClose, title, header, footer, placement, width, swipeEnabled, swipeThreshold, closeOnBackdropPress, showCloseButton, children, testID, contentTestID, backdropTestID, }: PageDrawerProps): react_jsx_runtime.JSX.Element | null;
1970
+
1971
+ interface GradientViewProps extends Omit<LinearGradientProps, 'colors' | 'style' | 'children'> {
1972
+ /** 渐变色列表,至少两个颜色 */
1973
+ colors: readonly [string, string, ...string[]];
1974
+ /** 子元素 */
1975
+ children?: React__default.ReactNode;
1976
+ /** 自定义容器样式 */
1977
+ style?: StyleProp<ViewStyle>;
1978
+ }
1979
+ /**
1980
+ * GradientView - 渐变背景容器
1981
+ *
1982
+ * 对 expo-linear-gradient 的轻量封装,用于页面级/卡片级渐变背景。
1983
+ *
1984
+ * @example
1985
+ * ```tsx
1986
+ * <GradientView
1987
+ * colors={['#f38b32', '#fb923c']}
1988
+ * style={{ padding: 24, borderRadius: 16 }}
1989
+ * >
1990
+ * <AppText color="white">渐变标题</AppText>
1991
+ * </GradientView>
1992
+ * ```
1993
+ */
1994
+ declare function GradientView({ colors, start, end, children, style, ...props }: GradientViewProps): react_jsx_runtime.JSX.Element;
1995
+
1936
1996
  /**
1937
1997
  * AppInput 组件属性接口
1938
1998
  */
@@ -1972,15 +2032,16 @@ interface CheckboxProps {
1972
2032
  */
1973
2033
  declare function Checkbox({ checked, defaultChecked, onChange, disabled, children, className, testID, }: CheckboxProps): react_jsx_runtime.JSX.Element;
1974
2034
 
1975
- interface Option$1 {
2035
+ interface FormGroupOption {
1976
2036
  label: string;
1977
2037
  value: string;
1978
2038
  disabled?: boolean;
1979
2039
  }
2040
+
1980
2041
  interface CheckboxGroupProps {
1981
2042
  value?: string[];
1982
2043
  onChange?: (value: string[]) => void;
1983
- options?: Option$1[];
2044
+ options?: FormGroupOption[];
1984
2045
  direction?: 'row' | 'column';
1985
2046
  disabled?: boolean;
1986
2047
  }
@@ -2003,15 +2064,10 @@ interface RadioProps {
2003
2064
  */
2004
2065
  declare function Radio({ checked, defaultChecked, onChange, disabled, children, className, testID, }: RadioProps): react_jsx_runtime.JSX.Element;
2005
2066
 
2006
- interface Option {
2007
- label: string;
2008
- value: string;
2009
- disabled?: boolean;
2010
- }
2011
2067
  interface RadioGroupProps {
2012
2068
  value?: string;
2013
2069
  onChange?: (value: string) => void;
2014
- options?: Option[];
2070
+ options?: FormGroupOption[];
2015
2071
  direction?: 'row' | 'column';
2016
2072
  disabled?: boolean;
2017
2073
  }
@@ -2126,23 +2182,25 @@ interface FormItemProps {
2126
2182
  }
2127
2183
  declare function FormItem({ name: _name, label, error, help, required, children, className, labelClassName, }: FormItemProps): react_jsx_runtime.JSX.Element;
2128
2184
 
2129
- interface UseFormOptions<T extends Record<string, any>> {
2185
+ type FormValues = Record<string, unknown>;
2186
+ type FieldName<T extends FormValues> = Extract<keyof T, string>;
2187
+ interface UseFormOptions<T extends FormValues> {
2130
2188
  schema: ZodSchema<T>;
2131
2189
  defaultValues: T;
2132
2190
  }
2133
2191
  interface FormErrors {
2134
2192
  [key: string]: string;
2135
2193
  }
2136
- declare function useForm<T extends Record<string, any>>({ schema, defaultValues, }: UseFormOptions<T>): {
2194
+ declare function useForm<T extends FormValues>({ schema, defaultValues }: UseFormOptions<T>): {
2137
2195
  values: T;
2138
2196
  errors: FormErrors;
2139
2197
  isValid: boolean;
2140
2198
  isDirty: boolean;
2141
2199
  isSubmitting: boolean;
2142
- setValue: (name: keyof T, value: any) => void;
2143
- getValue: (name: keyof T) => T[keyof T];
2200
+ setValue: <K extends FieldName<T>>(name: K, value: T[K]) => void;
2201
+ getValue: <K extends FieldName<T>>(name: K) => T[K];
2144
2202
  validate: () => Promise<boolean>;
2145
- validateField: (name: keyof T) => Promise<boolean>;
2203
+ validateField: (name: FieldName<T>) => Promise<boolean>;
2146
2204
  reset: () => void;
2147
2205
  handleSubmit: (onSubmit?: (values: T) => void | Promise<void>) => Promise<void>;
2148
2206
  };
@@ -2172,6 +2230,34 @@ interface UseToggleActions {
2172
2230
  */
2173
2231
  declare function useToggle(defaultValue?: boolean): [boolean, UseToggleActions];
2174
2232
 
2233
+ interface UsePageDrawerReturn {
2234
+ /** 当前是否打开 */
2235
+ visible: boolean;
2236
+ /** 打开抽屉 */
2237
+ open: () => void;
2238
+ /** 关闭抽屉 */
2239
+ close: () => void;
2240
+ /** 切换抽屉开关状态 */
2241
+ toggle: () => void;
2242
+ /** 直接设置抽屉可见状态 */
2243
+ setVisible: (visible: boolean) => void;
2244
+ }
2245
+ /**
2246
+ * 页面级抽屉状态管理 Hook
2247
+ *
2248
+ * @param defaultVisible - 默认是否打开
2249
+ * @returns 抽屉可见状态和控制方法
2250
+ *
2251
+ * @example
2252
+ * ```tsx
2253
+ * const drawer = usePageDrawer();
2254
+ *
2255
+ * <AppButton onPress={drawer.open}>打开筛选</AppButton>
2256
+ * <PageDrawer visible={drawer.visible} onClose={drawer.close} />
2257
+ * ```
2258
+ */
2259
+ declare function usePageDrawer(defaultVisible?: boolean): UsePageDrawerReturn;
2260
+
2175
2261
  /**
2176
2262
  * 防抖 Hook
2177
2263
  * @param value - 需要防抖的值
@@ -3462,4 +3548,4 @@ interface AlertContextType {
3462
3548
  */
3463
3549
  declare function useAlert(): AlertContextType;
3464
3550
 
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 };
3551
+ 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, type FormErrors, type FormGroupOption, FormItem, type FormItemProps, GradientView, type GradientViewProps, 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, PageDrawer, type PageDrawerProps, 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 UseFormOptions, type UseInfiniteOptions, type UseInfiniteReturn, type UseKeyboardReturn, type UseOrientationReturn, type UsePageDrawerReturn, 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, usePageDrawer, usePagination, usePrevious, useRefresh, useRequest, useRoute, useSetState, useStackNavigation, useStorage, useTabNavigation, useTheme, useThemeColors, useThrottle, useToast, useToggle, useUpdateEffect };