@react-native-ohos/lottie-react-native 7.2.3-rc.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/LICENSE +201 -0
- package/README.OpenSource +11 -0
- package/README.md +13 -0
- package/harmony/lottie/BuildProfile.ets +21 -0
- package/harmony/lottie/build-profile.json5 +8 -0
- package/harmony/lottie/hvigorfile.ts +5 -0
- package/harmony/lottie/index.ets +5 -0
- package/harmony/lottie/oh-package.json5 +14 -0
- package/harmony/lottie/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/lottie/src/main/cpp/LottieAnimationViewPackage.h +13 -0
- package/harmony/lottie/src/main/cpp/generated/RNOH/generated/BaseLottieReactNativePackage.h +68 -0
- package/harmony/lottie/src/main/cpp/generated/RNOH/generated/components/LottieAnimationViewJSIBinder.h +43 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ComponentDescriptors.h +22 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.cpp +44 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.h +39 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.cpp +41 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.h +42 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.cpp +19 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.h +34 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.cpp +18 -0
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.h +36 -0
- package/harmony/lottie/src/main/ets/LottieAnimationTools.ets +21 -0
- package/harmony/lottie/src/main/ets/LottieAnimationView.ets +393 -0
- package/harmony/lottie/src/main/ets/LottieAnimationViewPackage.ts +17 -0
- package/harmony/lottie/src/main/ets/LottieCompositionCache.ets +30 -0
- package/harmony/lottie/src/main/ets/common/Animation.ts +43 -0
- package/harmony/lottie/src/main/ets/common/AnimationType.ets +50 -0
- package/harmony/lottie/src/main/ets/common/TextUtils.ets +18 -0
- package/harmony/lottie/src/main/ets/generated/components/LottieAnimationView.ts +181 -0
- package/harmony/lottie/src/main/ets/generated/components/ts.ts +5 -0
- package/harmony/lottie/src/main/ets/generated/index.ets +5 -0
- package/harmony/lottie/src/main/ets/generated/ts.ts +6 -0
- package/harmony/lottie/src/main/ets/generated/turboModules/ts.ts +5 -0
- package/harmony/lottie/src/main/module.json5 +9 -0
- package/harmony/lottie/src/main/resources/base/element/string.json +8 -0
- package/harmony/lottie/src/main/resources/base/media/icon.png +0 -0
- package/harmony/lottie/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/lottie/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/lottie/ts.ts +5 -0
- package/harmony/lottie.har +0 -0
- package/lib/commonjs/LottieAnimationViewNativeComponent.js +18 -0
- package/lib/commonjs/LottieAnimationViewNativeComponent.js.map +1 -0
- package/lib/commonjs/codegenUtils.js +2 -0
- package/lib/commonjs/codegenUtils.js.map +1 -0
- package/lib/commonjs/index.js +25 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/LottieAnimationViewNativeComponent.js +11 -0
- package/lib/module/LottieAnimationViewNativeComponent.js.map +1 -0
- package/lib/module/codegenUtils.js +2 -0
- package/lib/module/codegenUtils.js.map +1 -0
- package/lib/module/index.js +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/LottieAnimationViewNativeComponent.d.ts +44 -0
- package/lib/typescript/LottieAnimationViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/codegenUtils.d.ts +3 -0
- package/lib/typescript/codegenUtils.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/package.json +131 -0
- package/src/LottieAnimationViewNativeComponent.ts +78 -0
- package/src/codegenUtils.ts +9 -0
- package/src/index.tsx +7 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
Descriptor as ComponentDescriptor,
|
|
7
|
+
ViewBaseProps,
|
|
8
|
+
ViewRawProps,
|
|
9
|
+
ViewDescriptorWrapperBase,
|
|
10
|
+
ColorValue,
|
|
11
|
+
Color,
|
|
12
|
+
RNInstance,
|
|
13
|
+
Tag,
|
|
14
|
+
RNComponentCommandReceiver,
|
|
15
|
+
ViewPropsSelector,
|
|
16
|
+
} from '@rnoh/react-native-openharmony/ts';
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
export namespace LottieAnimationView {
|
|
20
|
+
export const NAME = "LottieAnimationView" as const
|
|
21
|
+
|
|
22
|
+
export interface DirectRawProps {
|
|
23
|
+
resizeMode?: string;
|
|
24
|
+
renderMode?: string;
|
|
25
|
+
sourceName?: string;
|
|
26
|
+
sourceJson?: string;
|
|
27
|
+
sourceURL?: string;
|
|
28
|
+
imageAssetsFolder?: string;
|
|
29
|
+
progress?: number;
|
|
30
|
+
speed?: number;
|
|
31
|
+
loop?: boolean;
|
|
32
|
+
autoPlay?: boolean;
|
|
33
|
+
enableMergePathsAndroidForKitKatAndAbove?: boolean;
|
|
34
|
+
hardwareAccelerationAndroid?: boolean;
|
|
35
|
+
cacheComposition?: boolean;
|
|
36
|
+
colorFilters?: unknown;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Props extends ViewBaseProps {}
|
|
40
|
+
|
|
41
|
+
export interface State {}
|
|
42
|
+
|
|
43
|
+
export interface RawProps extends ViewRawProps, DirectRawProps {}
|
|
44
|
+
|
|
45
|
+
export class PropsSelector extends ViewPropsSelector<Props, RawProps> {
|
|
46
|
+
get resizeMode() {
|
|
47
|
+
return this.rawProps.resizeMode;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get renderMode() {
|
|
51
|
+
return this.rawProps.renderMode;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get sourceName() {
|
|
55
|
+
return this.rawProps.sourceName;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get sourceJson() {
|
|
59
|
+
return this.rawProps.sourceJson;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get sourceURL() {
|
|
63
|
+
return this.rawProps.sourceURL;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get imageAssetsFolder() {
|
|
67
|
+
return this.rawProps.imageAssetsFolder;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get progress() {
|
|
71
|
+
return this.rawProps.progress ?? 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get speed() {
|
|
75
|
+
return this.rawProps.speed ?? 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get loop() {
|
|
79
|
+
return this.rawProps.loop ?? false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get autoPlay() {
|
|
83
|
+
return this.rawProps.autoPlay ?? false;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get enableMergePathsAndroidForKitKatAndAbove() {
|
|
87
|
+
return this.rawProps.enableMergePathsAndroidForKitKatAndAbove ?? false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get hardwareAccelerationAndroid() {
|
|
91
|
+
return this.rawProps.hardwareAccelerationAndroid ?? false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get cacheComposition() {
|
|
95
|
+
return this.rawProps.cacheComposition ?? false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get colorFilters() {
|
|
99
|
+
return this.rawProps.colorFilters;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type Descriptor = ComponentDescriptor<
|
|
106
|
+
typeof NAME,
|
|
107
|
+
Props,
|
|
108
|
+
State,
|
|
109
|
+
RawProps
|
|
110
|
+
>;
|
|
111
|
+
|
|
112
|
+
export class DescriptorWrapper extends ViewDescriptorWrapperBase<
|
|
113
|
+
typeof NAME,
|
|
114
|
+
Props,
|
|
115
|
+
State,
|
|
116
|
+
RawProps,
|
|
117
|
+
PropsSelector
|
|
118
|
+
> {
|
|
119
|
+
protected createPropsSelector() {
|
|
120
|
+
return new PropsSelector(this.descriptor.props, this.descriptor.rawProps)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface EventPayloadByName {
|
|
125
|
+
"animationFinish": {isCancelled: boolean}
|
|
126
|
+
"animationFailure": {error: string}
|
|
127
|
+
"animationLoaded": {}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export class EventEmitter {
|
|
131
|
+
constructor(private rnInstance: RNInstance, private tag: Tag) {}
|
|
132
|
+
|
|
133
|
+
emit<TEventName extends keyof EventPayloadByName>(eventName: TEventName, payload: EventPayloadByName[TEventName]) {
|
|
134
|
+
this.rnInstance.emitComponentEvent(this.tag, eventName, payload)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface CommandArgvByName {
|
|
139
|
+
"play": [number, number]
|
|
140
|
+
"reset": []
|
|
141
|
+
"pause": []
|
|
142
|
+
"resume": []
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export class CommandReceiver {
|
|
146
|
+
private listenersByCommandName = new Map<string, Set<(...args: any[]) => void>>()
|
|
147
|
+
private cleanUp: (() => void) | undefined = undefined
|
|
148
|
+
|
|
149
|
+
constructor(private componentCommandReceiver: RNComponentCommandReceiver, private tag: Tag) {
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
subscribe<TCommandName extends keyof CommandArgvByName>(commandName: TCommandName, listener: (argv: CommandArgvByName[TCommandName]) => void) {
|
|
153
|
+
if (!this.listenersByCommandName.has(commandName)) {
|
|
154
|
+
this.listenersByCommandName.set(commandName, new Set())
|
|
155
|
+
}
|
|
156
|
+
this.listenersByCommandName.get(commandName)!.add(listener)
|
|
157
|
+
const hasRegisteredCommandReceiver = !!this.cleanUp
|
|
158
|
+
if (!hasRegisteredCommandReceiver) {
|
|
159
|
+
this.cleanUp = this.componentCommandReceiver.registerCommandCallback(this.tag, (commandName: string, argv: any[]) => {
|
|
160
|
+
if (this.listenersByCommandName.has(commandName)) {
|
|
161
|
+
const listeners = this.listenersByCommandName.get(commandName)!
|
|
162
|
+
listeners.forEach(listener => {
|
|
163
|
+
listener(argv)
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return () => {
|
|
170
|
+
this.listenersByCommandName.get(commandName)?.delete(listener)
|
|
171
|
+
if (this.listenersByCommandName.get(commandName)?.size ?? 0 === 0) {
|
|
172
|
+
this.listenersByCommandName.delete(commandName)
|
|
173
|
+
}
|
|
174
|
+
if (this.listenersByCommandName.size === 0) {
|
|
175
|
+
this.cleanUp?.()
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.Commands = void 0;
|
|
7
|
+
var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
8
|
+
var _codegenNativeCommands = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
11
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
12
|
+
// found in the LICENSE file.
|
|
13
|
+
|
|
14
|
+
const Commands = exports.Commands = (0, _codegenNativeCommands.default)({
|
|
15
|
+
supportedCommands: ['play', 'reset', 'pause', 'resume']
|
|
16
|
+
});
|
|
17
|
+
var _default = exports.default = (0, _codegenNativeComponent.default)('LottieAnimationView');
|
|
18
|
+
//# sourceMappingURL=LottieAnimationViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","e","__esModule","default","Commands","exports","codegenNativeCommands","supportedCommands","_default","codegenNativeComponent"],"sourceRoot":"../../src","sources":["LottieAnimationViewNativeComponent.ts"],"mappings":";;;;;;AAUE,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA2F,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAX7F;AACA;AACA;;AAsES,MAAMG,QAAwB,GAAAC,OAAA,CAAAD,QAAA,GAAG,IAAAE,8BAAqB,EAAiB;EAC5EC,iBAAiB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ;AACxD,CAAC,CAAC;AAAC,IAAAC,QAAA,GAAAH,OAAA,CAAAF,OAAA,GAEY,IAAAM,+BAAsB,EAAc,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["codegenUtils.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _LottieView = require("lottie-react-native/src/LottieView");
|
|
9
|
+
var _types = require("lottie-react-native/src/types");
|
|
10
|
+
Object.keys(_types).forEach(function (key) {
|
|
11
|
+
if (key === "default" || key === "__esModule") return;
|
|
12
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
13
|
+
if (key in exports && exports[key] === _types[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () {
|
|
17
|
+
return _types[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
22
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
23
|
+
// found in the LICENSE file.
|
|
24
|
+
var _default = exports.default = _LottieView.LottieView;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_LottieView","require","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_default","default","LottieView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAIA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,MAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,MAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,MAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AALA;AACA;AACA;AAAA,IAAAS,QAAA,GAAAJ,OAAA,CAAAK,OAAA,GAIeC,sBAAU","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
6
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
7
|
+
export const Commands = codegenNativeCommands({
|
|
8
|
+
supportedCommands: ['play', 'reset', 'pause', 'resume']
|
|
9
|
+
});
|
|
10
|
+
export default codegenNativeComponent('LottieAnimationView');
|
|
11
|
+
//# sourceMappingURL=LottieAnimationViewNativeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["codegenNativeComponent","codegenNativeCommands","Commands","supportedCommands"],"sourceRoot":"../../src","sources":["LottieAnimationViewNativeComponent.ts"],"mappings":"AAAA;AACA;AACA;;AAQE,OAAOA,sBAAsB,MAAM,yDAAyD;AAC5F,OAAOC,qBAAqB,MAAM,wDAAwD;AA6D1F,OAAO,MAAMC,QAAwB,GAAGD,qBAAqB,CAAiB;EAC5EE,iBAAiB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ;AACxD,CAAC,CAAC;AAEF,eAAeH,sBAAsB,CAAc,qBAAqB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["codegenUtils.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import { LottieView } from 'lottie-react-native/src/LottieView';
|
|
6
|
+
export * from 'lottie-react-native/src/types';
|
|
7
|
+
export default LottieView;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LottieView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,oCAAoC;AAC/D,cAAc,+BAA+B;AAC7C,eAAeA,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { DirectEventHandler, Int32, Double, Float } from 'react-native/Libraries/Types/CodegenTypes';
|
|
2
|
+
import type { ProcessedColorValue, ViewProps, HostComponent } from 'react-native';
|
|
3
|
+
import type { UnsafeMixed } from './codegenUtils';
|
|
4
|
+
export type OnAnimationFinishEvent = Readonly<{
|
|
5
|
+
isCancelled: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
export type AnimationFailureEvent = Readonly<{
|
|
8
|
+
error: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type AnimationLoadedEvent = Readonly<{}>;
|
|
11
|
+
type ColorFilterStruct = Readonly<{
|
|
12
|
+
keypath: string;
|
|
13
|
+
color: ProcessedColorValue;
|
|
14
|
+
}>;
|
|
15
|
+
export interface NativeProps extends ViewProps {
|
|
16
|
+
resizeMode?: string;
|
|
17
|
+
renderMode?: string;
|
|
18
|
+
sourceName?: string;
|
|
19
|
+
sourceJson?: string;
|
|
20
|
+
sourceURL?: string;
|
|
21
|
+
imageAssetsFolder?: string;
|
|
22
|
+
progress?: Float;
|
|
23
|
+
speed?: Double;
|
|
24
|
+
loop?: boolean;
|
|
25
|
+
autoPlay?: boolean;
|
|
26
|
+
enableMergePathsAndroidForKitKatAndAbove?: boolean;
|
|
27
|
+
hardwareAccelerationAndroid?: boolean;
|
|
28
|
+
cacheComposition?: boolean;
|
|
29
|
+
colorFilters?: UnsafeMixed<ReadonlyArray<ColorFilterStruct>>;
|
|
30
|
+
onAnimationFinish?: DirectEventHandler<OnAnimationFinishEvent, 'onAnimationFinish'>;
|
|
31
|
+
onAnimationFailure?: DirectEventHandler<AnimationFailureEvent, 'onAnimationFailure'>;
|
|
32
|
+
onAnimationLoaded?: DirectEventHandler<AnimationLoadedEvent, 'onAnimationLoaded'>;
|
|
33
|
+
}
|
|
34
|
+
type LottieViewNativeComponentType = HostComponent<NativeProps>;
|
|
35
|
+
interface NativeCommands {
|
|
36
|
+
play: (viewRef: React.ElementRef<LottieViewNativeComponentType>, startFrame: Int32, endFrame: Int32) => void;
|
|
37
|
+
reset: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
38
|
+
pause: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
39
|
+
resume: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
40
|
+
}
|
|
41
|
+
export declare const Commands: NativeCommands;
|
|
42
|
+
declare const _default: HostComponent<NativeProps>;
|
|
43
|
+
export default _default;
|
|
44
|
+
//# sourceMappingURL=LottieAnimationViewNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LottieAnimationViewNativeComponent.d.ts","sourceRoot":"","sources":["../../src/LottieAnimationViewNativeComponent.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,kBAAkB,EAChB,KAAK,EACL,MAAM,EACN,KAAK,EACN,MAAM,2CAA2C,CAAC;AAGnD,OAAO,KAAK,EAAC,mBAAmB,EAAC,SAAS,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;AAE/C,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,mBAAmB,CAAC;CAC5B,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wCAAwC,CAAC,EAAE,OAAO,CAAC;IACnD,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAC,WAAW,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC5D,iBAAiB,CAAC,EAAE,kBAAkB,CACpC,sBAAsB,EACtB,mBAAmB,CACpB,CAAC;IACF,kBAAkB,CAAC,EAAE,kBAAkB,CACrC,qBAAqB,EACrB,oBAAoB,CACrB,CAAC;IACF,iBAAiB,CAAC,EAAE,kBAAkB,CACpC,oBAAoB,EACpB,mBAAmB,CACpB,CAAC;CACH;AAED,KAAK,6BAA6B,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAEhE,UAAU,cAAc;IACtB,IAAI,EAAE,CACJ,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,6BAA6B,CAAC,EACxD,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,KAAK,KACZ,IAAI,CAAC;IACV,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,6BAA6B,CAAC,KAAK,IAAI,CAAC;IAC1E,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,6BAA6B,CAAC,KAAK,IAAI,CAAC;IAC1E,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,6BAA6B,CAAC,KAAK,IAAI,CAAC;CAC5E;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;wBAE0E,aAAa,CAAC,WAAW,CAAC;AAAvG,wBAAwG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codegenUtils.d.ts","sourceRoot":"","sources":["../../src/codegenUtils.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AAI/B,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,cAAc,+BAA+B,CAAC;AAC9C,eAAe,UAAU,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/lottie-react-native",
|
|
3
|
+
"version": "7.2.3-rc.1",
|
|
4
|
+
"description": "c-api-foundation",
|
|
5
|
+
"main": "lib/commonjs/index.js",
|
|
6
|
+
"module": "lib/module/index.js",
|
|
7
|
+
"react-native": "src/index.tsx",
|
|
8
|
+
"types": "lib/typescript/index.d.ts",
|
|
9
|
+
"source": "src/index.tsx",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"lib",
|
|
14
|
+
"harmony",
|
|
15
|
+
"!harmony/oh_modules",
|
|
16
|
+
"!harmony/**/build",
|
|
17
|
+
"!harmony/**/oh_modules",
|
|
18
|
+
"*.podspec",
|
|
19
|
+
"react-native.config.js"
|
|
20
|
+
],
|
|
21
|
+
"author": "Emilio Rodriguez <emiliorodriguez@gmail.com>",
|
|
22
|
+
"homepage": "https://github.com/airbnb/lottie-react-native#readme",
|
|
23
|
+
"harmony": {
|
|
24
|
+
"alias": "lottie-react-native"
|
|
25
|
+
},
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
|
+
"keywords": [
|
|
28
|
+
"lottie",
|
|
29
|
+
"animation",
|
|
30
|
+
"react",
|
|
31
|
+
"react-native",
|
|
32
|
+
"keyframe"
|
|
33
|
+
],
|
|
34
|
+
"repository": "https://github.com/react-native-oh-library/lottie-react-native.git",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/react-native-oh-library/lottie-react-native/issues"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"registry": "https://registry.npmjs.org/",
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "bob build",
|
|
44
|
+
"prepack": "npm run build",
|
|
45
|
+
"release": "release-it",
|
|
46
|
+
"lint:swift": "swiftlint ios",
|
|
47
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name lottie-react-native --cpp-output-path ./harmony/lottie/src/main/cpp/generated --ets-output-path ./harmony/lottie/src/main/ets/generated --arkts-components-spec-paths ./src/LottieAnimationViewNativeComponent.ts",
|
|
48
|
+
"lint-fix:swift": "swiftlint --fix ios"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@dotlottie/react-player": "^1.6.1",
|
|
52
|
+
"@lottiefiles/dotlottie-react": "^0.6.5",
|
|
53
|
+
"@lottiefiles/react-lottie-player": "^3.5.3",
|
|
54
|
+
"react": "*",
|
|
55
|
+
"react-native": ">=0.46",
|
|
56
|
+
"react-native-windows": ">=0.63.x"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"@dotlottie/react-player": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@lottiefiles/dotlottie-react": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"@lottiefiles/react-lottie-player": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"react-native-windows": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@react-native-community/eslint-config": "^3.1.0",
|
|
74
|
+
"@release-it/conventional-changelog": "^5.1.1",
|
|
75
|
+
"@types/react": "^18.2.12",
|
|
76
|
+
"@types/react-native": "^0.70.14",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^5.59.11",
|
|
78
|
+
"@typescript-eslint/parser": "^5.59.11",
|
|
79
|
+
"eslint": "^8.43.0",
|
|
80
|
+
"eslint-config-prettier": "^8.8.0",
|
|
81
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
82
|
+
"metro-react-native-babel-preset": "^0.73.10",
|
|
83
|
+
"prettier": "^2.8.8",
|
|
84
|
+
"react": "18.3.1",
|
|
85
|
+
"react-native": "0.77.1",
|
|
86
|
+
"react-native-builder-bob": "^0.20.4",
|
|
87
|
+
"release-it": "^15.11.0",
|
|
88
|
+
"typescript": "^5.1.3",
|
|
89
|
+
"react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
|
|
90
|
+
},
|
|
91
|
+
"contributors": [
|
|
92
|
+
{
|
|
93
|
+
"name": "Matin Zadeh Dolatabad",
|
|
94
|
+
"email": "me@matinzd.dev"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "Parsa Nasirimehr",
|
|
98
|
+
"email": "p.nasirimehr@gmail.com"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"react-native-builder-bob": {
|
|
102
|
+
"source": "src",
|
|
103
|
+
"output": "lib",
|
|
104
|
+
"targets": [
|
|
105
|
+
"commonjs",
|
|
106
|
+
"module",
|
|
107
|
+
"typescript"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"release-it": {
|
|
111
|
+
"git": {
|
|
112
|
+
"commitMessage": "chore: release ${version}",
|
|
113
|
+
"tagName": "v${version}"
|
|
114
|
+
},
|
|
115
|
+
"npm": {
|
|
116
|
+
"publish": true
|
|
117
|
+
},
|
|
118
|
+
"github": {
|
|
119
|
+
"release": true
|
|
120
|
+
},
|
|
121
|
+
"plugins": {
|
|
122
|
+
"@release-it/conventional-changelog": {
|
|
123
|
+
"preset": "angular",
|
|
124
|
+
"infile": "../../CHANGELOG.md"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"dependencies": {
|
|
129
|
+
"lottie-react-native": "7.2.2"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
DirectEventHandler,
|
|
7
|
+
Int32,
|
|
8
|
+
Double,
|
|
9
|
+
Float,
|
|
10
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
11
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
12
|
+
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
|
|
13
|
+
import type {ProcessedColorValue,ViewProps, HostComponent } from 'react-native';
|
|
14
|
+
import type { UnsafeMixed } from './codegenUtils';
|
|
15
|
+
|
|
16
|
+
export type OnAnimationFinishEvent = Readonly<{
|
|
17
|
+
isCancelled: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export type AnimationFailureEvent = Readonly<{
|
|
21
|
+
error: string;
|
|
22
|
+
}>;
|
|
23
|
+
|
|
24
|
+
export type AnimationLoadedEvent = Readonly<{}>
|
|
25
|
+
|
|
26
|
+
type ColorFilterStruct = Readonly<{
|
|
27
|
+
keypath: string;
|
|
28
|
+
color: ProcessedColorValue;
|
|
29
|
+
}>;
|
|
30
|
+
|
|
31
|
+
export interface NativeProps extends ViewProps {
|
|
32
|
+
resizeMode?: string;
|
|
33
|
+
renderMode?: string;
|
|
34
|
+
sourceName?: string;
|
|
35
|
+
sourceJson?: string;
|
|
36
|
+
sourceURL?: string;
|
|
37
|
+
imageAssetsFolder?: string;
|
|
38
|
+
progress?: Float;
|
|
39
|
+
speed?: Double;
|
|
40
|
+
loop?: boolean;
|
|
41
|
+
autoPlay?: boolean;
|
|
42
|
+
enableMergePathsAndroidForKitKatAndAbove?: boolean;
|
|
43
|
+
hardwareAccelerationAndroid?: boolean;
|
|
44
|
+
cacheComposition?: boolean;
|
|
45
|
+
colorFilters?:UnsafeMixed<ReadonlyArray<ColorFilterStruct>>;
|
|
46
|
+
onAnimationFinish?: DirectEventHandler<
|
|
47
|
+
OnAnimationFinishEvent,
|
|
48
|
+
'onAnimationFinish'
|
|
49
|
+
>;
|
|
50
|
+
onAnimationFailure?: DirectEventHandler<
|
|
51
|
+
AnimationFailureEvent,
|
|
52
|
+
'onAnimationFailure'
|
|
53
|
+
>;
|
|
54
|
+
onAnimationLoaded?: DirectEventHandler<
|
|
55
|
+
AnimationLoadedEvent,
|
|
56
|
+
'onAnimationLoaded'
|
|
57
|
+
>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type LottieViewNativeComponentType = HostComponent<NativeProps>;
|
|
61
|
+
|
|
62
|
+
interface NativeCommands {
|
|
63
|
+
play: (
|
|
64
|
+
viewRef: React.ElementRef<LottieViewNativeComponentType>,
|
|
65
|
+
startFrame: Int32,
|
|
66
|
+
endFrame: Int32,
|
|
67
|
+
) => void;
|
|
68
|
+
reset: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
69
|
+
pause: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
70
|
+
resume: (viewRef: React.ElementRef<LottieViewNativeComponentType>) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
74
|
+
supportedCommands: ['play', 'reset', 'pause', 'resume'],
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export default codegenNativeComponent<NativeProps>('LottieAnimationView') as HostComponent<NativeProps>;
|
|
78
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
export type UnsafeMixed<T> = T;
|
|
6
|
+
|
|
7
|
+
// Fabric doesn't support optional props, so we need to use UnsafeMixed
|
|
8
|
+
// https://github.com/rnmapbox/maps/pull/3082#discussion_r1339858750
|
|
9
|
+
export type OptionalProp<T> = UnsafeMixed<T>;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a Apache-2.0 license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import { LottieView } from 'lottie-react-native/src/LottieView';
|
|
6
|
+
export * from 'lottie-react-native/src/types';
|
|
7
|
+
export default LottieView;
|