@expo-harmony/expo-linear-gradient 55.0.14-harmony.1

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 ADDED
@@ -0,0 +1,14 @@
1
+ # @expo-harmony/expo-linear-gradient
2
+
3
+ [**GitHub 仓库**](https://github.com/renbaoshuo/expo-harmony/tree/master/packages/expo-linear-gradient)
4
+
5
+ 为 HarmonyOS 上的 React Native 应用提供 Expo LinearGradient 的原生实现,与官方同版本的 `expo-linear-gradient` 配套使用。支持多色线性渐变、自定义颜色位置和渐变起止点、圆角裁剪,以及在渐变背景上叠加子组件。
6
+
7
+ 渐变由 ArkUI Canvas 绘制,`dither` 属性在 HarmonyOS 上不生效。
8
+
9
+ ## Author
10
+
11
+ **expo-harmony** © [Baoshuo](https://github.com/renbaoshuo), Released under the MIT License.<br>
12
+ Authored and maintained by Baoshuo with help from [contributors](https://github.com/renbaoshuo/expo-harmony/contributors).
13
+
14
+ > [Personal Website](https://baoshuo.ren) · [Blog](https://blog.baoshuo.ren) · GitHub [@renbaoshuo](https://github.com/renbaoshuo) · Twitter [@baoshuo](https://twitter.com/baoshuo)
@@ -0,0 +1,41 @@
1
+ import { requireNativeViewManager } from 'expo-modules-core';
2
+ import * as React from 'react';
3
+ import { StyleSheet, View } from 'react-native';
4
+
5
+ const NativeView = requireNativeViewManager('ExpoLinearGradient');
6
+
7
+ export default function NativeLinearGradient({
8
+ colors,
9
+ locations,
10
+ startPoint,
11
+ endPoint,
12
+ children,
13
+ style,
14
+ dither,
15
+ ...props
16
+ }) {
17
+ const flattened = StyleSheet.flatten(style) ?? {};
18
+
19
+ const radius = flattened.borderRadius ?? 0;
20
+ const radii = [
21
+ flattened.borderTopLeftRadius ?? radius,
22
+ flattened.borderTopRightRadius ?? radius,
23
+ flattened.borderBottomRightRadius ?? radius,
24
+ flattened.borderBottomLeftRadius ?? radius,
25
+ ];
26
+
27
+ return React.createElement(
28
+ View,
29
+ { ...props, style },
30
+ React.createElement(NativeView, {
31
+ style: StyleSheet.absoluteFill,
32
+ colors,
33
+ locations,
34
+ startPoint,
35
+ endPoint,
36
+ borderRadii: radii,
37
+ dither,
38
+ }),
39
+ children,
40
+ );
41
+ }
@@ -0,0 +1 @@
1
+ _Note_: This directory is for redirecting imports usage, not build artifacts. So it should keep tracked in git and published.
@@ -0,0 +1,6 @@
1
+ {
2
+ "platforms": ["harmony"],
3
+ "harmony": {
4
+ "modules": ["ExpoLinearGradientModule"]
5
+ }
6
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@expo-harmony/expo-linear-gradient",
3
+ "version": "55.0.14-harmony.1",
4
+ "description": "HarmonyOS port of expo-linear-gradient",
5
+ "keywords": [
6
+ "react-native",
7
+ "expo",
8
+ "expo-harmony",
9
+ "harmonyos"
10
+ ],
11
+ "homepage": "https://github.com/renbaoshuo/expo-harmony/tree/master/packages/expo-linear-gradient#readme",
12
+ "repository": "https://github.com/renbaoshuo/expo-harmony",
13
+ "author": {
14
+ "name": "Baoshuo",
15
+ "email": "i@baoshuo.ren",
16
+ "url": "https://github.com/renbaoshuo"
17
+ },
18
+ "main": "Index.ets",
19
+ "license": "MIT",
20
+ "dependencies": {
21
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.1"
22
+ }
23
+ }
Binary file
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = Object.freeze({});
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@expo-harmony/expo-linear-gradient",
3
+ "version": "55.0.14-harmony.1",
4
+ "description": "HarmonyOS port of expo-linear-gradient",
5
+ "keywords": [
6
+ "react-native",
7
+ "expo",
8
+ "expo-harmony",
9
+ "harmonyos"
10
+ ],
11
+ "homepage": "https://github.com/renbaoshuo/expo-harmony/tree/master/packages/expo-linear-gradient#readme",
12
+ "bugs": "https://github.com/renbaoshuo/expo-harmony/issues",
13
+ "license": "MIT",
14
+ "author": "Baoshuo <i@baoshuo.ren>",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/renbaoshuo/expo-harmony.git",
18
+ "directory": "packages/expo-linear-gradient"
19
+ },
20
+ "main": "index.js",
21
+ "react-native": "src/index.ts",
22
+ "types": "index.d.ts",
23
+ "scripts": {
24
+ "harmony:clean": "expo-harmony-module prepare --clean-only",
25
+ "harmony:build": "expo-harmony-module prepare",
26
+ "prepack": "expo-harmony-module prepack",
27
+ "typecheck": "tsc --noEmit -p tsconfig.json"
28
+ },
29
+ "peerDependencies": {
30
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.1",
31
+ "expo-linear-gradient": "55.0.14"
32
+ },
33
+ "devDependencies": {
34
+ "@expo-harmony/expo-module-scripts": "55.0.0-harmony.0",
35
+ "@expo-harmony/expo-modules-core": "55.0.25-harmony.1",
36
+ "@react-native-oh/react-native-harmony": "0.84.1",
37
+ "@types/react": "19.2.2",
38
+ "expo": "55.0.26",
39
+ "expo-linear-gradient": "55.0.14",
40
+ "expo-modules-core": "55.0.25",
41
+ "react": "19.2.3",
42
+ "react-native": "0.84.1",
43
+ "typescript": "6.0.3"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "harmony": {
52
+ "alias": "expo-linear-gradient",
53
+ "redirectInternalImports": true
54
+ }
55
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { LinearGradient } from 'expo-linear-gradient/build/LinearGradient';
2
+ export type { LinearGradientPoint, LinearGradientProps, NativeLinearGradientPoint } from 'expo-linear-gradient';