@react-native-ohos/lottie-react-native 7.2.3-rc.2 → 7.2.3-rc.4

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.
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Use these variables when you tailor your ArkTS code. They must be of the const type.
7
7
  */
8
- export const HAR_VERSION = '7.2.3-rc.1';
8
+ export const HAR_VERSION = '7.2.3-rc.3';
9
9
  export const BUILD_MODE_NAME = 'debug';
10
10
  export const DEBUG = true;
11
11
  export const TARGET_NAME = 'default';
@@ -6,7 +6,7 @@
6
6
  "name": "@react-native-ohos/lottie-react-native",
7
7
  "description": "Native part of lottie-react-native",
8
8
  "main": "index.ets",
9
- "version": "7.2.3-rc.2",
9
+ "version": "7.2.3-rc.4",
10
10
  "dependencies": {
11
11
  "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
12
12
  "@ohos/lottie": "2.0.25-rc.1"
@@ -85,6 +85,20 @@ export struct LottieAnimationView {
85
85
  }
86
86
 
87
87
  onStateChanged(propName: string): void {
88
+ if (this.animateItem) {
89
+ this.onSwitchLottie(propName);
90
+ return;
91
+ }
92
+
93
+ // animateItem 为 null 时的延迟处理
94
+ setTimeout(() => {
95
+ if (this.animateItem) {
96
+ this.onSwitchLottie(propName);
97
+ }
98
+ }, 100);
99
+ }
100
+
101
+ onSwitchLottie(propName: string): void {
88
102
  if (this.animateItem == null) {
89
103
  return;
90
104
  }
@@ -106,7 +120,6 @@ export struct LottieAnimationView {
106
120
  break;
107
121
  }
108
122
  }
109
-
110
123
  onAnimationFinish(isCancelled: boolean): void {
111
124
  this.eventEmitter!.emit("animationFinish", {isCancelled: isCancelled});
112
125
  }
@@ -297,9 +310,8 @@ export struct LottieAnimationView {
297
310
  }
298
311
 
299
312
  getAnimateFrame(): number {
300
- const firstFrame: number = this.animateItem?.firstFrame ?? 0;
301
313
  const totalFrames: number = this.animateItem?.totalFrames ?? 0;
302
- return Math.ceil(firstFrame + this.descriptorWrapper.props.progress * totalFrames);
314
+ return Math.ceil(this.descriptorWrapper.props.progress * totalFrames);
303
315
  }
304
316
 
305
317
  addEventFrameListener(): void {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-ohos/lottie-react-native",
3
- "version": "7.2.3-rc.2",
3
+ "version": "7.2.3-rc.4",
4
4
  "description": "c-api-foundation",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",