@react-native-ohos/react-native-reanimated 3.18.2 → 3.18.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/LICENSE +21 -21
- package/README.OpenSource +10 -10
- package/README.md +406 -10
- package/harmony/reanimated/BuildProfile.ets +1 -1
- package/harmony/reanimated/build-profile.json5 +11 -11
- package/harmony/reanimated/oh-package-lock.json5 +29 -0
- package/harmony/reanimated/oh-package.json5 +11 -11
- package/harmony/reanimated/src/main/cpp/CMakeLists.txt +2 -0
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +86 -86
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.cpp +68 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/PropsRegistry.h +73 -68
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +101 -101
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +51 -51
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedCommitShadowNode.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +96 -96
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +33 -33
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Fabric/ShadowTreeCloner.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationType.h +9 -9
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp +232 -232
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp +870 -870
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.h +147 -147
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp +91 -91
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +176 -176
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +971 -971
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +252 -254
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.cpp +231 -231
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxySpec.h +109 -109
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.cpp +56 -56
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/RNRuntimeDecorator.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +70 -70
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/CollectionUtils.h +14 -14
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.cpp +5 -5
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/FeaturesConfig.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/PlatformDepMethodsHolder.h +98 -98
- package/harmony/reanimated/src/main/cpp/Common/cpp/reanimated/Tools/ReanimatedSystraceSection.h +135 -135
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.cpp +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxy.h +59 -59
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.cpp +27 -27
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/NativeModules/WorkletsModuleProxySpec.h +25 -25
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp +94 -94
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/EventHandlerRegistry.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp +8 -8
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.h +39 -39
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.cpp +326 -326
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/SharedItems/Shareables.h +345 -345
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.cpp +52 -52
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/AsyncQueue.h +35 -35
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/Defs.h +10 -10
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.cpp +342 -342
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSISerializer.h +47 -47
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSLogger.h +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/JSScheduler.h +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/PlatformLogger.h +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp +26 -26
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedJSIUtils.h +199 -199
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.cpp +95 -95
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ReanimatedVersion.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/SingleInstanceChecker.h +72 -72
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/ThreadSafeQueue.h +49 -49
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.cpp +20 -20
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/UIScheduler.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.cpp +29 -29
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/Tools/WorkletEventHandler.h +41 -41
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.cpp +16 -16
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RNRuntimeWorkletDecorator.h +19 -19
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp +112 -112
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.h +127 -127
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp +53 -53
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.h +22 -22
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/RuntimeInitialization.md +191 -191
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp +173 -173
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.h +90 -90
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeCollector.h +36 -36
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp +189 -189
- package/harmony/reanimated/src/main/cpp/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.h +22 -22
- package/harmony/reanimated/src/main/cpp/ReanimatedModule.cpp +29 -19
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.cpp +248 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensor.h +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.cpp +36 -0
- package/harmony/reanimated/src/main/cpp/ReanimatedSensorContainer.h +23 -0
- package/harmony/reanimated/src/main/cpp/WorkletsModule.cpp +60 -60
- package/harmony/reanimated/src/main/cpp/patches/AnimatedSensor/AnimatedSensorModule.cpp +89 -89
- package/harmony/reanimated/src/main/cpp/patches/NativeModules/ReanimatedModuleProxy.cpp +53 -4
- package/harmony/reanimated/src/main/ets/ReanimatedModule.ts +115 -15
- package/harmony/reanimated/src/main/module.json5 +12 -12
- package/harmony/reanimated/src/main/resources/base/element/color.json +7 -7
- package/harmony/reanimated/src/main/resources/base/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/base/profile/main_pages.json +5 -5
- package/harmony/reanimated/src/main/resources/en_US/element/string.json +15 -15
- package/harmony/reanimated/src/main/resources/zh_CN/element/string.json +15 -15
- package/harmony/reanimated/ts.ts +6 -6
- package/harmony/reanimated.har +0 -0
- package/package.json +51 -50
|
@@ -228,16 +228,65 @@ void ReanimatedModuleProxy::init(
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
ReanimatedModuleProxy::~ReanimatedModuleProxy() {
|
|
231
|
-
invalidate();
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
void ReanimatedModuleProxy::invalidate() {
|
|
235
231
|
// event handler registry and frame callbacks store some JSI values from UI
|
|
236
232
|
// runtime, so they have to go away before we tear down the runtime
|
|
237
233
|
eventHandlerRegistry_.reset();
|
|
238
234
|
frameCallbacks_.clear();
|
|
239
235
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
240
236
|
operationsInBatch_.clear();
|
|
237
|
+
// 清空 PropsRegistry 中持有的 ShadowNode 引用,避免析构时级联释放已被框架回收的 ShadowNodeFamily
|
|
238
|
+
if (propsRegistry_) {
|
|
239
|
+
auto lock = propsRegistry_->createLock();
|
|
240
|
+
// 清空内部 map,释放所有 ShadowNode::Shared
|
|
241
|
+
propsRegistry_->clear();
|
|
242
|
+
}
|
|
243
|
+
propsRegistry_.reset();
|
|
244
|
+
|
|
245
|
+
// LayoutAnimationsProxy 持有 ShadowView/MutationNode 引用(内部包含
|
|
246
|
+
// ShadowNode::Shared),需要在 runtime 销毁前清空,避免 runtime 析构时
|
|
247
|
+
// GC 级联触发 ShadowNodeFamily::~ShadowNodeFamily() 崩溃
|
|
248
|
+
if (layoutAnimationsProxy_) {
|
|
249
|
+
auto lock = std::unique_lock<std::recursive_mutex>(
|
|
250
|
+
layoutAnimationsProxy_->mutex);
|
|
251
|
+
layoutAnimationsProxy_->layoutAnimations_.clear();
|
|
252
|
+
layoutAnimationsProxy_->nodeForTag_.clear();
|
|
253
|
+
layoutAnimationsProxy_->deadNodes.clear();
|
|
254
|
+
layoutAnimationsProxy_->leastRemoved.clear();
|
|
255
|
+
layoutAnimationsProxy_->surfaceManager.props_.clear();
|
|
256
|
+
}
|
|
257
|
+
layoutAnimationsProxy_.reset();
|
|
258
|
+
|
|
259
|
+
// 主动触发 Hermes GC:在 uiWorkletRuntime_ 销毁前回收 Hermes 堆中持有
|
|
260
|
+
// ShadowNode::Shared(通过 NativeState / ShadowNodeWrapper)的 JSI 对象。
|
|
261
|
+
//
|
|
262
|
+
// 此处 commitHook_ / mountHook_ 仍未 reset,它们持有 uiManager_ 的
|
|
263
|
+
// shared_ptr,确保 GC 回收 ShadowNodeWrapper 触发 ~ShadowNodeFamily 时
|
|
264
|
+
// ComponentDescriptorRegistry 仍然有效。这样可避免 uiWorkletRuntime_.reset()
|
|
265
|
+
// → HadesGC::finalizeAll() 在上下文可能已失效后触发
|
|
266
|
+
// ~ShadowNodeFamily → ~InstanceHandle 崩溃(0730 复现变体根因)。
|
|
267
|
+
//
|
|
268
|
+
// UI runtime 为 LockableRuntime(supportsLocking=true),每个 JSI 操作
|
|
269
|
+
// 自动加锁 runtimeMutex_(recursive_mutex),从主线程调用 gc() 会阻塞
|
|
270
|
+
// 等待 UI 线程完成当前 worklet 后执行,不会死锁。
|
|
271
|
+
#if JS_RUNTIME_HERMES
|
|
272
|
+
if (uiWorkletRuntime_) {
|
|
273
|
+
try {
|
|
274
|
+
auto &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
|
|
275
|
+
auto gc = uiRuntime.global().getPropertyAsFunction(uiRuntime, "gc");
|
|
276
|
+
gc.call(uiRuntime);
|
|
277
|
+
} catch (const std::exception &) {
|
|
278
|
+
// gc() 调用失败不应阻止后续析构流程
|
|
279
|
+
} catch (...) {
|
|
280
|
+
// 忽略未知异常,保证析构不因 GC 失败而 terminate
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
#endif // JS_RUNTIME_HERMES
|
|
284
|
+
|
|
285
|
+
// GC 之后再注销 hooks:确保 GC 回收 ShadowNodeWrapper 时
|
|
286
|
+
// UIManager(及 ComponentDescriptorRegistry)仍存活
|
|
287
|
+
commitHook_.reset();
|
|
288
|
+
mountHook_.reset();
|
|
289
|
+
uiManager_.reset();
|
|
241
290
|
#endif // RCT_NEW_ARCH_ENABLED
|
|
242
291
|
uiWorkletRuntime_.reset();
|
|
243
292
|
}
|
|
@@ -3,40 +3,118 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import { RNOHLogger, Tag, UITurboModule, UITurboModuleContext } from "@rnoh/react-native-openharmony/ts";
|
|
6
|
-
import { window } from '@kit.ArkUI';
|
|
7
|
-
import {
|
|
6
|
+
import { Animator, AnimatorResult, window } from '@kit.ArkUI';
|
|
7
|
+
import { KeyboardState } from "./AnimationManager";
|
|
8
|
+
import deviceInfo from '@ohos.deviceInfo';
|
|
9
|
+
import { accessibility } from '@kit.AccessibilityKit';
|
|
8
10
|
|
|
9
11
|
export class ReanimatedModule extends UITurboModule {
|
|
10
12
|
static NAME = "ReanimatedModule"
|
|
11
13
|
private logger: RNOHLogger
|
|
12
14
|
private keyBordHeight = 0;
|
|
15
|
+
private currentAnimator: AnimatorResult ;
|
|
16
|
+
private currentAnimatedHeight = 0;
|
|
13
17
|
|
|
14
|
-
constructor(ctx:
|
|
18
|
+
constructor(ctx: UITurboModuleContext) {
|
|
15
19
|
super(ctx);
|
|
16
20
|
this.logger = ctx.logger.clone("Reanimated");
|
|
17
21
|
}
|
|
22
|
+
|
|
18
23
|
public setViewProps(tag: Tag, props: Object) {
|
|
19
24
|
this.ctx.descriptorRegistry.setAnimatedRawProps(tag, props);
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
public async subscribeKeyBordListeners() {
|
|
23
|
-
|
|
27
|
+
public async subscribeKeyBordListeners(isStatusBarTranslucent: boolean, isNavigationBarTranslucent: boolean) {
|
|
28
|
+
//ignore isStatusBarTranslucent - those are Android only
|
|
29
|
+
let windowInstance: window.Window;
|
|
30
|
+
try {
|
|
31
|
+
windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
|
|
32
|
+
} catch (e: ESObject) {
|
|
33
|
+
this.logger.error(`subscribeKeyBordListeners failed: ${e?.message ?? e}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const navIndicatorArea = windowInstance.getWindowAvoidArea(
|
|
37
|
+
window.AvoidAreaType.TYPE_NAVIGATION_INDICATOR
|
|
38
|
+
);
|
|
39
|
+
const navIndicatorHeight = this.ctx.getUIContext().px2vp(
|
|
40
|
+
navIndicatorArea.bottomRect.height
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const isEdgeToEdge = this.isEdgeToEdgeMode(windowInstance);
|
|
44
|
+
const effectiveNavBarTranslucent = isEdgeToEdge && isNavigationBarTranslucent;
|
|
45
|
+
|
|
24
46
|
windowInstance.on('keyboardHeightChange', async (height) => {
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
let rawKeyboardHeight = this.ctx.getUIContext().px2vp(height);
|
|
48
|
+
//If the immersive mode is not enabled, then the area around the bottom navigation bar that needs to be avoided needs to be removed.
|
|
49
|
+
//If the immersive mode is enabled, the returned value will be the height of the current keyboard.
|
|
50
|
+
let keyBordHeight = effectiveNavBarTranslucent
|
|
51
|
+
? rawKeyboardHeight
|
|
52
|
+
: Math.max(0, rawKeyboardHeight - navIndicatorHeight);
|
|
53
|
+
|
|
54
|
+
//Unchanged height, skip handle
|
|
55
|
+
if (Math.abs(keyBordHeight - this.currentAnimatedHeight) < 0.01) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const isOpening = keyBordHeight > this.keyBordHeight;
|
|
60
|
+
|
|
61
|
+
if (this.currentAnimator) {
|
|
62
|
+
this.currentAnimator.onFrame = null;
|
|
63
|
+
this.currentAnimator.onFinish = null;
|
|
64
|
+
this.currentAnimator.cancel();
|
|
65
|
+
this.currentAnimator = null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this.currentAnimator = Animator.create({
|
|
69
|
+
duration: isOpening ? 480 : 350,
|
|
70
|
+
delay: 0,
|
|
71
|
+
//simulate the keyboard pop-up and retraction animations in harmony
|
|
72
|
+
easing: isOpening ? "cubic-bezier(0.2, 0.0, 0.1, 1.0)"
|
|
73
|
+
: "cubic-bezier(0.0, 0.0, 0.1, 1.0)",
|
|
74
|
+
fill: "forwards",
|
|
75
|
+
direction: "normal",
|
|
76
|
+
iterations: 1,
|
|
77
|
+
begin: this.currentAnimatedHeight,
|
|
78
|
+
end: keyBordHeight
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
this.currentAnimator.onFrame = (progress: number) => {
|
|
82
|
+
this.currentAnimatedHeight = progress;
|
|
83
|
+
if (Math.abs(progress - keyBordHeight) < 0.01) { //The final instruction is sent by "onFinish".
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
let status = keyBordHeight > this.keyBordHeight ? KeyboardState.OPENING : KeyboardState.CLOSING;
|
|
87
|
+
this.ctx.rnInstance.postMessageToCpp("REANIMATED_KEY_BOARD_CHANGE",
|
|
88
|
+
{ keyboardHeight: progress, status: status.valueOf() });
|
|
89
|
+
}
|
|
90
|
+
this.currentAnimator.onFinish = () => {
|
|
91
|
+
this.currentAnimatedHeight = keyBordHeight;
|
|
92
|
+
let status = keyBordHeight > this.keyBordHeight ? KeyboardState.OPEN : KeyboardState.CLOSED;
|
|
93
|
+
this.keyBordHeight = keyBordHeight;
|
|
28
94
|
this.ctx.rnInstance.postMessageToCpp("REANIMATED_KEY_BOARD_CHANGE",
|
|
29
|
-
{ keyboardHeight:
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
this.keyBordHeight = keyBordHeight;
|
|
95
|
+
{ keyboardHeight: keyBordHeight, status: status.valueOf() });
|
|
96
|
+
}
|
|
97
|
+
this.currentAnimator.play();
|
|
33
98
|
})
|
|
34
99
|
}
|
|
35
100
|
|
|
36
101
|
public async unsubscribeKeyBordListeners() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
102
|
+
let windowInstance: window.Window;
|
|
103
|
+
try {
|
|
104
|
+
windowInstance = await window.getLastWindow(this.ctx.uiAbilityContext);
|
|
105
|
+
} catch (e: ESObject) {
|
|
106
|
+
this.logger.error(`unsubscribeKeyBordListeners failed: ${e?.message ?? e}`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
windowInstance.off('keyboardHeightChange')
|
|
110
|
+
if (this.currentAnimator) {
|
|
111
|
+
this.currentAnimator.onFrame = null;
|
|
112
|
+
this.currentAnimator.onFinish = null;
|
|
113
|
+
this.currentAnimator.cancel();
|
|
114
|
+
this.currentAnimator = null;
|
|
115
|
+
}
|
|
116
|
+
this.keyBordHeight = 0;
|
|
117
|
+
this.currentAnimatedHeight = 0;
|
|
40
118
|
}
|
|
41
119
|
|
|
42
120
|
public setGestureHandlerState(handlerTag: Tag, newState: number) {
|
|
@@ -45,4 +123,26 @@ export class ReanimatedModule extends UITurboModule {
|
|
|
45
123
|
module.setGestureHandlerState(handlerTag, newState);
|
|
46
124
|
}
|
|
47
125
|
}
|
|
126
|
+
|
|
127
|
+
private isEdgeToEdgeMode(windowInstance: window.Window) {
|
|
128
|
+
let isLayoutFullScreen = false;
|
|
129
|
+
try {
|
|
130
|
+
const windowProperties = windowInstance.getWindowProperties();
|
|
131
|
+
isLayoutFullScreen = windowProperties.isLayoutFullScreen;
|
|
132
|
+
} catch (e: ESObject) {
|
|
133
|
+
isLayoutFullScreen = false;
|
|
134
|
+
}
|
|
135
|
+
return isLayoutFullScreen;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
public isReducedMotionEnabled(): boolean {
|
|
139
|
+
try {
|
|
140
|
+
if (deviceInfo.sdkApiVersion >= 23) {
|
|
141
|
+
return (accessibility as ESObject).isAnimationReduceEnabledSync();
|
|
142
|
+
}
|
|
143
|
+
} catch (e) {
|
|
144
|
+
this.logger.warn(`isReducedMotionEnabled failed: ${JSON.stringify(e)}`);
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
48
148
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "reanimated",
|
|
4
|
-
"type": "har",
|
|
5
|
-
"description": "$string:module_desc",
|
|
6
|
-
"mainElement": "ReanimatedAbility",
|
|
7
|
-
"deviceTypes": [
|
|
8
|
-
"phone",
|
|
9
|
-
"tablet",
|
|
10
|
-
"2in1"
|
|
11
|
-
],
|
|
12
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "reanimated",
|
|
4
|
+
"type": "har",
|
|
5
|
+
"description": "$string:module_desc",
|
|
6
|
+
"mainElement": "ReanimatedAbility",
|
|
7
|
+
"deviceTypes": [
|
|
8
|
+
"phone",
|
|
9
|
+
"tablet",
|
|
10
|
+
"2in1"
|
|
11
|
+
],
|
|
12
|
+
}
|
|
13
13
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"color": [
|
|
3
|
-
{
|
|
4
|
-
"name": "start_window_background",
|
|
5
|
-
"value": "#FFFFFF"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"color": [
|
|
3
|
+
{
|
|
4
|
+
"name": "start_window_background",
|
|
5
|
+
"value": "#FFFFFF"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
8
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "module_desc",
|
|
5
|
-
"value": "module description"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "ReanimatedAbility_desc",
|
|
9
|
-
"value": "description"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"name": "ReanimatedAbility_label",
|
|
13
|
-
"value": "label"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "module_desc",
|
|
5
|
+
"value": "module description"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "ReanimatedAbility_desc",
|
|
9
|
+
"value": "description"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ReanimatedAbility_label",
|
|
13
|
+
"value": "label"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"src": [
|
|
3
|
-
"pages/Index"
|
|
4
|
-
]
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"src": [
|
|
3
|
+
"pages/Index"
|
|
4
|
+
]
|
|
5
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "module_desc",
|
|
5
|
-
"value": "module description"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "ReanimatedAbility_desc",
|
|
9
|
-
"value": "description"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"name": "ReanimatedAbility_label",
|
|
13
|
-
"value": "label"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "module_desc",
|
|
5
|
+
"value": "module description"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "ReanimatedAbility_desc",
|
|
9
|
+
"value": "description"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ReanimatedAbility_label",
|
|
13
|
+
"value": "label"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
16
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "module_desc",
|
|
5
|
-
"value": "模块描述"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "ReanimatedAbility_desc",
|
|
9
|
-
"value": "description"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"name": "ReanimatedAbility_label",
|
|
13
|
-
"value": "label"
|
|
14
|
-
}
|
|
15
|
-
]
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "module_desc",
|
|
5
|
+
"value": "模块描述"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "ReanimatedAbility_desc",
|
|
9
|
+
"value": "description"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ReanimatedAbility_label",
|
|
13
|
+
"value": "label"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
16
|
}
|
package/harmony/reanimated/ts.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
-
// Use of this source code is governed by a MIT license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
export * from './src/main/ets/ReanimatedPackage';
|
|
6
|
-
export * from './src/main/ets/ReanimatedModule';
|
|
1
|
+
// Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
|
|
2
|
+
// Use of this source code is governed by a MIT license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
export * from './src/main/ets/ReanimatedPackage';
|
|
6
|
+
export * from './src/main/ets/ReanimatedModule';
|
package/harmony/reanimated.har
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@react-native-ohos/react-native-reanimated",
|
|
3
|
-
"harmony": {
|
|
4
|
-
"alias": "react-native-reanimated",
|
|
5
|
-
"redirectInternalImports": true
|
|
6
|
-
},
|
|
7
|
-
"version": "3.18.
|
|
8
|
-
"description": "",
|
|
9
|
-
"main": "lib/index.js",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "tsc",
|
|
12
|
-
"pack
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"react
|
|
21
|
-
"react-native
|
|
22
|
-
"react-native-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"@babel/
|
|
33
|
-
"@babel/
|
|
34
|
-
"@babel/preset-
|
|
35
|
-
"@babel/
|
|
36
|
-
"@
|
|
37
|
-
"@types/
|
|
38
|
-
"
|
|
39
|
-
"react": "
|
|
40
|
-
"react
|
|
41
|
-
"react-native
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-reanimated",
|
|
3
|
+
"harmony": {
|
|
4
|
+
"alias": "react-native-reanimated",
|
|
5
|
+
"redirectInternalImports": true
|
|
6
|
+
},
|
|
7
|
+
"version": "3.18.3",
|
|
8
|
+
"description": "",
|
|
9
|
+
"main": "lib/index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"pack":"npm pack",
|
|
13
|
+
"pack:prod": "npm pack",
|
|
14
|
+
"prepack": "npm run build",
|
|
15
|
+
"prepublishOnly": "npm run prepack && react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
|
|
16
|
+
"update_version": "node ./scripts/update-version.js",
|
|
17
|
+
"deploy": "node ./scripts/deploy.js"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"react": "*",
|
|
21
|
+
"react-native": "*",
|
|
22
|
+
"react-native-harmony": "*",
|
|
23
|
+
"react-native-reanimated": "3.18.0"
|
|
24
|
+
},
|
|
25
|
+
"author": "",
|
|
26
|
+
"license": "ISC",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@types/node": "^20.11.4",
|
|
29
|
+
"react-native-reanimated": "3.18.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@babel/cli": "^7.23.4",
|
|
33
|
+
"@babel/core": "^7.23.7",
|
|
34
|
+
"@babel/preset-env": "^7.23.8",
|
|
35
|
+
"@babel/preset-typescript": "^7.23.3",
|
|
36
|
+
"@babel/runtime": "^7.23.8",
|
|
37
|
+
"@types/invariant": "^2.2.35",
|
|
38
|
+
"@types/react": "^18.2.15",
|
|
39
|
+
"metro-react-native-babel-preset": "^0.77.0",
|
|
40
|
+
"react": "18.3.1",
|
|
41
|
+
"react-native": "0.77.1",
|
|
42
|
+
"react-native-builder-bob": "^0.21.3",
|
|
43
|
+
"typescript": "^5.1.6"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"lib",
|
|
47
|
+
"harmony",
|
|
48
|
+
"src",
|
|
49
|
+
"./harmony.tar.gz"
|
|
50
|
+
]
|
|
51
|
+
}
|