@react-native-ohos/lottie-react-native 7.2.3-rc.1 → 7.2.3-rc.2
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 +200 -200
- package/README.OpenSource +10 -10
- package/README.md +12 -12
- package/harmony/lottie/BuildProfile.ets +20 -20
- package/harmony/lottie/build-profile.json5 +8 -8
- package/harmony/lottie/hvigorfile.ts +5 -5
- package/harmony/lottie/index.ets +5 -5
- package/harmony/lottie/oh-package.json5 +14 -14
- package/harmony/lottie/src/main/cpp/CMakeLists.txt +9 -9
- package/harmony/lottie/src/main/cpp/LottieAnimationViewPackage.h +12 -12
- package/harmony/lottie/src/main/cpp/generated/RNOH/generated/BaseLottieReactNativePackage.h +68 -68
- package/harmony/lottie/src/main/cpp/generated/RNOH/generated/components/LottieAnimationViewJSIBinder.h +43 -43
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ComponentDescriptors.h +22 -22
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.cpp +44 -44
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/EventEmitters.h +39 -39
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.cpp +41 -41
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/Props.h +42 -42
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.cpp +19 -19
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/ShadowNodes.h +34 -34
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.cpp +18 -18
- package/harmony/lottie/src/main/cpp/generated/react/renderer/components/lottie_react_native/States.h +35 -35
- package/harmony/lottie/src/main/ets/LottieAnimationTools.ets +20 -20
- package/harmony/lottie/src/main/ets/LottieAnimationView.ets +396 -393
- package/harmony/lottie/src/main/ets/LottieAnimationViewPackage.ts +16 -16
- package/harmony/lottie/src/main/ets/LottieCompositionCache.ets +29 -29
- package/harmony/lottie/src/main/ets/common/TextUtils.ets +17 -17
- package/harmony/lottie/src/main/ets/generated/components/LottieAnimationView.ts +181 -181
- package/harmony/lottie/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/lottie/src/main/ets/generated/index.ets +5 -5
- package/harmony/lottie/src/main/ets/generated/ts.ts +6 -6
- package/harmony/lottie/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/lottie/src/main/module.json5 +9 -9
- package/harmony/lottie/src/main/resources/base/element/string.json +8 -8
- package/harmony/lottie/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/lottie/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/lottie/ts.ts +4 -4
- package/harmony/lottie.har +0 -0
- package/lib/commonjs/LottieAnimationViewNativeComponent.js.map +1 -1
- package/lib/commonjs/codegenUtils.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/LottieAnimationViewNativeComponent.js.map +1 -1
- package/lib/module/codegenUtils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/package.json +131 -131
- package/src/LottieAnimationViewNativeComponent.ts +77 -77
- package/src/codegenUtils.ts +8 -8
- package/src/index.tsx +7 -7
|
@@ -1,17 +1,17 @@
|
|
|
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 { RNPackage } from '@rnoh/react-native-openharmony/ts';
|
|
6
|
-
import type {DescriptorWrapperFactoryByDescriptorTypeCtx, DescriptorWrapperFactoryByDescriptorType} from '@rnoh/react-native-openharmony/ts';
|
|
7
|
-
import { RNC } from './generated/ts';
|
|
8
|
-
|
|
9
|
-
export class LottieAnimationViewPackage extends RNPackage {
|
|
10
|
-
createDescriptorWrapperFactoryByDescriptorType(ctx:
|
|
11
|
-
DescriptorWrapperFactoryByDescriptorTypeCtx):
|
|
12
|
-
DescriptorWrapperFactoryByDescriptorType {
|
|
13
|
-
return {
|
|
14
|
-
[RNC.LottieAnimationView.NAME]: (ctx) => new RNC.LottieAnimationView.DescriptorWrapper(ctx.descriptor)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
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 { RNPackage } from '@rnoh/react-native-openharmony/ts';
|
|
6
|
+
import type {DescriptorWrapperFactoryByDescriptorTypeCtx, DescriptorWrapperFactoryByDescriptorType} from '@rnoh/react-native-openharmony/ts';
|
|
7
|
+
import { RNC } from './generated/ts';
|
|
8
|
+
|
|
9
|
+
export class LottieAnimationViewPackage extends RNPackage {
|
|
10
|
+
createDescriptorWrapperFactoryByDescriptorType(ctx:
|
|
11
|
+
DescriptorWrapperFactoryByDescriptorTypeCtx):
|
|
12
|
+
DescriptorWrapperFactoryByDescriptorType {
|
|
13
|
+
return {
|
|
14
|
+
[RNC.LottieAnimationView.NAME]: (ctx) => new RNC.LottieAnimationView.DescriptorWrapper(ctx.descriptor)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
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 HashMap from '@ohos.util.HashMap'
|
|
6
|
-
import { AnimationObject } from './common/Animation'
|
|
7
|
-
|
|
8
|
-
export class LottieCompositionCache {
|
|
9
|
-
private static readonly sInstance: LottieCompositionCache = new LottieCompositionCache()
|
|
10
|
-
private cache: HashMap<String, AnimationObject> = new HashMap()
|
|
11
|
-
|
|
12
|
-
public static getInstance(): LottieCompositionCache {
|
|
13
|
-
return LottieCompositionCache.sInstance
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get(cacheKey: string): AnimationObject | null {
|
|
17
|
-
return cacheKey ? this.cache.get(cacheKey) : null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
set(cacheKey: string, composition: AnimationObject): void {
|
|
21
|
-
if (cacheKey.length === 0) {
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
this.cache.set(cacheKey, composition)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
clear(): void {
|
|
28
|
-
this.cache.clear()
|
|
29
|
-
}
|
|
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 HashMap from '@ohos.util.HashMap'
|
|
6
|
+
import { AnimationObject } from './common/Animation'
|
|
7
|
+
|
|
8
|
+
export class LottieCompositionCache {
|
|
9
|
+
private static readonly sInstance: LottieCompositionCache = new LottieCompositionCache()
|
|
10
|
+
private cache: HashMap<String, AnimationObject> = new HashMap()
|
|
11
|
+
|
|
12
|
+
public static getInstance(): LottieCompositionCache {
|
|
13
|
+
return LottieCompositionCache.sInstance
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get(cacheKey: string): AnimationObject | null {
|
|
17
|
+
return cacheKey ? this.cache.get(cacheKey) : null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set(cacheKey: string, composition: AnimationObject): void {
|
|
21
|
+
if (cacheKey.length === 0) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
this.cache.set(cacheKey, composition)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
clear(): void {
|
|
28
|
+
this.cache.clear()
|
|
29
|
+
}
|
|
30
30
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
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 function isEmpty(str: string | null | undefined): boolean {
|
|
6
|
-
return str == null || typeof str == 'undefined' || str.length == 0
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getHashCode(str: string): string {
|
|
10
|
-
let hash: number = 1315423911
|
|
11
|
-
let i: number
|
|
12
|
-
let ch: number
|
|
13
|
-
for (i = str.length - 1; i >= 0; i--) {
|
|
14
|
-
ch = str.charCodeAt(i)
|
|
15
|
-
hash ^= ((hash << 5) + ch + (hash >> 2))
|
|
16
|
-
}
|
|
17
|
-
return (hash & 0x7FFFFFFF).toString()
|
|
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 function isEmpty(str: string | null | undefined): boolean {
|
|
6
|
+
return str == null || typeof str == 'undefined' || str.length == 0
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function getHashCode(str: string): string {
|
|
10
|
+
let hash: number = 1315423911
|
|
11
|
+
let i: number
|
|
12
|
+
let ch: number
|
|
13
|
+
for (i = str.length - 1; i >= 0; i--) {
|
|
14
|
+
ch = str.charCodeAt(i)
|
|
15
|
+
hash ^= ((hash << 5) + ch + (hash >> 2))
|
|
16
|
+
}
|
|
17
|
+
return (hash & 0x7FFFFFFF).toString()
|
|
18
18
|
}
|
|
@@ -1,181 +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
|
-
}
|
|
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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./LottieAnimationView"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from "./LottieAnimationView"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./ts"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from "./ts"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * as RNC from "./components/ts"
|
|
6
|
-
export * as TM from "./turboModules/ts"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * as RNC from "./components/ts"
|
|
6
|
+
export * as TM from "./turboModules/ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export {}
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "lottie",
|
|
4
|
-
"type": "har",
|
|
5
|
-
"deviceTypes": [
|
|
6
|
-
"default"
|
|
7
|
-
]
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "lottie",
|
|
4
|
+
"type": "har",
|
|
5
|
+
"deviceTypes": [
|
|
6
|
+
"default"
|
|
7
|
+
]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from npm package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from npm package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from npm package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from npm package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from npm package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from npm package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
package/harmony/lottie/ts.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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
|
-
|
|
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
5
|
export * from './src/main/ets/LottieAnimationViewPackage'
|
package/harmony/lottie.har
CHANGED
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_codegenNativeComponent","_interopRequireDefault","require","_codegenNativeCommands","e","__esModule","default","Commands","exports","codegenNativeCommands","supportedCommands","_default","codegenNativeComponent"],"sourceRoot":"
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["codegenUtils.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_LottieView","require","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_default","default","LottieView"],"sourceRoot":"
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["codegenNativeComponent","codegenNativeCommands","Commands","supportedCommands"],"sourceRoot":"
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"..\\..\\src","sources":["codegenUtils.ts"],"mappings":"","ignoreList":[]}
|