@react-native-ohos/react-native-reanimated 4.0.2-beta.1 → 4.0.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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Use these variables when you tailor your ArkTS code. They must be of the const type.
3
3
  */
4
- export const HAR_VERSION = '4.0.2-beta.1';
4
+ export const HAR_VERSION = '4.0.2';
5
5
  export const BUILD_MODE_NAME = 'debug';
6
6
  export const DEBUG = true;
7
7
  export const TARGET_NAME = 'default';
@@ -1,6 +1,6 @@
1
1
  {
2
2
  name: '@react-native-ohos/react-native-reanimated',
3
- version: '4.0.2-beta.1',
3
+ version: '4.0.2',
4
4
  description: "",
5
5
  type: 'module',
6
6
  main: 'index.ets',
@@ -6,11 +6,8 @@ add_compile_definitions(REANIMATED_VERSION=4.2.1)
6
6
  #add_compile_definitions(JS_RUNTIME_HERMES=1)
7
7
  add_compile_definitions(RCT_NEW_ARCH_ENABLED=1)
8
8
  add_compile_definitions(REACT_NATIVE_MINOR_VERSION=82)
9
- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
10
- add_compile_definitions(HERMES_ENABLE_DEBUGGER=1)
11
- else()
12
- add_compile_definitions(HERMES_ENABLE_DEBUGGER=0)
13
- endif()
9
+ add_compile_definitions(HERMES_ENABLE_DEBUGGER=0)
10
+
14
11
  set(REANIMATED_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Common")
15
12
 
16
13
  file(GLOB rnoh_reanimated_SRC CONFIGURE_DEPENDS *.cpp)
@@ -162,7 +162,20 @@ void ReanimatedModule::installTurboModule(facebook::jsi::Runtime &rt) {
162
162
  unsubscribeFromKeyboardEventsFunction,
163
163
  maybeFlushUIUpdatesQueueFunction,
164
164
  };
165
- auto isReducedMotion = false; // ANIMATOR_DURATION_SCALE
165
+ bool isReducedMotion = false; // ANIMATOR_DURATION_SCALE
166
+ m_ctx.taskExecutor->runSyncTask(TaskThread::MAIN,
167
+ [ctx = m_ctx, &isReducedMotion]() {
168
+ if (!ctx.arkTSTurboModuleInstanceRef) {
169
+ return;
170
+ }
171
+ ArkJS arkJs(ctx.env);
172
+ auto napiTurboModuleObject =
173
+ arkJs.getObject(ctx.arkTSTurboModuleInstanceRef);
174
+ auto napiResult =
175
+ napiTurboModuleObject.call("isReducedMotionEnabled", {});
176
+ isReducedMotion = arkJs.getBoolean(napiResult);
177
+ });
178
+
166
179
  auto workletsModule = [weakSelf = weak_from_this()]() -> std::shared_ptr<WorkletsModule> {
167
180
  auto self = weakSelf.lock();
168
181
  if (!self) {
@@ -5,8 +5,8 @@
5
5
  import { RNOHLogger, Tag, UITurboModule, UITurboModuleContext } from "@rnoh/react-native-openharmony/ts";
6
6
  import { window } from '@kit.ArkUI';
7
7
  import { AnimationManager } from './AnimationManager'
8
- import settings from '@ohos.settings';
9
- import { } from "@ohos.display"
8
+ import deviceInfo from '@ohos.deviceInfo';
9
+ import { accessibility } from '@kit.AccessibilityKit';
10
10
 
11
11
  export class ReanimatedModule extends UITurboModule {
12
12
  static NAME = "ReanimatedModule"
@@ -49,4 +49,15 @@ export class ReanimatedModule extends UITurboModule {
49
49
  module.setGestureHandlerState(handlerTag, newState);
50
50
  }
51
51
  }
52
+
53
+ public isReducedMotionEnabled(): boolean {
54
+ try {
55
+ if (deviceInfo.sdkApiVersion >= 23) {
56
+ return (accessibility as ESObject).isAnimationReduceEnabledSync();
57
+ }
58
+ } catch (e) {
59
+ this.logger.warn(`isReducedMotionEnabled failed: ${JSON.stringify(e)}`);
60
+ }
61
+ return false;
62
+ }
52
63
  }
Binary file
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "alias": "react-native-reanimated",
5
5
  "redirectInternalImports": true
6
6
  },
7
- "version": "4.0.2-beta.1",
7
+ "version": "4.0.2",
8
8
  "description": "",
9
9
  "main": "lib/index.js",
10
10
  "scripts": {