@unif/react-native-design 0.34.0 → 0.36.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/jest-preset.js +1 -1
- package/jest-setup.js +16 -1
- package/lib/module/components/business/GlassStats/GlassStats.js +6 -7
- package/lib/module/components/business/GlassStats/GlassStats.js.map +1 -1
- package/lib/module/components/business/GlassStats/styles.js +5 -1
- package/lib/module/components/business/GlassStats/styles.js.map +1 -1
- package/lib/module/components/ui/GlassLayer/GlassLayer.js +39 -0
- package/lib/module/components/ui/GlassLayer/GlassLayer.js.map +1 -0
- package/lib/module/components/ui/GlassLayer/GlassLayer.web.js +36 -0
- package/lib/module/components/ui/GlassLayer/GlassLayer.web.js.map +1 -0
- package/lib/module/components/ui/GlassLayer/constants.js +8 -0
- package/lib/module/components/ui/GlassLayer/constants.js.map +1 -0
- package/lib/module/components/ui/GlassLayer/index.js +4 -0
- package/lib/module/components/ui/GlassLayer/index.js.map +1 -0
- package/lib/module/components/ui/GlassLayer/types.js.map +1 -0
- package/lib/module/components/ui/TextField/TextFieldBase.js +20 -6
- package/lib/module/components/ui/TextField/TextFieldBase.js.map +1 -1
- package/lib/module/components/ui/TextField/constants.js +2 -2
- package/lib/module/components/ui/TextField/constants.js.map +1 -1
- package/lib/module/components/ui/TextField/styles.js +10 -0
- package/lib/module/components/ui/TextField/styles.js.map +1 -1
- package/lib/module/components/ui/index.js +1 -1
- package/lib/module/components/ui/index.js.map +1 -1
- package/lib/module/theme/colors.js +4 -7
- package/lib/module/theme/colors.js.map +1 -1
- package/lib/module/theme/index.js +0 -1
- package/lib/module/theme/index.js.map +1 -1
- package/lib/typescript/src/components/business/GlassStats/GlassStats.d.ts +2 -4
- package/lib/typescript/src/components/business/GlassStats/GlassStats.d.ts.map +1 -1
- package/lib/typescript/src/components/business/GlassStats/styles.d.ts +4 -1
- package/lib/typescript/src/components/business/GlassStats/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/GlassLayer/GlassLayer.d.ts +5 -0
- package/lib/typescript/src/components/ui/GlassLayer/GlassLayer.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/GlassLayer/GlassLayer.web.d.ts +5 -0
- package/lib/typescript/src/components/ui/GlassLayer/GlassLayer.web.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/GlassLayer/constants.d.ts +6 -0
- package/lib/typescript/src/components/ui/GlassLayer/constants.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/GlassLayer/index.d.ts +3 -0
- package/lib/typescript/src/components/ui/GlassLayer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/GlassLayer/types.d.ts +13 -0
- package/lib/typescript/src/components/ui/GlassLayer/types.d.ts.map +1 -0
- package/lib/typescript/src/components/ui/TextField/TextFieldBase.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/constants.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/styles.d.ts +16 -0
- package/lib/typescript/src/components/ui/TextField/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/TextField/types.d.ts +2 -0
- package/lib/typescript/src/components/ui/TextField/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/Textarea/types.d.ts +2 -0
- package/lib/typescript/src/components/ui/Textarea/types.d.ts.map +1 -1
- package/lib/typescript/src/components/ui/index.d.ts +2 -2
- package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
- package/lib/typescript/src/theme/colors.d.ts +2 -5
- package/lib/typescript/src/theme/colors.d.ts.map +1 -1
- package/lib/typescript/src/theme/index.d.ts +0 -2
- package/lib/typescript/src/theme/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/business/GlassStats/GlassStats.tsx +4 -6
- package/src/components/business/GlassStats/styles.ts +3 -1
- package/src/components/ui/GlassLayer/GlassLayer.tsx +42 -0
- package/src/components/ui/GlassLayer/GlassLayer.web.tsx +37 -0
- package/src/components/ui/GlassLayer/constants.ts +2 -0
- package/src/components/ui/GlassLayer/index.ts +2 -0
- package/src/components/ui/GlassLayer/types.ts +14 -0
- package/src/components/ui/TextField/TextFieldBase.tsx +24 -5
- package/src/components/ui/TextField/constants.ts +2 -2
- package/src/components/ui/TextField/styles.ts +5 -0
- package/src/components/ui/TextField/types.ts +2 -0
- package/src/components/ui/Textarea/types.ts +2 -0
- package/src/components/ui/index.ts +2 -2
- package/src/theme/colors.ts +4 -7
- package/src/theme/index.ts +0 -3
- package/lib/module/components/ui/BlurLayer/BlurLayer.js +0 -45
- package/lib/module/components/ui/BlurLayer/BlurLayer.js.map +0 -1
- package/lib/module/components/ui/BlurLayer/BlurLayer.web.js +0 -46
- package/lib/module/components/ui/BlurLayer/BlurLayer.web.js.map +0 -1
- package/lib/module/components/ui/BlurLayer/index.js +0 -4
- package/lib/module/components/ui/BlurLayer/index.js.map +0 -1
- package/lib/module/components/ui/BlurLayer/types.js.map +0 -1
- package/lib/module/theme/blur.js +0 -12
- package/lib/module/theme/blur.js.map +0 -1
- package/lib/typescript/src/components/ui/BlurLayer/BlurLayer.d.ts +0 -10
- package/lib/typescript/src/components/ui/BlurLayer/BlurLayer.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BlurLayer/BlurLayer.web.d.ts +0 -12
- package/lib/typescript/src/components/ui/BlurLayer/BlurLayer.web.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BlurLayer/index.d.ts +0 -3
- package/lib/typescript/src/components/ui/BlurLayer/index.d.ts.map +0 -1
- package/lib/typescript/src/components/ui/BlurLayer/types.d.ts +0 -15
- package/lib/typescript/src/components/ui/BlurLayer/types.d.ts.map +0 -1
- package/lib/typescript/src/theme/blur.d.ts +0 -11
- package/lib/typescript/src/theme/blur.d.ts.map +0 -1
- package/src/components/ui/BlurLayer/BlurLayer.tsx +0 -47
- package/src/components/ui/BlurLayer/BlurLayer.web.tsx +0 -46
- package/src/components/ui/BlurLayer/index.ts +0 -2
- package/src/components/ui/BlurLayer/types.ts +0 -15
- package/src/theme/blur.ts +0 -11
- /package/lib/module/components/ui/{BlurLayer → GlassLayer}/types.js +0 -0
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Web 端 BlurLayer —— CSS `backdrop-filter` 代替 native BlurView。
|
|
5
|
-
*
|
|
6
|
-
* `@sbaiahmed1/react-native-blur` 不支持 web(库内部 codegenNativeComponent
|
|
7
|
-
* 在浏览器会炸 "is not a function",见上游 issue #79)。docusaurus-rnw plugin
|
|
8
|
-
* 配 `extensions: ['.web.tsx', ...]` 优先,webpack 选这份;Metro 不识别该后缀,
|
|
9
|
-
* iOS / Android 走原 `BlurLayer.tsx`。
|
|
10
|
-
*/
|
|
11
|
-
import React from 'react';
|
|
12
|
-
import { StyleSheet, View } from 'react-native';
|
|
13
|
-
import { blur as blurTokens, useColors, useTheme } from "../../../theme/index.js";
|
|
14
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
export function BlurLayer({
|
|
16
|
-
intensity,
|
|
17
|
-
tint,
|
|
18
|
-
style,
|
|
19
|
-
testID
|
|
20
|
-
}) {
|
|
21
|
-
const c = useColors();
|
|
22
|
-
const {
|
|
23
|
-
scheme
|
|
24
|
-
} = useTheme();
|
|
25
|
-
const blurAmount = blurTokens[intensity];
|
|
26
|
-
const defaultTint = intensity === 'strong' ? c.sheetBackdrop : c.glassTintLight;
|
|
27
|
-
// RN style typedef 不识别 web-only 属性,cast 绕过 TS;RN-Web 浏览器侧原样输出。
|
|
28
|
-
// [L-15] saturate(180%):苹果 HIG 玻璃效果的标准值,增强模糊后的颜色鲜艳度,
|
|
29
|
-
// 与 macOS / iOS 系统 vibrancy 视觉一致;降低会让玻璃面板显得灰暗脱色。
|
|
30
|
-
// [L-15] opacity:0.96(暗色):暗色 scheme 下 backdrop-filter 在 Chromium 中
|
|
31
|
-
// opacity=1 时存在渲染 artifact(模糊层与底层内容边界锯齿),降到 0.96 消除;
|
|
32
|
-
// 亮色 scheme 不受影响故保持 1。native 端 BlurLayer.tsx 用双层 View 实现,
|
|
33
|
-
// 语义等价(tint 层覆盖 BlurView),无需此 opacity 补丁。
|
|
34
|
-
const webBlurStyle = {
|
|
35
|
-
backdropFilter: `blur(${blurAmount}px) saturate(180%)`,
|
|
36
|
-
WebkitBackdropFilter: `blur(${blurAmount}px) saturate(180%)`,
|
|
37
|
-
backgroundColor: tint ?? defaultTint,
|
|
38
|
-
opacity: scheme === 'dark' ? 0.96 : 1
|
|
39
|
-
};
|
|
40
|
-
return /*#__PURE__*/_jsx(View, {
|
|
41
|
-
style: [StyleSheet.absoluteFill, webBlurStyle, style],
|
|
42
|
-
pointerEvents: "none",
|
|
43
|
-
testID: testID
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=BlurLayer.web.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","StyleSheet","View","blur","blurTokens","useColors","useTheme","jsx","_jsx","BlurLayer","intensity","tint","style","testID","c","scheme","blurAmount","defaultTint","sheetBackdrop","glassTintLight","webBlurStyle","backdropFilter","WebkitBackdropFilter","backgroundColor","opacity","absoluteFill","pointerEvents"],"sourceRoot":"../../../../../src","sources":["components/ui/BlurLayer/BlurLayer.web.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAwC,cAAc;AAC/E,SAASC,IAAI,IAAIC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,yBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGzE,OAAO,SAASC,SAASA,CAAC;EACxBC,SAAS;EACTC,IAAI;EACJC,KAAK;EACLC;AACc,CAAC,EAAqB;EACpC,MAAMC,CAAC,GAAGT,SAAS,CAAC,CAAC;EACrB,MAAM;IAAEU;EAAO,CAAC,GAAGT,QAAQ,CAAC,CAAC;EAC7B,MAAMU,UAAU,GAAGZ,UAAU,CAACM,SAAS,CAAC;EACxC,MAAMO,WAAW,GACfP,SAAS,KAAK,QAAQ,GAAGI,CAAC,CAACI,aAAa,GAAGJ,CAAC,CAACK,cAAc;EAC7D;EACA;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,YAAY,GAAG;IACnBC,cAAc,EAAE,QAAQL,UAAU,oBAAoB;IACtDM,oBAAoB,EAAE,QAAQN,UAAU,oBAAoB;IAC5DO,eAAe,EAAEZ,IAAI,IAAIM,WAAW;IACpCO,OAAO,EAAET,MAAM,KAAK,MAAM,GAAG,IAAI,GAAG;EACtC,CAAoC;EAEpC,oBACEP,IAAA,CAACN,IAAI;IACHU,KAAK,EAAE,CAACX,UAAU,CAACwB,YAAY,EAAEL,YAAY,EAAER,KAAK,CAAE;IACtDc,aAAa,EAAC,MAAM;IACpBb,MAAM,EAAEA;EAAO,CAChB,CAAC;AAEN","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BlurLayer"],"sourceRoot":"../../../../../src","sources":["components/ui/BlurLayer/index.ts"],"mappings":";;AAAA,SAASA,SAAS,QAAQ,aAAa","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["components/ui/BlurLayer/types.ts"],"mappings":"","ignoreList":[]}
|
package/lib/module/theme/blur.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/** Blur intensity tokens —— backdrop-filter 二档语义化封装。
|
|
4
|
-
*
|
|
5
|
-
* 数值是 `@sbaiahmed1/react-native-blur` 的 BlurView `blurAmount` prop(0-100)。 */
|
|
6
|
-
export const blur = {
|
|
7
|
-
/** 玻璃数据条 / 小区域玻璃感。 */
|
|
8
|
-
soft: 10,
|
|
9
|
-
/** 焦点引导大面积 backdrop。 */
|
|
10
|
-
strong: 40
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=blur.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["blur","soft","strong"],"sourceRoot":"../../../src","sources":["theme/blur.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAO,MAAMA,IAAI,GAAG;EAClB;EACAC,IAAI,EAAE,EAAE;EACR;EACAC,MAAM,EAAE;AACV,CAAU","ignoreList":[]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { BlurLayerProps } from './types';
|
|
3
|
-
/** Blur backdrop 双层 —— BlurView + tint。
|
|
4
|
-
*
|
|
5
|
-
* blurType 跟 scheme 自动切(亮 'light' / 暗 'dark',避免暗色奶白雾)。
|
|
6
|
-
*
|
|
7
|
-
* - `'soft'` 玻璃数据条 / 小区域
|
|
8
|
-
* - `'strong'` 焦点引导 backdrop(sheet 类浮层) */
|
|
9
|
-
export declare function BlurLayer({ intensity, tint, style, testID, }: BlurLayerProps): React.JSX.Element;
|
|
10
|
-
//# sourceMappingURL=BlurLayer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurLayer.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BlurLayer/BlurLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;4CAK4C;AAC5C,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,GACP,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA6BpC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web 端 BlurLayer —— CSS `backdrop-filter` 代替 native BlurView。
|
|
3
|
-
*
|
|
4
|
-
* `@sbaiahmed1/react-native-blur` 不支持 web(库内部 codegenNativeComponent
|
|
5
|
-
* 在浏览器会炸 "is not a function",见上游 issue #79)。docusaurus-rnw plugin
|
|
6
|
-
* 配 `extensions: ['.web.tsx', ...]` 优先,webpack 选这份;Metro 不识别该后缀,
|
|
7
|
-
* iOS / Android 走原 `BlurLayer.tsx`。
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import type { BlurLayerProps } from './types';
|
|
11
|
-
export declare function BlurLayer({ intensity, tint, style, testID, }: BlurLayerProps): React.JSX.Element;
|
|
12
|
-
//# sourceMappingURL=BlurLayer.web.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BlurLayer.web.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BlurLayer/BlurLayer.web.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EACxB,SAAS,EACT,IAAI,EACJ,KAAK,EACL,MAAM,GACP,EAAE,cAAc,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CA2BpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BlurLayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import type { BlurIntensity } from '../../../theme';
|
|
3
|
-
export type BlurLayerProps = {
|
|
4
|
-
/** 模糊强度,对齐设计稿 token:
|
|
5
|
-
* - 'soft' = blurAmount 10,玻璃数据条 / 小区域玻璃感
|
|
6
|
-
* - 'strong' = blurAmount 40,焦点引导 backdrop */
|
|
7
|
-
intensity: BlurIntensity;
|
|
8
|
-
/** Tint override(不传按 intensity 推:soft → c.glassTintLight / strong → c.sheetBackdrop) */
|
|
9
|
-
tint?: string;
|
|
10
|
-
/** 附加样式;默认 absoluteFill,caller 通常不需要传 */
|
|
11
|
-
style?: StyleProp<ViewStyle>;
|
|
12
|
-
/** E2E / 测试定位 */
|
|
13
|
-
testID?: string;
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/ui/BlurLayer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B;;mDAE+C;IAC/C,SAAS,EAAE,aAAa,CAAC;IACzB,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,iBAAiB;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Blur intensity tokens —— backdrop-filter 二档语义化封装。
|
|
2
|
-
*
|
|
3
|
-
* 数值是 `@sbaiahmed1/react-native-blur` 的 BlurView `blurAmount` prop(0-100)。 */
|
|
4
|
-
export declare const blur: {
|
|
5
|
-
/** 玻璃数据条 / 小区域玻璃感。 */
|
|
6
|
-
readonly soft: 10;
|
|
7
|
-
/** 焦点引导大面积 backdrop。 */
|
|
8
|
-
readonly strong: 40;
|
|
9
|
-
};
|
|
10
|
-
export type BlurIntensity = keyof typeof blur;
|
|
11
|
-
//# sourceMappingURL=blur.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blur.d.ts","sourceRoot":"","sources":["../../../../src/theme/blur.ts"],"names":[],"mappings":"AAAA;;+EAE+E;AAC/E,eAAO,MAAM,IAAI;IACf,sBAAsB;;IAEtB,wBAAwB;;CAEhB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,IAAI,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleSheet, View } from 'react-native';
|
|
3
|
-
import { BlurView } from '@sbaiahmed1/react-native-blur';
|
|
4
|
-
import { blur as blurTokens, useColors, useTheme } from '../../../theme';
|
|
5
|
-
import type { BlurLayerProps } from './types';
|
|
6
|
-
|
|
7
|
-
/** Blur backdrop 双层 —— BlurView + tint。
|
|
8
|
-
*
|
|
9
|
-
* blurType 跟 scheme 自动切(亮 'light' / 暗 'dark',避免暗色奶白雾)。
|
|
10
|
-
*
|
|
11
|
-
* - `'soft'` 玻璃数据条 / 小区域
|
|
12
|
-
* - `'strong'` 焦点引导 backdrop(sheet 类浮层) */
|
|
13
|
-
export function BlurLayer({
|
|
14
|
-
intensity,
|
|
15
|
-
tint,
|
|
16
|
-
style,
|
|
17
|
-
testID,
|
|
18
|
-
}: BlurLayerProps): React.JSX.Element {
|
|
19
|
-
const c = useColors();
|
|
20
|
-
const { scheme } = useTheme();
|
|
21
|
-
const blurType = scheme === 'dark' ? 'dark' : 'light';
|
|
22
|
-
const defaultTint =
|
|
23
|
-
intensity === 'strong' ? c.sheetBackdrop : c.glassTintLight;
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<View
|
|
27
|
-
style={[StyleSheet.absoluteFill, style]}
|
|
28
|
-
pointerEvents="none"
|
|
29
|
-
testID={testID}
|
|
30
|
-
>
|
|
31
|
-
<BlurView
|
|
32
|
-
style={StyleSheet.absoluteFill}
|
|
33
|
-
blurType={blurType}
|
|
34
|
-
blurAmount={blurTokens[intensity]}
|
|
35
|
-
// iOS「降低透明度」开启时 BlurView 用纯色替换模糊;库默认 #FFFFFF 在暗色 scheme
|
|
36
|
-
// 下整面刺眼白底。传随 scheme 的 surface 色,与下方 tint 层视觉一致([M-6])。
|
|
37
|
-
reducedTransparencyFallbackColor={c.surface}
|
|
38
|
-
/>
|
|
39
|
-
<View
|
|
40
|
-
style={[
|
|
41
|
-
StyleSheet.absoluteFill,
|
|
42
|
-
{ backgroundColor: tint ?? defaultTint },
|
|
43
|
-
]}
|
|
44
|
-
/>
|
|
45
|
-
</View>
|
|
46
|
-
);
|
|
47
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Web 端 BlurLayer —— CSS `backdrop-filter` 代替 native BlurView。
|
|
3
|
-
*
|
|
4
|
-
* `@sbaiahmed1/react-native-blur` 不支持 web(库内部 codegenNativeComponent
|
|
5
|
-
* 在浏览器会炸 "is not a function",见上游 issue #79)。docusaurus-rnw plugin
|
|
6
|
-
* 配 `extensions: ['.web.tsx', ...]` 优先,webpack 选这份;Metro 不识别该后缀,
|
|
7
|
-
* iOS / Android 走原 `BlurLayer.tsx`。
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import { StyleSheet, View, type StyleProp, type ViewStyle } from 'react-native';
|
|
11
|
-
import { blur as blurTokens, useColors, useTheme } from '../../../theme';
|
|
12
|
-
import type { BlurLayerProps } from './types';
|
|
13
|
-
|
|
14
|
-
export function BlurLayer({
|
|
15
|
-
intensity,
|
|
16
|
-
tint,
|
|
17
|
-
style,
|
|
18
|
-
testID,
|
|
19
|
-
}: BlurLayerProps): React.JSX.Element {
|
|
20
|
-
const c = useColors();
|
|
21
|
-
const { scheme } = useTheme();
|
|
22
|
-
const blurAmount = blurTokens[intensity];
|
|
23
|
-
const defaultTint =
|
|
24
|
-
intensity === 'strong' ? c.sheetBackdrop : c.glassTintLight;
|
|
25
|
-
// RN style typedef 不识别 web-only 属性,cast 绕过 TS;RN-Web 浏览器侧原样输出。
|
|
26
|
-
// [L-15] saturate(180%):苹果 HIG 玻璃效果的标准值,增强模糊后的颜色鲜艳度,
|
|
27
|
-
// 与 macOS / iOS 系统 vibrancy 视觉一致;降低会让玻璃面板显得灰暗脱色。
|
|
28
|
-
// [L-15] opacity:0.96(暗色):暗色 scheme 下 backdrop-filter 在 Chromium 中
|
|
29
|
-
// opacity=1 时存在渲染 artifact(模糊层与底层内容边界锯齿),降到 0.96 消除;
|
|
30
|
-
// 亮色 scheme 不受影响故保持 1。native 端 BlurLayer.tsx 用双层 View 实现,
|
|
31
|
-
// 语义等价(tint 层覆盖 BlurView),无需此 opacity 补丁。
|
|
32
|
-
const webBlurStyle = {
|
|
33
|
-
backdropFilter: `blur(${blurAmount}px) saturate(180%)`,
|
|
34
|
-
WebkitBackdropFilter: `blur(${blurAmount}px) saturate(180%)`,
|
|
35
|
-
backgroundColor: tint ?? defaultTint,
|
|
36
|
-
opacity: scheme === 'dark' ? 0.96 : 1,
|
|
37
|
-
} as unknown as StyleProp<ViewStyle>;
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<View
|
|
41
|
-
style={[StyleSheet.absoluteFill, webBlurStyle, style]}
|
|
42
|
-
pointerEvents="none"
|
|
43
|
-
testID={testID}
|
|
44
|
-
/>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import type { BlurIntensity } from '../../../theme';
|
|
3
|
-
|
|
4
|
-
export type BlurLayerProps = {
|
|
5
|
-
/** 模糊强度,对齐设计稿 token:
|
|
6
|
-
* - 'soft' = blurAmount 10,玻璃数据条 / 小区域玻璃感
|
|
7
|
-
* - 'strong' = blurAmount 40,焦点引导 backdrop */
|
|
8
|
-
intensity: BlurIntensity;
|
|
9
|
-
/** Tint override(不传按 intensity 推:soft → c.glassTintLight / strong → c.sheetBackdrop) */
|
|
10
|
-
tint?: string;
|
|
11
|
-
/** 附加样式;默认 absoluteFill,caller 通常不需要传 */
|
|
12
|
-
style?: StyleProp<ViewStyle>;
|
|
13
|
-
/** E2E / 测试定位 */
|
|
14
|
-
testID?: string;
|
|
15
|
-
};
|
package/src/theme/blur.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Blur intensity tokens —— backdrop-filter 二档语义化封装。
|
|
2
|
-
*
|
|
3
|
-
* 数值是 `@sbaiahmed1/react-native-blur` 的 BlurView `blurAmount` prop(0-100)。 */
|
|
4
|
-
export const blur = {
|
|
5
|
-
/** 玻璃数据条 / 小区域玻璃感。 */
|
|
6
|
-
soft: 10,
|
|
7
|
-
/** 焦点引导大面积 backdrop。 */
|
|
8
|
-
strong: 40,
|
|
9
|
-
} as const;
|
|
10
|
-
|
|
11
|
-
export type BlurIntensity = keyof typeof blur;
|
|
File without changes
|