@expo-harmony/expo-linear-gradient 55.0.14-harmony.2 → 55.0.14-harmony.3

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
@@ -1,8 +1,8 @@
1
1
  # @expo-harmony/expo-linear-gradient
2
2
 
3
- [**GitHub 仓库**](https://github.com/renbaoshuo/expo-harmony/tree/master/packages/expo-linear-gradient)
3
+ [**GitHub 仓库**](https://github.com/renbaoshuo/expo-harmony/tree/master/packages/expo-linear-gradient) | [官方文档](https://docs.expo.dev/versions/v55.0.0/sdk/linear-gradient/)
4
4
 
5
- 为 HarmonyOS 上的 React Native 应用提供 Expo LinearGradient 的原生实现,与官方同版本的 `expo-linear-gradient` 配套使用。支持多色线性渐变、自定义颜色位置和渐变起止点、圆角裁剪,以及在渐变背景上叠加子组件。
5
+ 为 HarmonyOS 上的 React Native 应用提供 Expo LinearGradient 的原生实现,与官方同版本的 `expo-linear-gradient` 配套使用。
6
6
 
7
7
  ## 安装
8
8
 
@@ -10,11 +10,61 @@
10
10
  npm install @expo-harmony/expo-linear-gradient expo-linear-gradient@55.0.14
11
11
  ```
12
12
 
13
- 渐变由 ArkUI Canvas 绘制,`dither` 属性在 HarmonyOS 上不生效。
13
+ ## API 对照表
14
+
15
+ ### Component
16
+
17
+ #### `LinearGradient`
18
+
19
+ 线性渐变视图组件。渐变铺满视图,子组件叠加在渐变之上。渐变层不接收触摸事件,触摸会落到子组件上。
20
+
21
+ `style` 上的 `borderRadius` 和各角圆角属性用于裁剪渐变。
22
+
23
+ #### `colors`
24
+
25
+ 类型:`readonly [ColorValue, ColorValue, ...ColorValue[]]`
26
+
27
+ 渐变的颜色序列,按顺序参与渲染。至少需要两个颜色,少于两个时忽略该次更新。
28
+
29
+ #### `locations`
30
+
31
+ 类型:`readonly [number, number, ...number[]] | null`,默认 `null`
32
+
33
+ 每个颜色在渐变轴上的位置,取值 0 到 1,数量与 `colors` 一致。不传时颜色均匀分布。位置必须从小到大排列,取相同值可以得到硬过渡。数量对不上、取值越界或顺序不对时,忽略该次更新,保留上一次的渐变。
34
+
35
+ #### `start`
36
+
37
+ 类型:`LinearGradientPoint | null`,默认 `{ x: 0.5, y: 0 }`
38
+
39
+ 渐变起点,`x`、`y` 是相对视图宽高的比例,可以写成 `{ x, y }` 或 `[x, y]`。取值可以超出 0 到 1,渐变轴延伸到视图之外。
40
+
41
+ #### `end`
42
+
43
+ 类型:`LinearGradientPoint | null`,默认 `{ x: 0.5, y: 1 }`
44
+
45
+ 渐变终点,写法与 `start` 相同。
46
+
47
+ > **未实现的内容**
48
+ >
49
+ > - `dither`:Android 专属属性,用于控制渐变渲染的抖动,HarmonyOS 上不生效。
50
+
51
+ ### Types
52
+
53
+ #### `LinearGradientPoint`
54
+
55
+ 渐变端点,`{ x: number; y: number }` 或 `[x: number, y: number]`。
56
+
57
+ #### `NativeLinearGradientPoint`
58
+
59
+ 渐变端点的数组形式,`[x: number, y: number]`。
60
+
61
+ #### `LinearGradientProps`
62
+
63
+ `LinearGradient` 的属性类型,在 `ViewProps` 之上增加 `colors`、`locations`、`start`、`end` 和 Android 专属的 `dither`。
14
64
 
15
65
  ## Author
16
66
 
17
67
  **expo-harmony** © [Baoshuo](https://github.com/renbaoshuo), Released under the MIT License.<br>
18
68
  Authored and maintained by Baoshuo with help from [contributors](https://github.com/renbaoshuo/expo-harmony/contributors).
19
69
 
20
- > [Personal Website](https://baoshuo.ren) · [Blog](https://blog.baoshuo.ren) · GitHub [@renbaoshuo](https://github.com/renbaoshuo) · Twitter [@baoshuo](https://twitter.com/baoshuo)
70
+ > [Personal Website](https://baoshuo.ren) · [Blog](https://blog.baoshuo.ren) · GitHub [@renbaoshuo](https://github.com/renbaoshuo) · Twitter [@renbaoshuo](https://twitter.com/renbaoshuo)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo-harmony/expo-linear-gradient",
3
- "version": "55.0.14-harmony.2",
3
+ "version": "55.0.14-harmony.3",
4
4
  "description": "HarmonyOS port of expo-linear-gradient",
5
5
  "keywords": [
6
6
  "react-native",
@@ -18,6 +18,6 @@
18
18
  "main": "Index.ets",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@expo-harmony/expo-modules-core": "55.0.25-harmony.2"
21
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.3"
22
22
  }
23
23
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo-harmony/expo-linear-gradient",
3
- "version": "55.0.14-harmony.2",
3
+ "version": "55.0.14-harmony.3",
4
4
  "description": "HarmonyOS port of expo-linear-gradient",
5
5
  "keywords": [
6
6
  "react-native",
@@ -27,12 +27,12 @@
27
27
  "typecheck": "tsc --noEmit -p tsconfig.json"
28
28
  },
29
29
  "peerDependencies": {
30
- "@expo-harmony/expo-modules-core": "55.0.25-harmony.2",
30
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.3",
31
31
  "expo-linear-gradient": "55.0.14"
32
32
  },
33
33
  "devDependencies": {
34
- "@expo-harmony/expo-module-scripts": "55.0.0-harmony.2",
35
- "@expo-harmony/expo-modules-core": "55.0.25-harmony.2",
34
+ "@expo-harmony/expo-module-scripts": "55.0.0-harmony.3",
35
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.3",
36
36
  "@react-native-oh/react-native-harmony": "0.84.1",
37
37
  "@types/react": "19.2.2",
38
38
  "expo": "55.0.26",