@unif/react-native-design 0.31.3 → 0.32.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 +6 -0
- package/lib/module/components/ui/Avatar/Avatar.js +2 -1
- package/lib/module/components/ui/Avatar/Avatar.js.map +1 -1
- package/lib/module/components/ui/Avatar/geometry.js +43 -0
- package/lib/module/components/ui/Avatar/geometry.js.map +1 -0
- package/lib/module/components/ui/Avatar/styles.js +1 -41
- package/lib/module/components/ui/Avatar/styles.js.map +1 -1
- package/lib/module/components/ui/AvatarGroup/AvatarGroup.js +1 -1
- package/lib/module/components/ui/AvatarGroup/AvatarGroup.js.map +1 -1
- package/lib/module/components/ui/CircularProgress/CircularProgress.js +14 -25
- package/lib/module/components/ui/CircularProgress/CircularProgress.js.map +1 -1
- package/lib/module/components/ui/CircularProgress/normalizeCircularProgress.js.map +1 -1
- package/lib/module/components/ui/CircularProgress/styles.js +24 -0
- package/lib/module/components/ui/CircularProgress/styles.js.map +1 -0
- package/lib/module/components/ui/Pulse/PulseDot.js +5 -5
- package/lib/module/components/ui/Pulse/PulseDot.js.map +1 -1
- package/lib/module/components/ui/Pulse/constants.js +15 -0
- package/lib/module/components/ui/Pulse/constants.js.map +1 -0
- package/lib/module/components/ui/Pulse/usePulse.js +4 -62
- package/lib/module/components/ui/Pulse/usePulse.js.map +1 -1
- package/lib/module/components/ui/Skeleton/Skeleton.js +6 -2
- package/lib/module/components/ui/Skeleton/Skeleton.js.map +1 -1
- package/lib/module/components/ui/Skeleton/constants.js +9 -0
- package/lib/module/components/ui/Skeleton/constants.js.map +1 -0
- package/lib/module/components/ui/TextField/TextFieldBase.js +21 -4
- package/lib/module/components/ui/TextField/TextFieldBase.js.map +1 -1
- package/lib/module/components/ui/TextField/constants.js +7 -0
- package/lib/module/components/ui/TextField/constants.js.map +1 -0
- package/lib/module/components/ui/TextField/styles.js +10 -2
- package/lib/module/components/ui/TextField/styles.js.map +1 -1
- package/lib/module/components/ui/TextField/useMultilineLayout.js +18 -0
- package/lib/module/components/ui/TextField/useMultilineLayout.js.map +1 -0
- package/lib/module/components/ui/TextField/useMultilineLayout.web.js +44 -0
- package/lib/module/components/ui/TextField/useMultilineLayout.web.js.map +1 -0
- package/lib/module/components/ui/Thumbnail/Thumbnail.js +13 -6
- package/lib/module/components/ui/Thumbnail/Thumbnail.js.map +1 -1
- package/lib/module/components/ui/Thumbnail/constants.js +22 -0
- package/lib/module/components/ui/Thumbnail/constants.js.map +1 -0
- package/lib/module/components/ui/Thumbnail/normalize.js +30 -1
- package/lib/module/components/ui/Thumbnail/normalize.js.map +1 -1
- package/lib/module/components/ui/Thumbnail/styles.js +5 -28
- package/lib/module/components/ui/Thumbnail/styles.js.map +1 -1
- package/lib/module/components/ui/index.js.map +1 -1
- package/lib/module/components/ui/shared/pulse/constants.js +5 -0
- package/lib/module/components/ui/shared/pulse/constants.js.map +1 -0
- package/lib/module/components/ui/{Pulse → shared/pulse}/normalizePulseOptions.js +2 -12
- package/lib/module/components/ui/shared/pulse/normalizePulseOptions.js.map +1 -0
- package/lib/module/components/ui/shared/pulse/types.js +2 -0
- package/lib/module/components/ui/shared/pulse/types.js.map +1 -0
- package/lib/module/components/ui/shared/pulse/usePulseAnimation.js +30 -0
- package/lib/module/components/ui/shared/pulse/usePulseAnimation.js.map +1 -0
- package/lib/module/components/ui/{Pulse → shared/pulse}/usePulseDriver.js +1 -1
- package/lib/module/components/ui/shared/pulse/usePulseDriver.js.map +1 -0
- package/lib/module/components/ui/{Pulse → shared/pulse}/usePulseDriver.web.js +2 -17
- package/lib/module/components/ui/shared/pulse/usePulseDriver.web.js.map +1 -0
- package/lib/typescript/src/components/ui/Avatar/Avatar.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Avatar/geometry.d.ts +7 -0
- package/lib/typescript/src/components/ui/Avatar/geometry.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Avatar/styles.d.ts +1 -9
- package/lib/typescript/src/components/ui/Avatar/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Avatar/types.d.ts +7 -2
- package/lib/typescript/src/components/ui/Avatar/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/CircularProgress/CircularProgress.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/CircularProgress/normalizeCircularProgress.d.ts +2 -14
- package/lib/typescript/src/components/ui/CircularProgress/normalizeCircularProgress.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/CircularProgress/styles.d.ts +19 -0
- package/lib/typescript/src/components/ui/CircularProgress/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/CircularProgress/types.d.ts +17 -2
- package/lib/typescript/src/components/ui/CircularProgress/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/PulseDot.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/constants.d.ts +4 -0
- package/lib/typescript/src/components/ui/Pulse/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Pulse/types.d.ts +6 -6
- package/lib/typescript/src/components/ui/Pulse/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Pulse/usePulse.d.ts +0 -9
- package/lib/typescript/src/components/ui/Pulse/usePulse.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Skeleton/constants.d.ts +3 -0
- package/lib/typescript/src/components/ui/Skeleton/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Skeleton/types.d.ts +2 -2
- package/lib/typescript/src/components/ui/Skeleton/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/TextFieldBase.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/constants.d.ts +4 -0
- package/lib/typescript/src/components/ui/TextField/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/styles.d.ts +6 -0
- package/lib/typescript/src/components/ui/TextField/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/types.d.ts +36 -11
- package/lib/typescript/src/components/ui/TextField/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/useMultilineLayout.d.ts +4 -0
- package/lib/typescript/src/components/ui/TextField/useMultilineLayout.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/useMultilineLayout.web.d.ts +4 -0
- package/lib/typescript/src/components/ui/TextField/useMultilineLayout.web.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Textarea/types.d.ts +4 -2
- package/lib/typescript/src/components/ui/Textarea/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/constants.d.ts +4 -0
- package/lib/typescript/src/components/ui/Thumbnail/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/Thumbnail/index.d.ts +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/normalize.d.ts +2 -6
- package/lib/typescript/src/components/ui/Thumbnail/normalize.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/styles.d.ts +9 -8
- package/lib/typescript/src/components/ui/Thumbnail/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Thumbnail/types.d.ts +23 -5
- package/lib/typescript/src/components/ui/Thumbnail/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/index.d.ts +1 -1
- package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/shared/pulse/constants.d.ts +2 -0
- package/lib/typescript/src/components/ui/shared/pulse/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/pulse/normalizePulseOptions.d.ts +7 -0
- package/lib/typescript/src/components/ui/shared/pulse/normalizePulseOptions.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/pulse/types.d.ts +17 -0
- package/lib/typescript/src/components/ui/shared/pulse/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/pulse/usePulseAnimation.d.ts +8 -0
- package/lib/typescript/src/components/ui/shared/pulse/usePulseAnimation.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/{Pulse → shared/pulse}/usePulseDriver.d.ts +1 -1
- package/lib/typescript/src/components/ui/shared/pulse/usePulseDriver.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/shared/pulse/usePulseDriver.web.d.ts +7 -0
- package/lib/typescript/src/components/ui/shared/pulse/usePulseDriver.web.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/ui/Avatar/Avatar.tsx +2 -6
- package/src/components/ui/Avatar/geometry.ts +30 -0
- package/src/components/ui/Avatar/styles.ts +2 -30
- package/src/components/ui/Avatar/types.ts +8 -2
- package/src/components/ui/AvatarGroup/AvatarGroup.tsx +1 -1
- package/src/components/ui/CircularProgress/CircularProgress.tsx +20 -26
- package/src/components/ui/CircularProgress/normalizeCircularProgress.ts +7 -15
- package/src/components/ui/CircularProgress/styles.ts +13 -0
- package/src/components/ui/CircularProgress/types.ts +19 -2
- package/src/components/ui/Pulse/PulseDot.tsx +6 -5
- package/src/components/ui/Pulse/constants.ts +14 -0
- package/src/components/ui/Pulse/types.ts +6 -6
- package/src/components/ui/Pulse/usePulse.ts +4 -81
- package/src/components/ui/Skeleton/Skeleton.tsx +6 -6
- package/src/components/ui/Skeleton/constants.ts +8 -0
- package/src/components/ui/Skeleton/types.ts +2 -2
- package/src/components/ui/TextField/TextFieldBase.tsx +28 -4
- package/src/components/ui/TextField/constants.ts +6 -0
- package/src/components/ui/TextField/styles.ts +8 -2
- package/src/components/ui/TextField/types.ts +41 -11
- package/src/components/ui/TextField/useMultilineLayout.ts +20 -0
- package/src/components/ui/TextField/useMultilineLayout.web.ts +59 -0
- package/src/components/ui/Textarea/types.ts +9 -6
- package/src/components/ui/Thumbnail/Thumbnail.tsx +19 -5
- package/src/components/ui/Thumbnail/constants.ts +24 -0
- package/src/components/ui/Thumbnail/index.ts +1 -0
- package/src/components/ui/Thumbnail/normalize.ts +38 -19
- package/src/components/ui/Thumbnail/styles.ts +6 -17
- package/src/components/ui/Thumbnail/types.ts +27 -5
- package/src/components/ui/index.ts +1 -0
- package/src/components/ui/shared/pulse/constants.ts +2 -0
- package/src/components/ui/shared/pulse/normalizePulseOptions.ts +48 -0
- package/src/components/ui/shared/pulse/types.ts +18 -0
- package/src/components/ui/shared/pulse/usePulseAnimation.ts +29 -0
- package/src/components/ui/{Pulse → shared/pulse}/usePulseDriver.ts +2 -2
- package/src/components/ui/{Pulse → shared/pulse}/usePulseDriver.web.ts +4 -19
- package/lib/module/components/ui/Pulse/normalizePulseOptions.js.map +0 -1
- package/lib/module/components/ui/Pulse/usePulseDriver.js.map +0 -1
- package/lib/module/components/ui/Pulse/usePulseDriver.web.js.map +0 -1
- package/lib/typescript/src/components/ui/Pulse/normalizePulseOptions.d.ts +0 -32
- package/lib/typescript/src/components/ui/Pulse/normalizePulseOptions.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.web.d.ts +0 -18
- package/lib/typescript/src/components/ui/Pulse/usePulseDriver.web.d.ts.map +0 -1
- package/src/components/ui/Pulse/normalizePulseOptions.ts +0 -76
|
@@ -75,7 +75,7 @@ export type { TagProps, TagSize, TagVariant } from './Tag';
|
|
|
75
75
|
export { Textarea } from './Textarea';
|
|
76
76
|
export type { TextareaProps } from './Textarea';
|
|
77
77
|
export { Thumbnail } from './Thumbnail';
|
|
78
|
-
export type { ThumbnailImageStyle, ThumbnailProps, ThumbnailSize, } from './Thumbnail';
|
|
78
|
+
export type { ThumbnailImageStyle, ThumbnailDimensions, ThumbnailProps, ThumbnailSize, } from './Thumbnail';
|
|
79
79
|
export { toast, ToastHost } from './Toast';
|
|
80
80
|
export type { ToastEntry, ToastHostProps, ToastInput, ToastKind, ToastPosition, } from './Toast';
|
|
81
81
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|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M,QAAQ,CAAC;AACjD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3C,YAAY,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS,QAAU,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PulseOptions } from '../../Pulse/types';
|
|
2
|
+
import type { NormalizedPulseOptions, PulseDefaults } from './types';
|
|
3
|
+
/** 共用的参数校验:非法字段采用所属组件默认值并报告诊断,不夹值或取整。 */
|
|
4
|
+
export declare function normalizePulseOptions(input: PulseOptions | undefined, defaults: Readonly<PulseDefaults>): NormalizedPulseOptions;
|
|
5
|
+
/** driver 是否应当启动循环。静态或系统开启减弱动效时都不启动。 */
|
|
6
|
+
export declare const shouldAnimatePulse: (options: NormalizedPulseOptions, reducedMotion: boolean) => boolean;
|
|
7
|
+
//# sourceMappingURL=normalizePulseOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizePulseOptions.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/normalizePulseOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EAEd,MAAM,SAAS,CAAC;AAGjB,yCAAyC;AACzC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,YAAK,EACxB,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,GAChC,sBAAsB,CA6BxB;AAED,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,GAC7B,SAAS,sBAAsB,EAC/B,eAAe,OAAO,KACrB,OAA8C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface PulseDefaults {
|
|
2
|
+
duration: number;
|
|
3
|
+
delay: number;
|
|
4
|
+
from: number;
|
|
5
|
+
to: number;
|
|
6
|
+
}
|
|
7
|
+
export interface PulseDiagnostic {
|
|
8
|
+
field: keyof PulseDefaults;
|
|
9
|
+
received: unknown;
|
|
10
|
+
fallback: number;
|
|
11
|
+
}
|
|
12
|
+
export interface NormalizedPulseOptions extends PulseDefaults {
|
|
13
|
+
/** 两端相等 —— 没有可播的动画,driver 直接停在 `to`。 */
|
|
14
|
+
isStatic: boolean;
|
|
15
|
+
diagnostics: readonly PulseDiagnostic[];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,aAAa,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,SAAS,eAAe,EAAE,CAAC;CACzC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { createLogger } from '../../../../utils/logger';
|
|
2
|
+
import type { PulseOptions } from '../../Pulse/types';
|
|
3
|
+
import type { PulseDefaults } from './types';
|
|
4
|
+
/** 共享参数解释与平台驱动;默认值和诊断 scope 由所属组件交付。 */
|
|
5
|
+
export declare function usePulseAnimation({ duration, delay, from, to }: PulseOptions | undefined, defaults: Readonly<PulseDefaults>, log: ReturnType<typeof createLogger>): import("react-native-reanimated/lib/typescript/hook/commonTypes").AnimatedStyleHandle<{
|
|
6
|
+
opacity: number;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=usePulseAnimation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePulseAnimation.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/usePulseAnimation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,wCAAwC;AACxC,wBAAgB,iBAAiB,CAC/B,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,YAAY,YAAK,EAChD,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,EACjC,GAAG,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC;;GAiBrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePulseDriver.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/usePulseDriver.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB;;GA4B7D"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { NormalizedPulseOptions } from './types';
|
|
2
|
+
/** Web 由 CSS 补间,timer 只按归一化后的半周期切换透明度;每个实例独立释放。 */
|
|
3
|
+
export declare function usePulseDriver(options: NormalizedPulseOptions): {
|
|
4
|
+
transition?: string | undefined;
|
|
5
|
+
opacity: number;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=usePulseDriver.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePulseDriver.web.d.ts","sourceRoot":"","sources":["../../../../../../../src/components/ui/shared/pulse/usePulseDriver.web.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD,mDAAmD;AACnD,wBAAgB,cAAc,CAAC,OAAO,EAAE,sBAAsB;;;EA4C7D"}
|
package/package.json
CHANGED
|
@@ -3,12 +3,8 @@ import { Text, View } from 'react-native';
|
|
|
3
3
|
import { scaleFontMetric, useColors, useFontScale } from '../../../theme';
|
|
4
4
|
import { resolveImageSource } from '../../../utils/imageSource';
|
|
5
5
|
import { ImageAttempt } from '../shared/ImageAttempt';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
resolveAvatarBorderRadius,
|
|
9
|
-
sizingFor,
|
|
10
|
-
styles,
|
|
11
|
-
} from './styles';
|
|
6
|
+
import { paletteFor, styles } from './styles';
|
|
7
|
+
import { resolveAvatarBorderRadius, sizingFor } from './geometry';
|
|
12
8
|
import type { AvatarProps } from './types';
|
|
13
9
|
|
|
14
10
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { avatar, radius, rf } from '../../../theme';
|
|
2
|
+
import type { AvatarGeometry, AvatarShape, AvatarSize } from './types';
|
|
3
|
+
|
|
4
|
+
/** Avatar 尺寸推导:5 档 size → { box, fs }。box 走 avatar.<size> token。
|
|
5
|
+
* 新增 size 在 types.ts 加 union + 这里加 case + tokens.ts 补 avatar.<key>。 */
|
|
6
|
+
export function sizingFor(size: AvatarSize): AvatarGeometry {
|
|
7
|
+
switch (size) {
|
|
8
|
+
case 'xs':
|
|
9
|
+
return { box: avatar.xs, fs: rf(10) };
|
|
10
|
+
case 'sm':
|
|
11
|
+
return { box: avatar.sm, fs: rf(12) };
|
|
12
|
+
case 'md':
|
|
13
|
+
return { box: avatar.md, fs: rf(13) };
|
|
14
|
+
case 'lg':
|
|
15
|
+
return { box: avatar.lg, fs: rf(15) };
|
|
16
|
+
case 'xl':
|
|
17
|
+
return { box: avatar.xl, fs: rf(20) };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** circle 保留直径一半的现有视觉;square 按尺寸使用既有圆角 token。 */
|
|
22
|
+
export function resolveAvatarBorderRadius(
|
|
23
|
+
size: AvatarSize,
|
|
24
|
+
shape: AvatarShape
|
|
25
|
+
): number {
|
|
26
|
+
if (shape === 'circle') return sizingFor(size).box / 2;
|
|
27
|
+
if (size === 'xs' || size === 'sm') return radius.xs;
|
|
28
|
+
if (size === 'xl') return radius.md;
|
|
29
|
+
return radius.sm;
|
|
30
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
2
|
+
import { fw, type ColorTokens } from '../../../theme';
|
|
3
|
+
import type { AvatarVariant } from './types';
|
|
4
4
|
|
|
5
5
|
/** Avatar 静态 base —— 容器圆角 / 尺寸由 resolver 派生。 */
|
|
6
6
|
export const styles = StyleSheet.create({
|
|
@@ -19,34 +19,6 @@ export const styles = StyleSheet.create({
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
/** Avatar 尺寸推导:5 档 size → { box, fs }。box 走 avatar.<size> token。
|
|
23
|
-
* 新增 size 在 types.ts 加 union + 这里加 case + tokens.ts 补 avatar.<key>。 */
|
|
24
|
-
export function sizingFor(size: AvatarSize): { box: number; fs: number } {
|
|
25
|
-
switch (size) {
|
|
26
|
-
case 'xs':
|
|
27
|
-
return { box: avatar.xs, fs: rf(10) };
|
|
28
|
-
case 'sm':
|
|
29
|
-
return { box: avatar.sm, fs: rf(12) };
|
|
30
|
-
case 'md':
|
|
31
|
-
return { box: avatar.md, fs: rf(13) };
|
|
32
|
-
case 'lg':
|
|
33
|
-
return { box: avatar.lg, fs: rf(15) };
|
|
34
|
-
case 'xl':
|
|
35
|
-
return { box: avatar.xl, fs: rf(20) };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** circle 保留直径一半的现有视觉;square 按尺寸使用既有圆角 token。 */
|
|
40
|
-
export function resolveAvatarBorderRadius(
|
|
41
|
-
size: AvatarSize,
|
|
42
|
-
shape: AvatarShape
|
|
43
|
-
): number {
|
|
44
|
-
if (shape === 'circle') return sizingFor(size).box / 2;
|
|
45
|
-
if (size === 'xs' || size === 'sm') return radius.xs;
|
|
46
|
-
if (size === 'xl') return radius.md;
|
|
47
|
-
return radius.sm;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
22
|
/** Avatar 配色推导:4 种 variant → { bg, fg }。签名与 Tag/Button 的 paletteFor 一致。 */
|
|
51
23
|
export function paletteFor(
|
|
52
24
|
variant: AvatarVariant,
|
|
@@ -15,7 +15,7 @@ export type AvatarShape = 'circle' | 'square';
|
|
|
15
15
|
*/
|
|
16
16
|
export type AvatarVariant = 'brand' | 'info' | 'soft' | 'neutral';
|
|
17
17
|
|
|
18
|
-
export
|
|
18
|
+
export interface AvatarProps {
|
|
19
19
|
/**
|
|
20
20
|
* 头像里显示的文字(建议 1-2 字符)。
|
|
21
21
|
* 同时作为 a11y label(screen reader 朗读);source 加载失败时回退展示。
|
|
@@ -40,4 +40,10 @@ export type AvatarProps = {
|
|
|
40
40
|
style?: StyleProp<ViewStyle>;
|
|
41
41
|
/** E2E / 测试定位 */
|
|
42
42
|
testID?: string;
|
|
43
|
-
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 头像族内部几何,不进入公共 barrel。 */
|
|
46
|
+
export interface AvatarGeometry {
|
|
47
|
+
box: number;
|
|
48
|
+
fs: number;
|
|
49
|
+
}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import { createLogger } from '../../../utils/logger';
|
|
12
12
|
import { childTestID } from '../../../utils/testID';
|
|
13
13
|
import { Avatar } from '../Avatar';
|
|
14
|
-
import { resolveAvatarBorderRadius, sizingFor } from '../Avatar/
|
|
14
|
+
import { resolveAvatarBorderRadius, sizingFor } from '../Avatar/geometry';
|
|
15
15
|
import { normalizeNonBlankText } from '../shared/accessibilityName';
|
|
16
16
|
import { resolveAvatarGroupLayout } from './layout';
|
|
17
17
|
import { normalizeAvatarGroup } from './normalize';
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
import { Text, View } from 'react-native';
|
|
2
|
-
import type { TextStyle, ViewStyle } from 'react-native';
|
|
3
2
|
import Svg, { Circle } from 'react-native-svg';
|
|
4
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
r,
|
|
5
|
+
type,
|
|
6
|
+
useColors,
|
|
7
|
+
useFontScale,
|
|
8
|
+
scaleFontMetric,
|
|
9
|
+
} from '../../../theme';
|
|
5
10
|
import { A11Y_HIDDEN_PROPS } from '../shared/a11y';
|
|
6
11
|
import { normalizeCircularProgress } from './normalizeCircularProgress';
|
|
7
12
|
import type { CircularProgressProps } from './types';
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
alignItems: 'center',
|
|
11
|
-
justifyContent: 'center',
|
|
12
|
-
} as const satisfies ViewStyle;
|
|
13
|
-
|
|
14
|
-
const VISUAL_CONTAINER_STYLE = {
|
|
15
|
-
position: 'relative',
|
|
16
|
-
} as const satisfies ViewStyle;
|
|
17
|
-
|
|
18
|
-
const LABEL_CENTER_STYLE = {
|
|
19
|
-
fontWeight: '600',
|
|
20
|
-
left: 0,
|
|
21
|
-
position: 'absolute',
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
top: 0,
|
|
24
|
-
} as const satisfies TextStyle;
|
|
14
|
+
import { styles } from './styles';
|
|
25
15
|
|
|
26
16
|
export function CircularProgress({
|
|
27
17
|
value,
|
|
@@ -36,6 +26,7 @@ export function CircularProgress({
|
|
|
36
26
|
testID,
|
|
37
27
|
}: CircularProgressProps): React.JSX.Element {
|
|
38
28
|
const colors = useColors();
|
|
29
|
+
const fontScale = useFontScale();
|
|
39
30
|
const normalized = normalizeCircularProgress({ value, size, thickness });
|
|
40
31
|
const {
|
|
41
32
|
circumference,
|
|
@@ -58,14 +49,20 @@ export function CircularProgress({
|
|
|
58
49
|
now: percentage,
|
|
59
50
|
text: `${percentage}%`,
|
|
60
51
|
}}
|
|
61
|
-
style={[
|
|
52
|
+
style={[
|
|
53
|
+
showLabel
|
|
54
|
+
? [styles.contentSize, { minHeight: safeSize, minWidth: safeSize }]
|
|
55
|
+
: { height: safeSize, width: safeSize },
|
|
56
|
+
style,
|
|
57
|
+
styles.center,
|
|
58
|
+
]}
|
|
62
59
|
testID={testID}
|
|
63
60
|
>
|
|
64
61
|
<View
|
|
65
|
-
style={[{
|
|
62
|
+
style={[{ minHeight: safeSize, minWidth: safeSize }, styles.center]}
|
|
66
63
|
{...A11Y_HIDDEN_PROPS}
|
|
67
64
|
>
|
|
68
|
-
<Svg height={safeSize} width={safeSize}>
|
|
65
|
+
<Svg height={safeSize} width={safeSize} style={styles.ring}>
|
|
69
66
|
<Circle
|
|
70
67
|
cx={center}
|
|
71
68
|
cy={center}
|
|
@@ -94,12 +91,9 @@ export function CircularProgress({
|
|
|
94
91
|
style={[
|
|
95
92
|
{
|
|
96
93
|
color: labelColor ?? colors.foreground,
|
|
97
|
-
fontSize: type.nano,
|
|
98
|
-
height: safeSize,
|
|
99
|
-
lineHeight: safeSize,
|
|
100
|
-
width: safeSize,
|
|
94
|
+
fontSize: scaleFontMetric(type.nano, fontScale),
|
|
101
95
|
},
|
|
102
|
-
|
|
96
|
+
styles.label,
|
|
103
97
|
]}
|
|
104
98
|
>
|
|
105
99
|
{`${percentage}%`}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CircularProgressInput,
|
|
3
|
+
NormalizedCircularProgress,
|
|
4
|
+
} from './types';
|
|
1
5
|
import { createLogger } from '../../../utils/logger';
|
|
2
6
|
|
|
3
7
|
const log = createLogger('CircularProgress');
|
|
4
8
|
const warnedKeys = new Set<string>();
|
|
5
9
|
|
|
6
|
-
export type NormalizedCircularProgress = Readonly<{
|
|
7
|
-
safeValue: number;
|
|
8
|
-
percentage: number;
|
|
9
|
-
safeSize: number;
|
|
10
|
-
safeThickness: number;
|
|
11
|
-
radius: number;
|
|
12
|
-
circumference: number;
|
|
13
|
-
dashOffset: number;
|
|
14
|
-
}>;
|
|
15
|
-
|
|
16
10
|
function warnOnce(key: string, message: string): void {
|
|
17
11
|
if (warnedKeys.has(key)) return;
|
|
18
12
|
warnedKeys.add(key);
|
|
19
13
|
log.warn(message);
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
export function normalizeCircularProgress(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
thickness: number;
|
|
26
|
-
}): NormalizedCircularProgress {
|
|
16
|
+
export function normalizeCircularProgress(
|
|
17
|
+
input: CircularProgressInput
|
|
18
|
+
): NormalizedCircularProgress {
|
|
27
19
|
const { value, size, thickness } = input;
|
|
28
20
|
|
|
29
21
|
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
center: { alignItems: 'center', justifyContent: 'center' },
|
|
5
|
+
// 固有尺寸避免父级 stretch 拉宽圆环,文字按自然尺寸占位。
|
|
6
|
+
contentSize: {
|
|
7
|
+
width: 'max-content',
|
|
8
|
+
height: 'max-content',
|
|
9
|
+
},
|
|
10
|
+
// 环不参与文字测量,保持显式直径;文字自然撑开最小容器。
|
|
11
|
+
ring: { position: 'absolute' },
|
|
12
|
+
label: { fontWeight: '600', textAlign: 'center', flexShrink: 0 },
|
|
13
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface CircularProgressProps {
|
|
4
4
|
/** 当前进度,使用 0..1;越界值会收敛到边界,非有限值按 0 处理。 */
|
|
5
5
|
value: number;
|
|
6
6
|
/** 圆环直径,默认 32,最小 16。 */
|
|
@@ -21,4 +21,21 @@ export type CircularProgressProps = {
|
|
|
21
21
|
style?: StyleProp<ViewStyle>;
|
|
22
22
|
/** E2E / 测试定位。 */
|
|
23
23
|
testID?: string;
|
|
24
|
-
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** 内部计算参数,不进入公共 barrel。 */
|
|
27
|
+
export interface CircularProgressInput {
|
|
28
|
+
value: number;
|
|
29
|
+
size: number;
|
|
30
|
+
thickness: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NormalizedCircularProgress {
|
|
34
|
+
safeValue: number;
|
|
35
|
+
percentage: number;
|
|
36
|
+
safeSize: number;
|
|
37
|
+
safeThickness: number;
|
|
38
|
+
radius: number;
|
|
39
|
+
circumference: number;
|
|
40
|
+
dashOffset: number;
|
|
41
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Animated from 'react-native-reanimated';
|
|
3
3
|
import { r, useColors } from '../../../theme';
|
|
4
|
-
import {
|
|
4
|
+
import { createLogger } from '../../../utils/logger';
|
|
5
|
+
import { usePulseAnimation } from '../shared/pulse/usePulseAnimation';
|
|
6
|
+
import { PULSE_DOT_DEFAULTS } from './constants';
|
|
5
7
|
import type { PulseDotProps } from './types';
|
|
6
8
|
|
|
9
|
+
const log = createLogger('PulseDot');
|
|
10
|
+
|
|
7
11
|
export function PulseDot({
|
|
8
12
|
size = r(6),
|
|
9
13
|
color,
|
|
@@ -13,10 +17,7 @@ export function PulseDot({
|
|
|
13
17
|
}: PulseDotProps = {}): React.JSX.Element {
|
|
14
18
|
const c = useColors();
|
|
15
19
|
const fill = color ?? c.primary;
|
|
16
|
-
|
|
17
|
-
// DOT_DEFAULTS,不再在解构里写 `from = 0.5` —— 那样 from 会先被默认值填满,
|
|
18
|
-
// 归一化层再也分不清「调用方没传」和「调用方传了 0.5」。
|
|
19
|
-
const animatedStyle = usePulseWithDefaults(opts, DOT_DEFAULTS, 'PulseDot');
|
|
20
|
+
const animatedStyle = usePulseAnimation(opts, PULSE_DOT_DEFAULTS, log);
|
|
20
21
|
return (
|
|
21
22
|
<Animated.View
|
|
22
23
|
style={[
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PulseDefaults } from '../shared/pulse/types';
|
|
2
|
+
|
|
3
|
+
export const PULSE_DEFAULTS: Readonly<PulseDefaults> = {
|
|
4
|
+
duration: 700,
|
|
5
|
+
delay: 0,
|
|
6
|
+
from: 0.6,
|
|
7
|
+
to: 1,
|
|
8
|
+
};
|
|
9
|
+
export const PULSE_DOT_DEFAULTS: Readonly<PulseDefaults> = {
|
|
10
|
+
duration: 700,
|
|
11
|
+
delay: 0,
|
|
12
|
+
from: 0.5,
|
|
13
|
+
to: 1,
|
|
14
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface PulseOptions {
|
|
4
4
|
/** 透明度下界(默认 0.6) */
|
|
5
5
|
from?: number;
|
|
6
6
|
/** 透明度上界(默认 1) */
|
|
@@ -9,20 +9,20 @@ export type PulseOptions = {
|
|
|
9
9
|
duration?: number;
|
|
10
10
|
/** 首次周期之前的延迟(默认 0) */
|
|
11
11
|
delay?: number;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export interface PulseDotProps extends PulseOptions {
|
|
15
15
|
size?: number;
|
|
16
16
|
color?: string;
|
|
17
17
|
/** 容器附加样式(margin / position 等布局微调)。 */
|
|
18
18
|
style?: StyleProp<ViewStyle>;
|
|
19
19
|
/** E2E / 测试定位 */
|
|
20
20
|
testID?: string;
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export interface PulseProps extends PulseOptions {
|
|
24
24
|
/** 容器附加样式(margin / position 等布局微调)。 */
|
|
25
25
|
style?: StyleProp<ViewStyle>;
|
|
26
26
|
/** E2E / 测试定位 */
|
|
27
27
|
testID?: string;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
@@ -1,87 +1,10 @@
|
|
|
1
|
-
import { useEffect, useMemo } from 'react';
|
|
2
1
|
import { createLogger } from '../../../utils/logger';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { usePulseDriver } from './usePulseDriver';
|
|
2
|
+
import { usePulseAnimation } from '../shared/pulse/usePulseAnimation';
|
|
3
|
+
import { PULSE_DEFAULTS } from './constants';
|
|
6
4
|
import type { PulseOptions } from './types';
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
* 在两个 opacity 值之间无限循环,返回可直接拼到 Animated.View 上的 style。
|
|
10
|
-
*
|
|
11
|
-
* 这是**唯一**的公共实现:参数校验、默认值与 dev 诊断全在这里完成,平台差异只下沉到
|
|
12
|
-
* `usePulseDriver(.web).ts`。此前 native / web 各有一份 `usePulse`,两边各自读原始
|
|
13
|
-
* props、各自解释默认值,web 侧还把未校验的 duration 直接喂给 `setInterval`。
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const BASE_DEFAULTS: PulseDefaults = {
|
|
17
|
-
duration: 700,
|
|
18
|
-
delay: 0,
|
|
19
|
-
from: 0.6,
|
|
20
|
-
to: 1,
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** PulseDot / Skeleton 的默认值 —— 只有 from 更低,圆点 / 骨架淡到 0.5。 */
|
|
24
|
-
export const DOT_DEFAULTS: PulseDefaults = {
|
|
25
|
-
duration: 700,
|
|
26
|
-
delay: 0,
|
|
27
|
-
from: 0.5,
|
|
28
|
-
to: 1,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// logger 在模块加载时一次性建好 —— render 期创建每次都会产生新对象。
|
|
32
|
-
const pulseLog = createLogger('Pulse');
|
|
33
|
-
const pulseDotLog = createLogger('PulseDot');
|
|
34
|
-
const skeletonLog = createLogger('Skeleton');
|
|
35
|
-
|
|
36
|
-
/** 诊断告警的固定 scope 集合。 */
|
|
37
|
-
export type PulseScope = 'Pulse' | 'PulseDot' | 'Skeleton';
|
|
38
|
-
|
|
39
|
-
function loggerForScope(scope: PulseScope) {
|
|
40
|
-
switch (scope) {
|
|
41
|
-
case 'Pulse':
|
|
42
|
-
return pulseLog;
|
|
43
|
-
case 'PulseDot':
|
|
44
|
-
return pulseDotLog;
|
|
45
|
-
case 'Skeleton':
|
|
46
|
-
return skeletonLog;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** 内部:让 PulseDot / Skeleton 复用同一条归一化 + 诊断 + driver 链路。 */
|
|
51
|
-
export function usePulseWithDefaults(
|
|
52
|
-
options: PulseOptions | undefined,
|
|
53
|
-
defaults: PulseDefaults,
|
|
54
|
-
scope: PulseScope
|
|
55
|
-
) {
|
|
56
|
-
// 依赖列表**故意**拆到 primitive:options / defaults 对象每次 render 都可能是新引用
|
|
57
|
-
// (调用方常写内联字面量),直接依赖对象会让 memo 恒失效、并连带每帧重启 driver 的 effect。
|
|
58
|
-
// 这八个 primitive 就是归一化的全部输入,拆开后覆盖完整、无遗漏。
|
|
59
|
-
const normalized = useMemo(
|
|
60
|
-
() => normalizePulseOptions(options, defaults),
|
|
61
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
-
[
|
|
63
|
-
options?.duration,
|
|
64
|
-
options?.delay,
|
|
65
|
-
options?.from,
|
|
66
|
-
options?.to,
|
|
67
|
-
defaults.duration,
|
|
68
|
-
defaults.delay,
|
|
69
|
-
defaults.from,
|
|
70
|
-
defaults.to,
|
|
71
|
-
]
|
|
72
|
-
);
|
|
73
|
-
useEffect(() => {
|
|
74
|
-
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
75
|
-
for (const item of normalized.diagnostics) {
|
|
76
|
-
loggerForScope(scope).warn(
|
|
77
|
-
`${item.field}=${String(item.received)} 无效,已回退为 ${item.fallback}`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}, [normalized.diagnostics, scope]);
|
|
82
|
-
return usePulseDriver(normalized);
|
|
83
|
-
}
|
|
6
|
+
const log = createLogger('Pulse');
|
|
84
7
|
|
|
85
8
|
export function usePulse(options: PulseOptions = {}) {
|
|
86
|
-
return
|
|
9
|
+
return usePulseAnimation(options, PULSE_DEFAULTS, log);
|
|
87
10
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Animated from 'react-native-reanimated';
|
|
3
|
-
import {
|
|
3
|
+
import { createLogger } from '../../../utils/logger';
|
|
4
|
+
import { usePulseAnimation } from '../shared/pulse/usePulseAnimation';
|
|
5
|
+
import { SKELETON_DEFAULTS } from './constants';
|
|
4
6
|
import { r, useColors } from '../../../theme';
|
|
5
7
|
import type { SkeletonProps } from './types';
|
|
6
8
|
|
|
9
|
+
const log = createLogger('Skeleton');
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* 页面级加载占位骨架。3 个形状由 `shape` 切换。
|
|
9
13
|
*
|
|
@@ -26,11 +30,7 @@ export function Skeleton({
|
|
|
26
30
|
testID,
|
|
27
31
|
}: SkeletonProps): React.JSX.Element {
|
|
28
32
|
const c = useColors();
|
|
29
|
-
const animatedStyle =
|
|
30
|
-
undefined,
|
|
31
|
-
DOT_DEFAULTS,
|
|
32
|
-
'Skeleton'
|
|
33
|
-
);
|
|
33
|
+
const animatedStyle = usePulseAnimation(undefined, SKELETON_DEFAULTS, log);
|
|
34
34
|
|
|
35
35
|
// 按形状推默认尺寸 + 圆角;caller 显式传 width / height / radius 时 override
|
|
36
36
|
const dim = (() => {
|
|
@@ -2,7 +2,7 @@ import type { DimensionValue, StyleProp, ViewStyle } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
export type SkeletonShape = 'line' | 'rect' | 'circle';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export interface SkeletonProps {
|
|
6
6
|
/** 形状,默认 'rect'。
|
|
7
7
|
* - 'line' → width 100% / height 11 / radius 3(文本占位)
|
|
8
8
|
* - 'rect' → width 100% / height 80 / radius 8(图片或卡片占位)
|
|
@@ -19,4 +19,4 @@ export type SkeletonProps = {
|
|
|
19
19
|
style?: StyleProp<ViewStyle>;
|
|
20
20
|
/** E2E / 测试定位 */
|
|
21
21
|
testID?: string;
|
|
22
|
-
}
|
|
22
|
+
}
|