@react-native-ohos/react-native-reanimated 3.6.6 → 3.6.8-beta.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/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+ ## 鸿蒙化Log
3
+
4
+ ### [3.6.8-beta.1] 2026-10-10
5
+ #### Added
6
+ - Add setGestureHandlerState TurboModule method to make the public API setGestureState() effective on RNOH.([#118](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pull/118))
7
+
8
+ #### Fixed
9
+ - Use the system Animator instead of setInterval interpolation for keyboard animation, fixing stiff and jittery transitions.([#116](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pull/116))
10
+ - Subtract the navigation bar height in non-immersive mode to correct an oversized keyboard.height.([#113](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pull/113))
11
+
12
+ ### [3.6.7] 2026-08-20
13
+ #### Added
14
+ - add support for useReducedMotion (API >= 23).([#91](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pull/91))
15
+ - Sensor function adaptation.([#53](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues/53))
16
+ - Sensor function adaptation.([#53](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues/53))
17
+
18
+ #### Fixed
19
+ - The window.getLastWindow method has been modified to include try-catch blocks.([#58](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues/58))
20
+ - The window.getLastWindow method has been modified to include try-catch blocks.([#58](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues/58))
21
+
22
+ ### v3.6.6 2026-04-17
23
+ #### Fixed
24
+ - Fix the occasional crash issue of toJSValue
25
+
26
+ ### v3.6.5 2026-03-31
27
+ #### Added
28
+ - Adapt RNcli tool
29
+ #### Fixed
30
+ - Modify the default distribution handling of weakTaskExecutor
package/README.md ADDED
@@ -0,0 +1,399 @@
1
+ > 文档模板:v0.4.2
2
+
3
+ <p align="center">
4
+ <h1 align="center"> <code>react-native-reanimated</code> </h1>
5
+ </p>
6
+
7
+ 本项目基于 [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) 开发。
8
+
9
+ 该第三方库的仓库已迁移至 Gitcode,且支持直接从 npm 下载,新的包名为:`@react-native-ohos/react-native-reanimated` 版本所属关系如下:
10
+
11
+ | 三方库名称 | 三方库版本(npm地址) | 发布信息 | 支持RN版本 | Autolink | 编译API版本 | 社区基线版本 | 源码地址 |
12
+ | ------------ | ------------ | ------------------------------ | ------------- | ------------- |------------------------ | ------------- | ------------- |
13
+ | @react-native-ohos/react-native-reanimated | [~3.6.5](https://www.npmjs.com/package/@react-native-ohos/react-native-reanimated) | [Gitcode Releases](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/releases) | 0.72.* | 是 | API12+ | 3.6.0 | [br_rnoh0.72](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/tree/br_rnoh0.72) |
14
+ | @react-native-oh-tpl/react-native-reanimated | [<= 3.6.4@deprecated](https://www.npmjs.com/package/@react-native-oh-tpl/react-native-reanimated) | [GitHub Releases (deprecated)](https://github.com/react-native-oh-library/react-native-harmony-reanimated/releases) | 0.72.* | 否 | API12+ | 3.6.0 | [GitHub 仓库](https://github.com/react-native-oh-library/react-native-harmony-reanimated) |
15
+
16
+ ## 简介
17
+
18
+ react-native-reanimated 是面向 React Native 生态的第三方原生库,重构实现跨平台动画底层能力,提供声明式 JS 动画 API,实现运行在 UI 线程的高性能流畅动画交互。
19
+
20
+ ## 下载安装
21
+
22
+ 进入到工程目录并输入以下命令:
23
+
24
+ **npm**
25
+
26
+ ```bash
27
+ npm install react-native-reanimated@3.6.0
28
+ npm install @react-native-ohos/react-native-reanimated
29
+ ```
30
+
31
+ **yarn**
32
+
33
+ ```bash
34
+ yarn add react-native-reanimated@3.6.0
35
+ yarn add @react-native-ohos/react-native-reanimated
36
+ ```
37
+
38
+ #### 插件配置
39
+
40
+ 添加插件到 `babel.config.js`:
41
+
42
+ > [!TIP] 为什么需要添加这个?Reanimated Babel 插件会自动转换特殊的 JavaScript 函数(称为 worklet),以便它们可以被传递并在 UI 线程上运行。
43
+
44
+ ```js
45
+ module.exports = {
46
+ presets: [
47
+ ... // don't add it here :)
48
+ ],
49
+ plugins: [
50
+ ...
51
+ 'react-native-reanimated/plugin',
52
+ ],
53
+ };
54
+ ```
55
+
56
+ 清除 Metro 的缓存(推荐):
57
+
58
+ **npm**
59
+
60
+ ```bash
61
+ npm start --reset-cache
62
+ ```
63
+
64
+ **yarn**
65
+
66
+ ```bash
67
+ yarn start --reset-cache
68
+ ```
69
+
70
+ ## Link
71
+
72
+ | | 是否支持autolink | RN框架版本 |
73
+ |--------------------------------------|----------------|-----------|
74
+ | ~3.6.5 | Yes | 0.72 |
75
+ | <= 3.6.4@deprecated | No | 0.72 |
76
+
77
+ 使用AutoLink的工程需要根据该文档配置,Autolink框架指导文档:https://gitcode.com/openharmony-sig/ohos_react_native/blob/master/docs/zh-cn/Autolinking.md
78
+
79
+ 如您使用的版本支持 Autolink,并且工程已接入 Autolink,可跳过ManualLink配置。
80
+
81
+ <details>
82
+ <summary>ManualLink: 此步骤为手动配置原生依赖项的指导</summary>
83
+ 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`。
84
+
85
+ ### 1. Overrides RN SDK
86
+
87
+ 为了让工程依赖同一个版本的 RN SDK,需要在工程根目录的 `oh-package.json5` 添加 overrides 字段,指向工程需要使用的 RN SDK 版本。替换的版本既可以是一个具体的版本号,也可以是一个模糊版本,还可以是本地存在的 HAR 包或源码目录。
88
+
89
+ 关于该字段的作用请阅读[官方说明](https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-oh-package-json5-V5#zh-cn_topic_0000001792256137_overrides)
90
+
91
+ ```json
92
+ {
93
+ ...
94
+ "overrides": {
95
+ "@rnoh/react-native-openharmony" : "./react_native_openharmony"
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### 2. 引入原生端代码
101
+
102
+ 目前有两种方法:
103
+
104
+ - 通过 har 包引入;
105
+ - 直接链接源码。
106
+
107
+ 方法一:通过 har 包引入(推荐)
108
+
109
+ > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
110
+
111
+ 打开 `entry/oh-package.json5`,添加以下依赖
112
+
113
+ ```json
114
+ "dependencies": {
115
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
116
+ "@react-native-ohos/react-native-reanimated": "file:../../node_modules/@react-native-ohos/react-native-reanimated/harmony/reanimated.har",
117
+ }
118
+ ```
119
+
120
+ 点击右上角的 `sync` 按钮
121
+
122
+ 或者在命令行终端执行:
123
+
124
+ ```bash
125
+ cd entry
126
+ ohpm install
127
+ ```
128
+
129
+ 方法二:直接链接源码
130
+
131
+ > [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md)
132
+
133
+ ### 3. 配置 CMakeLists 和引入 ReanimatedPackage
134
+
135
+ 打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
136
+
137
+ ```diff
138
+ project(rnapp)
139
+ cmake_minimum_required(VERSION 3.4.1)
140
+ set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
141
+ + set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
142
+ + set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
143
+ set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
144
+
145
+ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
146
+
147
+ # RNOH_BEGIN: manual_package_linking_1
148
+ add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
149
+
150
+ + add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-reanimated/src/main/cpp" ./reanimated)
151
+
152
+ # RNOH_END: manual_package_linking_1
153
+
154
+ add_library(rnoh_app SHARED
155
+ "./PackageProvider.cpp"
156
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
157
+ )
158
+
159
+ target_link_libraries(rnoh_app PUBLIC rnoh)
160
+
161
+ # RNOH_BEGIN: manual_package_linking_2
162
+ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
163
+ + target_link_libraries(rnoh_app PUBLIC rnoh_reanimated)
164
+
165
+ # RNOH_END: manual_package_linking_2
166
+ ```
167
+ > [!Tip] 注意:上面 NODE_MODULES 定义,为源库的安装路径,用户可以根据安装源库的路径定义 NODE_MODULES。
168
+
169
+ 打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
170
+
171
+ ```diff
172
+ #include "RNOH/PackageProvider.h"
173
+ #include "SamplePackage.h"
174
+ + #include "ReanimatedPackage.h"
175
+ using namespace rnoh;
176
+
177
+ std::vector<std::shared_ptr<Package>> PackageProvider::getPackages(Package::Context ctx) {
178
+ return {
179
+ std::make_shared<SamplePackage>(ctx),
180
+ + std::make_shared<ReanimatedPackage>(ctx)
181
+ };
182
+ }
183
+ ```
184
+
185
+ ### 4. 在 ArkTs 侧引入 ReanimatedPackage
186
+
187
+ 打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
188
+
189
+ ```diff
190
+ ...
191
+ + import { ReanimatedPackage} from '@react-native-ohos/react-native-reanimated/ts';
192
+
193
+ export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
194
+ return [
195
+ new SamplePackage(ctx),
196
+ + new ReanimatedPackage(ctx),
197
+ ];
198
+ }
199
+ ```
200
+
201
+
202
+ </details>
203
+
204
+ ### 运行
205
+
206
+ 点击右上角的 `sync` 按钮
207
+
208
+ 或者在命令行终端执行:
209
+
210
+ ```bash
211
+ cd entry
212
+ ohpm install
213
+ ```
214
+
215
+ 然后编译、运行即可。
216
+
217
+ ## 约束与限制
218
+
219
+ ### 兼容性
220
+
221
+ 本文档内容基于以下版本验证通过:
222
+
223
+ 1. RNOH: 0.72.96; SDK: HarmonyOS 6.0.0 Release SDK; IDE: DevEco Studio 6.0.0.858; ROM: 6.0.0.112;
224
+ 2. RNOH: 0.72.33; SDK: HarmonyOS NEXT B1; IDE: DevEco Studio: 5.0.3.900; ROM: Next.0.0.71;
225
+
226
+ ### 权限要求
227
+
228
+ > [!Tip] 使用传感器的功能,需要使用 >=3.6.7 的版本,如需使用传感器(如加速度传感器、陀螺仪),需要添加对应的传感器权限。
229
+
230
+ 在 `entry` 目录下的 `module.json5` 中添加权限
231
+
232
+ ```
233
+ "requestPermissions": [
234
+ + {
235
+ + "name": "ohos.permission.ACCELEROMETER", // 加速传感器权限名称
236
+ + "reason": "$string:accele_reason",
237
+ + "usedScene": {
238
+ + "abilities": [
239
+ + "EntryAbility"
240
+ + ],
241
+ + "when":"inuse"
242
+ + }
243
+ + },
244
+ + {
245
+ + "name": "ohos.permission.GYROSCOPE", // 陀螺仪传感器权限名称
246
+ + "reason": "$string:gyr_reason",
247
+ + "usedScene": {
248
+ + "abilities": [
249
+ + "EntryAbility"
250
+ + ],
251
+ + "when":"inuse"
252
+ + }
253
+ + },
254
+ ]
255
+
256
+ ```
257
+ 在 entry 目录下添加申请以上权限的原因
258
+ 打开 `entry/src/main/resources/base/element/string.json`,添加:
259
+ ```
260
+ {
261
+ "string": [
262
+ + {
263
+ + "name": "accele_reason",
264
+ + "value": "使用加速度传感器"
265
+ + },
266
+ + {
267
+ + "name": "gyr_reason",
268
+ + "value": "使用陀螺仪传感器"
269
+ + },
270
+ ]
271
+ }
272
+ ```
273
+
274
+ ### 编译运行API要求
275
+
276
+ > [!TIP] 当前三方库所有版本均已实现版本隔离,支持在 `API12+` 工程编译,及 `API12+` ROM 运行。
277
+
278
+ > [!TIP] 以下功能依赖特定版本的API,使用 `低于指定API版本的工程编译` 或 `低于指定API版本的ROM运行` 均可能导致部分功能受限。
279
+ 1. `3.6.7+` 版本新增支持`useReducedMotion` API。该能力依托系统提供的 `isAnimationReduceEnabledSync` API 实现,用于检测设备是否开启减弱动效(reduced motion)辅助功能;该接口仅在 `API23 及以上版本` 的 ROM 环境中生效
280
+
281
+ ## 使用示例
282
+
283
+ 下面的代码展示了这个库的基本使用场景:
284
+
285
+ > [!WARNING] 使用时 import 的库名不变。
286
+
287
+ ```js
288
+ import { Button, View } from "react-native";
289
+ import Animated, { useSharedValue, withSpring } from "react-native-reanimated";
290
+
291
+ export default function App() {
292
+ const width = useSharedValue(100);
293
+
294
+ const handlePress = () => {
295
+ width.value = withSpring(width.value + 50);
296
+ };
297
+
298
+ return (
299
+ <View style={{ flex: 1, alignItems: "center" }}>
300
+ <Animated.View
301
+ style={{
302
+ width,
303
+ height: 100,
304
+ backgroundColor: "violet",
305
+ }}
306
+ />
307
+ <Button onPress={handlePress} title="Click me" />
308
+ </View>
309
+ );
310
+ }
311
+ ```
312
+
313
+ ## 接口说明
314
+
315
+ > [!TIP] "平台"列表示该属性在原三方库上支持的平台。
316
+
317
+ > [!TIP] "HarmonyOS平台支持"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
318
+
319
+ ### API
320
+
321
+ | 名称 | 类型 | 参数类型 | 返回值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
322
+ | ------------------ |----------| -------- | ------ | -------- | -------- | ----------------- | ---- |
323
+ | `withTiming` | function | `(toValue: T, userConfig?: TimingConfig, callback?: AnimationCallback)` | `T` | No | All | yes | withTiming 可基于时长和缓动函数创建动画。 |
324
+ | `withSpring` | function | `(toValue: T, userConfig?: SpringConfig, callback?: AnimationCallback)` | `T` | No | All | yes | withSpring 可创建基于弹簧物理的动画。 |
325
+ | `withDecay` | function | `(userConfig: DecayConfig, callback?: AnimationCallback)` | `number` | No | All | yes | withDecay 可创建模拟带有摩擦力的运动物体的动画。动画将以给定的初速度开始,并根据给定的减速率随时间逐渐减速,直至停止。 |
326
+ | `withRepeat` | function | `(_animation: T, numberOfRepeats?: number, reverse?: boolean, callback?: AnimationCallback)` | `T` | No | All | yes | withRepeat 是一个动画修饰器,可将动画重复指定次数,或无限循环运行。 |
327
+ | `useSharedValue` | function | `(initialValue: Value)` | `SharedValue<Value>` | No | All | yes | useSharedValue 可在组件中定义共享值。 |
328
+ | `useAnimatedStyle` | function | `(updater: () => Style, dependencies?: DependencyList)` | `Style` | No | All | yes | useAnimatedStyle 可创建一个样式对象(类似于 StyleSheet 样式),并可通过共享值对其进行动画处理。 |
329
+ | `useAnimatedRef` | function | `/` | `AnimatedRef<T>` | No | All | yes | useAnimatedRef 可获取视图的引用。可与 measure、scrollTo 和 useScrollViewOffset 函数配合使用。 |
330
+ | `useDerivedValue` | function | `(updater: () => Value, dependencies?: DependencyList)` | `DerivedValue<Value>` | No | All | yes | useDerivedValue 可基于已有的共享值创建新的共享值,并保持其响应性。 |
331
+ | `cancelAnimation` | function | `(sharedValue: SharedValue<TValue>)` | `void` | No | All | yes | cancelAnimation 可取消与某个共享值关联的正在运行的动画。 |
332
+ | `runOnJS` | function | `(fn: Function)` | `(...args: any[]) => void` | No | All | yes | runOnJS 可异步运行未被 worklet 化的函数(这些函数通常无法在 UI 线程上运行)。这适用于大多数外部库,因为它们的函数未标记 "worklet" 指令。 |
333
+ | `runOnUI` | function | `(fn: Function)` | `(...args: any[]) => void` | No | All | yes | runOnUI 可在 UI 线程上异步运行被 worklet 化的函数。 |
334
+ | `measure` | function | `(animatedRef: AnimatedRef<TRef>)` | `MeasuredDimensions \| null` | No | All | yes | measure 可在 UI 线程上同步获取屏幕上视图的尺寸和位置。 |
335
+ | `Easing` | object | `/` | `/` | No | All | yes | 缓动函数,用于设置运动的轨迹。 |
336
+ | `useAnimatedKeyboard` | function | `(options?: AnimatedKeyboardOptions)` | `AnimatedKeyboardInfo` | No | All | yes | useAnimatedKeyboard 可基于虚拟键盘的状态和高度创建动画。 |
337
+ | `useAnimatedGestureHandler` | function | `(handlers: GestureHandlers, config?: Config)` | `OnGestureEvent` | No | All | No | 可基于手势处理器创建动画。 |
338
+ | `useScrollViewOffset` | function | `(animatedRef: AnimatedRef<AnimatedScrollView>, providedOffset?: SharedValue<number>)` | `SharedValue<number>` | No | All | yes | 可基于 ScrollView 的偏移量创建动画。 |
339
+ | `useReducedMotion`<sup>API>=23</sup> | function | `/` | `boolean` | No | All | yes | React Native Reanimated 库中的一个 Hook,用于检测设备是否启用了减弱动效(reduced motion)辅助功能设置。 |
340
+
341
+ ### 属性
342
+
343
+
344
+ **SharedValue**
345
+
346
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
347
+ | --------------------- | ------------------------------------------------------------ | -------- | -------- | --------------- | ------------------ | ---- |
348
+ | addListener | `(listenerID: number, listener: (value: Value) => void) => void` | None | No | Android and iOS | yes | 注册值变化监听器 |
349
+ | modify | `(modifier?: (value: Value) => Value, forceUpdate?: boolean) => void` | None | No | Android and iOS | yes | 对当前值应用变换 |
350
+
351
+ **DerivedValue**
352
+
353
+ | 名称 | 参数类型 | 默认值 | 必填 | 平台 | HarmonyOS平台支持 | 描述 |
354
+ | ------------------------------------ | --------------------------- | -------- | -------- | --------------- | ------------------ | ---- |
355
+ | set | None | None | No | Android and iOS | No | 派生值为只读 |
356
+
357
+ ## 遗留问题
358
+
359
+ ## 其他
360
+ - [React Native中LayoutAnimation与react-native-reanimated存在不兼容,推荐使用react-native-reanimated](https://github.com/software-mansion/react-native-reanimated/issues/6751)
361
+
362
+ ## 目录结构
363
+ ````
364
+ /rntpc_react-native-reanimated # 项目根目录
365
+ ├── react-native-harmony-reanimated # 鸿蒙适配库(发布包:@react-native-ohos/react-native-reanimated)
366
+ │ ├── harmony # 鸿蒙适配产物
367
+ │ │ └── reanimated.har # har 包
368
+ │ ├── src # RN / TS 代码
369
+ │ │ ├── index.ts # 入口文件
370
+ │ │ └── reanimated2 # reanimated 核心源码
371
+ │ ├── scripts # 构建脚本(deploy、update-version)
372
+ │ ├── package.json
373
+ │ ├── babel.config.js
374
+ │ └── tsconfig.json
375
+ ├── tester # 示例 / 测试工程(RN 应用)
376
+ │ ├── harmony # HarmonyOS 工程
377
+ │ │ ├── AppScope
378
+ │ │ ├── entry # 主 Entry 模块
379
+ │ │ ├── reanimated # reanimated 鸿蒙适配模块
380
+ │ │ │ ├── index.ets # 鸿蒙适配代码入口
381
+ │ │ │ └── src
382
+ │ ├── src # RN 示例代码
383
+ │ └── package.json
384
+ ├── CHANGELOG.md # 更新日志
385
+ ├── LICENSE # 开源协议
386
+ ├── OAT.xml # 开源合规
387
+ ├── README.md # 中文安装使用方法
388
+ ├── README_en.md # 英文安装使用方法
389
+ ├── README-Fabric.md # Fabric 相关说明
390
+ └── buildEnv.sh # 构建环境脚本
391
+ ````
392
+
393
+ ## 贡献代码
394
+
395
+ 使用过程中发现任何问题都可以提交 [Issue](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/issues),当然,也非常欢迎提交 [PR](https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/pulls) 。
396
+
397
+ ## 开源协议
398
+
399
+ 本项目基于 [The MIT License (MIT)](https://github.com/software-mansion/react-native-reanimated/blob/main/LICENSE) ,请自由地享受和参与开源。
Binary file
@@ -7,7 +7,7 @@ import { getValueUnpackerCode } from 'react-native-reanimated/src/reanimated2/va
7
7
  function assertSingleReanimatedInstance() {
8
8
  if (global._REANIMATED_VERSION_JS !== undefined &&
9
9
  global._REANIMATED_VERSION_JS !== jsVersion) {
10
- throw new Error(`[Reanimated] Another instance of Reanimated was detected.
10
+ throw new Error(`[Reanimated] Another instance of Reanimated was detected.
11
11
  See \`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#another-instance-of-reanimated-was-detected\` for more details. Previous: ${global._REANIMATED_VERSION_JS}, current: ${jsVersion}.`);
12
12
  }
13
13
  global._REANIMATED_VERSION_JS = jsVersion;
@@ -24,7 +24,7 @@ export class NativeReanimated {
24
24
  ReanimatedModule === null || ReanimatedModule === void 0 ? void 0 : ReanimatedModule.installTurboModule();
25
25
  }
26
26
  if (global.__reanimatedModuleProxy === undefined) {
27
- throw new Error(`[Reanimated] Native part of Reanimated doesn't seem to be initialized.
27
+ throw new Error(`[Reanimated] Native part of Reanimated doesn't seem to be initialized.
28
28
  See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.`);
29
29
  }
30
30
  if (__DEV__) {
package/package.json CHANGED
@@ -1,59 +1,68 @@
1
- {
2
- "name": "@react-native-ohos/react-native-reanimated",
3
- "harmony": {
4
- "alias": "react-native-reanimated",
5
- "redirectInternalImports": true,
6
- "autolinking": {
7
- "etsPackageClassName": "ReanimatedPackage",
8
- "cppPackageClassName": "ReanimatedPackage",
9
- "cmakeLibraryTargetName": "rnoh_reanimated",
10
- "ohPackageName": "@react-native-ohos/react-native-reanimated"
11
- }
12
- },
13
- "version": "3.6.6",
14
- "description": "",
15
- "main": "lib/index.js",
16
- "scripts": {
17
- "build": "tsc",
18
- "pack:prod": "npm pack",
19
- "prepack": "npm run build",
20
- "prepublishOnly": "npm run prepack && react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
21
- "update_version": "node ./scripts/update-version.js",
22
- "deploy": "node ./scripts/deploy.js"
23
- },
24
- "peerDependencies": {
25
- "react": "*",
26
- "react-native": "*",
27
- "react-native-harmony": "*",
28
- "react-native-reanimated": "3.6.0"
29
- },
30
- "author": "",
31
- "license": "ISC",
32
- "dependencies": {
33
- "@types/node": "^20.11.4"
34
- },
35
- "devDependencies": {
36
- "@babel/cli": "^7.23.4",
37
- "@babel/core": "^7.23.7",
38
- "@babel/preset-env": "^7.23.8",
39
- "@babel/preset-typescript": "^7.23.3",
40
- "@babel/runtime": "^7.23.8",
41
- "@types/invariant": "^2.2.35",
42
- "@types/react": "^18.2.15",
43
- "metro-react-native-babel-preset": "^0.77.0",
44
- "react": "18.2.0",
45
- "react-native": "0.72.5",
46
- "react-native-builder-bob": "^0.21.3",
47
- "typescript": "^5.1.6"
48
- },
49
- "publishConfig": {
50
- "registry": "https://registry.npmjs.org/",
51
- "access": "public"
52
- },
53
- "files": [
54
- "lib",
55
- "harmony",
56
- "src",
57
- "./harmony.tar.gz"
58
- ]
59
- }
1
+ {
2
+ "name": "@react-native-ohos/react-native-reanimated",
3
+ "harmony": {
4
+ "alias": "react-native-reanimated",
5
+ "redirectInternalImports": true,
6
+ "autolinking": {
7
+ "etsPackageClassName": "ReanimatedPackage",
8
+ "cppPackageClassName": "ReanimatedPackage",
9
+ "cmakeLibraryTargetName": "rnoh_reanimated",
10
+ "ohPackageName": "@react-native-ohos/react-native-reanimated"
11
+ }
12
+ },
13
+ "version": "3.6.8-beta.1",
14
+ "description": "",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://gitcode.com/CPF-RN/rntpc_react-native-reanimated.git",
18
+ "directory": "react-native-harmony-reanimated"
19
+ },
20
+ "homepage": "https://gitcode.com/CPF-RN/rntpc_react-native-reanimated/blob/br_rnoh0.72/README.md",
21
+ "main": "lib/index.js",
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "pack": "npm pack && cp ./react-native-ohos-react-native-reanimated-*.tgz ..",
25
+ "pack:prod": "npm pack",
26
+ "prepack": "npm run build && node -e \"require('fs').copyFileSync('../CHANGELOG.md','./CHANGELOG.md')\" && node -e \"require('fs').copyFileSync('../README.md','./README.md')\"",
27
+ "postpack": "node -e \"require('fs').rmSync('./CHANGELOG.md',{force:true})\" && node -e \"require('fs').rmSync('./README.md',{force:true})\"",
28
+ "prepublishOnly": "npm run prepack && react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
29
+ "update_version": "node ./scripts/update-version.js",
30
+ "deploy": "node ./scripts/deploy.js"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "*",
34
+ "react-native": "*",
35
+ "react-native-harmony": "*",
36
+ "react-native-reanimated": "3.6.0"
37
+ },
38
+ "author": "",
39
+ "license": "ISC",
40
+ "dependencies": {
41
+ "@types/node": "^20.11.4"
42
+ },
43
+ "devDependencies": {
44
+ "@babel/cli": "^7.23.4",
45
+ "@babel/core": "^7.23.7",
46
+ "@babel/preset-env": "^7.23.8",
47
+ "@babel/preset-typescript": "^7.23.3",
48
+ "@babel/runtime": "^7.23.8",
49
+ "@types/invariant": "^2.2.35",
50
+ "@types/react": "^18.2.15",
51
+ "metro-react-native-babel-preset": "^0.77.0",
52
+ "react": "18.2.0",
53
+ "react-native": "0.72.5",
54
+ "react-native-builder-bob": "^0.21.3",
55
+ "typescript": "^5.1.6"
56
+ },
57
+ "publishConfig": {
58
+ "registry": "https://registry.npmjs.org/",
59
+ "access": "public"
60
+ },
61
+ "files": [
62
+ "lib",
63
+ "harmony",
64
+ "src",
65
+ "./harmony.tar.gz",
66
+ "CHANGELOG.md"
67
+ ]
68
+ }
package/src/index.ts CHANGED
@@ -1,9 +1,9 @@
1
- 'use strict'
2
-
3
- import * as Animated from 'react-native-reanimated/src/Animated';
4
- export * from './reanimated2/NativeReanimated/NativeReanimated'
5
- export * from 'react-native-reanimated/src/reanimated2';
6
-
7
- global._REANIMATED_VERSION_JS = "3.6.0";
8
-
9
- export default Animated;
1
+ 'use strict'
2
+
3
+ import * as Animated from 'react-native-reanimated/src/Animated';
4
+ export * from './reanimated2/NativeReanimated/NativeReanimated'
5
+ export * from 'react-native-reanimated/src/reanimated2';
6
+
7
+ global._REANIMATED_VERSION_JS = "3.6.0";
8
+
9
+ export default Animated;
@@ -1,238 +1,238 @@
1
- // RNOH patch: retrieve ReanimatedModule from TurboModuleRegistry and fix imports
2
-
3
- 'use strict';
4
- import { NativeModules, TurboModule, TurboModuleRegistry } from 'react-native';
5
- import type {
6
- ShareableRef,
7
- ShareableSyncDataHolderRef,
8
- Value3D,
9
- ValueRotation,
10
- } from 'react-native-reanimated/src/reanimated2/commonTypes';
11
- import type {
12
- LayoutAnimationFunction,
13
- LayoutAnimationType,
14
- } from 'react-native-reanimated/src/reanimated2/layoutReanimation';
15
- import { checkCppVersion } from 'react-native-reanimated/src/reanimated2/platform-specific/checkCppVersion';
16
- import { jsVersion } from 'react-native-reanimated/src/reanimated2/platform-specific/jsVersion';
17
- import type { WorkletRuntime } from 'react-native-reanimated/src/reanimated2/runtimes';
18
- import { getValueUnpackerCode } from 'react-native-reanimated/src/reanimated2/valueUnpacker';
19
-
20
- // RNOH patch
21
- interface Spec extends TurboModule {
22
- installTurboModule(): void;
23
- }
24
-
25
- // this is the type of `__reanimatedModuleProxy` which is injected using JSI
26
- export interface NativeReanimatedModule {
27
- installValueUnpacker(valueUnpackerCode: string): void;
28
- makeShareableClone<T>(
29
- value: T,
30
- shouldPersistRemote: boolean
31
- ): ShareableRef<T>;
32
- makeSynchronizedDataHolder<T>(
33
- valueRef: ShareableRef<T>
34
- ): ShareableSyncDataHolderRef<T>;
35
- getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T;
36
- scheduleOnUI<T>(shareable: ShareableRef<T>): void;
37
- createWorkletRuntime(
38
- name: string,
39
- initializer: ShareableRef<() => void>
40
- ): WorkletRuntime;
41
- scheduleOnRuntime<T>(
42
- workletRuntime: WorkletRuntime,
43
- worklet: ShareableRef<T>
44
- ): void;
45
- registerEventHandler<T>(
46
- eventHandler: ShareableRef<T>,
47
- eventName: string,
48
- emitterReactTag: number
49
- ): number;
50
- unregisterEventHandler(id: number): void;
51
- getViewProp<T>(
52
- viewTag: number,
53
- propName: string,
54
- callback?: (result: T) => void
55
- ): Promise<T>;
56
- enableLayoutAnimations(flag: boolean): void;
57
- registerSensor(
58
- sensorType: number,
59
- interval: number,
60
- iosReferenceFrame: number,
61
- handler: ShareableRef<(data: Value3D | ValueRotation) => void>
62
- ): number;
63
- unregisterSensor(sensorId: number): void;
64
- configureProps(uiProps: string[], nativeProps: string[]): void;
65
- subscribeForKeyboardEvents(
66
- handler: ShareableRef<number>,
67
- isStatusBarTranslucent: boolean
68
- ): number;
69
- unsubscribeFromKeyboardEvents(listenerId: number): void;
70
- configureLayoutAnimation(
71
- viewTag: number,
72
- type: LayoutAnimationType,
73
- sharedTransitionTag: string,
74
- config: ShareableRef<Keyframe | LayoutAnimationFunction>
75
- ): void;
76
- setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean): void;
77
- }
78
-
79
- function assertSingleReanimatedInstance() {
80
- if (
81
- global._REANIMATED_VERSION_JS !== undefined &&
82
- global._REANIMATED_VERSION_JS !== jsVersion
83
- ) {
84
- throw new Error(
85
- `[Reanimated] Another instance of Reanimated was detected.
86
- See \`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#another-instance-of-reanimated-was-detected\` for more details. Previous: ${global._REANIMATED_VERSION_JS}, current: ${jsVersion}.`
87
- );
88
- }
89
- global._REANIMATED_VERSION_JS = jsVersion;
90
- }
91
-
92
- export class NativeReanimated {
93
- private InnerNativeModule: NativeReanimatedModule;
94
-
95
- constructor() {
96
- // These checks have to split since version checking depend on the execution order
97
- if (__DEV__) {
98
- assertSingleReanimatedInstance();
99
- }
100
- if (global.__reanimatedModuleProxy === undefined) {
101
- // RNOH patch
102
- const ReanimatedModule = TurboModuleRegistry.get<Spec>(
103
- 'ReanimatedModule',
104
- ) as Spec;
105
- ReanimatedModule?.installTurboModule();
106
- }
107
- if (global.__reanimatedModuleProxy === undefined) {
108
- throw new Error(
109
- `[Reanimated] Native part of Reanimated doesn't seem to be initialized.
110
- See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.`
111
- );
112
- }
113
- if (__DEV__) {
114
- checkCppVersion();
115
- }
116
-
117
- this.InnerNativeModule = global.__reanimatedModuleProxy;
118
- this.InnerNativeModule.installValueUnpacker(getValueUnpackerCode());
119
- }
120
-
121
- makeShareableClone<T>(value: T, shouldPersistRemote: boolean) {
122
- return this.InnerNativeModule.makeShareableClone(
123
- value,
124
- shouldPersistRemote
125
- );
126
- }
127
-
128
- makeSynchronizedDataHolder<T>(valueRef: ShareableRef<T>) {
129
- return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
130
- }
131
-
132
- getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>) {
133
- return this.InnerNativeModule.getDataSynchronously(ref);
134
- }
135
-
136
- scheduleOnUI<T>(shareable: ShareableRef<T>) {
137
- return this.InnerNativeModule.scheduleOnUI(shareable);
138
- }
139
-
140
- createWorkletRuntime(name: string, initializer: ShareableRef<() => void>) {
141
- return this.InnerNativeModule.createWorkletRuntime(name, initializer);
142
- }
143
-
144
- scheduleOnRuntime<T>(
145
- workletRuntime: WorkletRuntime,
146
- shareableWorklet: ShareableRef<T>
147
- ) {
148
- return this.InnerNativeModule.scheduleOnRuntime(
149
- workletRuntime,
150
- shareableWorklet
151
- );
152
- }
153
-
154
- registerSensor(
155
- sensorType: number,
156
- interval: number,
157
- iosReferenceFrame: number,
158
- handler: ShareableRef<(data: Value3D | ValueRotation) => void>
159
- ) {
160
- return this.InnerNativeModule.registerSensor(
161
- sensorType,
162
- interval,
163
- iosReferenceFrame,
164
- handler
165
- );
166
- }
167
-
168
- unregisterSensor(sensorId: number) {
169
- return this.InnerNativeModule.unregisterSensor(sensorId);
170
- }
171
-
172
- registerEventHandler<T>(
173
- eventHandler: ShareableRef<T>,
174
- eventName: string,
175
- emitterReactTag: number
176
- ) {
177
- return this.InnerNativeModule.registerEventHandler(
178
- eventHandler,
179
- eventName,
180
- emitterReactTag
181
- );
182
- }
183
-
184
- unregisterEventHandler(id: number) {
185
- return this.InnerNativeModule.unregisterEventHandler(id);
186
- }
187
-
188
- getViewProp<T>(
189
- viewTag: number,
190
- propName: string,
191
- callback?: (result: T) => void
192
- ) {
193
- return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
194
- }
195
-
196
- configureLayoutAnimation(
197
- viewTag: number,
198
- type: LayoutAnimationType,
199
- sharedTransitionTag: string,
200
- config: ShareableRef<Keyframe | LayoutAnimationFunction>
201
- ) {
202
- this.InnerNativeModule.configureLayoutAnimation(
203
- viewTag,
204
- type,
205
- sharedTransitionTag,
206
- config
207
- );
208
- }
209
-
210
- setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean) {
211
- this.InnerNativeModule.setShouldAnimateExitingForTag(
212
- viewTag,
213
- shouldAnimate
214
- );
215
- }
216
-
217
- enableLayoutAnimations(flag: boolean) {
218
- this.InnerNativeModule.enableLayoutAnimations(flag);
219
- }
220
-
221
- configureProps(uiProps: string[], nativeProps: string[]) {
222
- this.InnerNativeModule.configureProps(uiProps, nativeProps);
223
- }
224
-
225
- subscribeForKeyboardEvents(
226
- handler: ShareableRef<number>,
227
- isStatusBarTranslucent: boolean
228
- ) {
229
- return this.InnerNativeModule.subscribeForKeyboardEvents(
230
- handler,
231
- isStatusBarTranslucent
232
- );
233
- }
234
-
235
- unsubscribeFromKeyboardEvents(listenerId: number) {
236
- this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);
237
- }
238
- }
1
+ // RNOH patch: retrieve ReanimatedModule from TurboModuleRegistry and fix imports
2
+
3
+ 'use strict';
4
+ import { NativeModules, TurboModule, TurboModuleRegistry } from 'react-native';
5
+ import type {
6
+ ShareableRef,
7
+ ShareableSyncDataHolderRef,
8
+ Value3D,
9
+ ValueRotation,
10
+ } from 'react-native-reanimated/src/reanimated2/commonTypes';
11
+ import type {
12
+ LayoutAnimationFunction,
13
+ LayoutAnimationType,
14
+ } from 'react-native-reanimated/src/reanimated2/layoutReanimation';
15
+ import { checkCppVersion } from 'react-native-reanimated/src/reanimated2/platform-specific/checkCppVersion';
16
+ import { jsVersion } from 'react-native-reanimated/src/reanimated2/platform-specific/jsVersion';
17
+ import type { WorkletRuntime } from 'react-native-reanimated/src/reanimated2/runtimes';
18
+ import { getValueUnpackerCode } from 'react-native-reanimated/src/reanimated2/valueUnpacker';
19
+
20
+ // RNOH patch
21
+ interface Spec extends TurboModule {
22
+ installTurboModule(): void;
23
+ }
24
+
25
+ // this is the type of `__reanimatedModuleProxy` which is injected using JSI
26
+ export interface NativeReanimatedModule {
27
+ installValueUnpacker(valueUnpackerCode: string): void;
28
+ makeShareableClone<T>(
29
+ value: T,
30
+ shouldPersistRemote: boolean
31
+ ): ShareableRef<T>;
32
+ makeSynchronizedDataHolder<T>(
33
+ valueRef: ShareableRef<T>
34
+ ): ShareableSyncDataHolderRef<T>;
35
+ getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>): T;
36
+ scheduleOnUI<T>(shareable: ShareableRef<T>): void;
37
+ createWorkletRuntime(
38
+ name: string,
39
+ initializer: ShareableRef<() => void>
40
+ ): WorkletRuntime;
41
+ scheduleOnRuntime<T>(
42
+ workletRuntime: WorkletRuntime,
43
+ worklet: ShareableRef<T>
44
+ ): void;
45
+ registerEventHandler<T>(
46
+ eventHandler: ShareableRef<T>,
47
+ eventName: string,
48
+ emitterReactTag: number
49
+ ): number;
50
+ unregisterEventHandler(id: number): void;
51
+ getViewProp<T>(
52
+ viewTag: number,
53
+ propName: string,
54
+ callback?: (result: T) => void
55
+ ): Promise<T>;
56
+ enableLayoutAnimations(flag: boolean): void;
57
+ registerSensor(
58
+ sensorType: number,
59
+ interval: number,
60
+ iosReferenceFrame: number,
61
+ handler: ShareableRef<(data: Value3D | ValueRotation) => void>
62
+ ): number;
63
+ unregisterSensor(sensorId: number): void;
64
+ configureProps(uiProps: string[], nativeProps: string[]): void;
65
+ subscribeForKeyboardEvents(
66
+ handler: ShareableRef<number>,
67
+ isStatusBarTranslucent: boolean
68
+ ): number;
69
+ unsubscribeFromKeyboardEvents(listenerId: number): void;
70
+ configureLayoutAnimation(
71
+ viewTag: number,
72
+ type: LayoutAnimationType,
73
+ sharedTransitionTag: string,
74
+ config: ShareableRef<Keyframe | LayoutAnimationFunction>
75
+ ): void;
76
+ setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean): void;
77
+ }
78
+
79
+ function assertSingleReanimatedInstance() {
80
+ if (
81
+ global._REANIMATED_VERSION_JS !== undefined &&
82
+ global._REANIMATED_VERSION_JS !== jsVersion
83
+ ) {
84
+ throw new Error(
85
+ `[Reanimated] Another instance of Reanimated was detected.
86
+ See \`https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#another-instance-of-reanimated-was-detected\` for more details. Previous: ${global._REANIMATED_VERSION_JS}, current: ${jsVersion}.`
87
+ );
88
+ }
89
+ global._REANIMATED_VERSION_JS = jsVersion;
90
+ }
91
+
92
+ export class NativeReanimated {
93
+ private InnerNativeModule: NativeReanimatedModule;
94
+
95
+ constructor() {
96
+ // These checks have to split since version checking depend on the execution order
97
+ if (__DEV__) {
98
+ assertSingleReanimatedInstance();
99
+ }
100
+ if (global.__reanimatedModuleProxy === undefined) {
101
+ // RNOH patch
102
+ const ReanimatedModule = TurboModuleRegistry.get<Spec>(
103
+ 'ReanimatedModule',
104
+ ) as Spec;
105
+ ReanimatedModule?.installTurboModule();
106
+ }
107
+ if (global.__reanimatedModuleProxy === undefined) {
108
+ throw new Error(
109
+ `[Reanimated] Native part of Reanimated doesn't seem to be initialized.
110
+ See https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#native-part-of-reanimated-doesnt-seem-to-be-initialized for more details.`
111
+ );
112
+ }
113
+ if (__DEV__) {
114
+ checkCppVersion();
115
+ }
116
+
117
+ this.InnerNativeModule = global.__reanimatedModuleProxy;
118
+ this.InnerNativeModule.installValueUnpacker(getValueUnpackerCode());
119
+ }
120
+
121
+ makeShareableClone<T>(value: T, shouldPersistRemote: boolean) {
122
+ return this.InnerNativeModule.makeShareableClone(
123
+ value,
124
+ shouldPersistRemote
125
+ );
126
+ }
127
+
128
+ makeSynchronizedDataHolder<T>(valueRef: ShareableRef<T>) {
129
+ return this.InnerNativeModule.makeSynchronizedDataHolder(valueRef);
130
+ }
131
+
132
+ getDataSynchronously<T>(ref: ShareableSyncDataHolderRef<T>) {
133
+ return this.InnerNativeModule.getDataSynchronously(ref);
134
+ }
135
+
136
+ scheduleOnUI<T>(shareable: ShareableRef<T>) {
137
+ return this.InnerNativeModule.scheduleOnUI(shareable);
138
+ }
139
+
140
+ createWorkletRuntime(name: string, initializer: ShareableRef<() => void>) {
141
+ return this.InnerNativeModule.createWorkletRuntime(name, initializer);
142
+ }
143
+
144
+ scheduleOnRuntime<T>(
145
+ workletRuntime: WorkletRuntime,
146
+ shareableWorklet: ShareableRef<T>
147
+ ) {
148
+ return this.InnerNativeModule.scheduleOnRuntime(
149
+ workletRuntime,
150
+ shareableWorklet
151
+ );
152
+ }
153
+
154
+ registerSensor(
155
+ sensorType: number,
156
+ interval: number,
157
+ iosReferenceFrame: number,
158
+ handler: ShareableRef<(data: Value3D | ValueRotation) => void>
159
+ ) {
160
+ return this.InnerNativeModule.registerSensor(
161
+ sensorType,
162
+ interval,
163
+ iosReferenceFrame,
164
+ handler
165
+ );
166
+ }
167
+
168
+ unregisterSensor(sensorId: number) {
169
+ return this.InnerNativeModule.unregisterSensor(sensorId);
170
+ }
171
+
172
+ registerEventHandler<T>(
173
+ eventHandler: ShareableRef<T>,
174
+ eventName: string,
175
+ emitterReactTag: number
176
+ ) {
177
+ return this.InnerNativeModule.registerEventHandler(
178
+ eventHandler,
179
+ eventName,
180
+ emitterReactTag
181
+ );
182
+ }
183
+
184
+ unregisterEventHandler(id: number) {
185
+ return this.InnerNativeModule.unregisterEventHandler(id);
186
+ }
187
+
188
+ getViewProp<T>(
189
+ viewTag: number,
190
+ propName: string,
191
+ callback?: (result: T) => void
192
+ ) {
193
+ return this.InnerNativeModule.getViewProp(viewTag, propName, callback);
194
+ }
195
+
196
+ configureLayoutAnimation(
197
+ viewTag: number,
198
+ type: LayoutAnimationType,
199
+ sharedTransitionTag: string,
200
+ config: ShareableRef<Keyframe | LayoutAnimationFunction>
201
+ ) {
202
+ this.InnerNativeModule.configureLayoutAnimation(
203
+ viewTag,
204
+ type,
205
+ sharedTransitionTag,
206
+ config
207
+ );
208
+ }
209
+
210
+ setShouldAnimateExitingForTag(viewTag: number, shouldAnimate: boolean) {
211
+ this.InnerNativeModule.setShouldAnimateExitingForTag(
212
+ viewTag,
213
+ shouldAnimate
214
+ );
215
+ }
216
+
217
+ enableLayoutAnimations(flag: boolean) {
218
+ this.InnerNativeModule.enableLayoutAnimations(flag);
219
+ }
220
+
221
+ configureProps(uiProps: string[], nativeProps: string[]) {
222
+ this.InnerNativeModule.configureProps(uiProps, nativeProps);
223
+ }
224
+
225
+ subscribeForKeyboardEvents(
226
+ handler: ShareableRef<number>,
227
+ isStatusBarTranslucent: boolean
228
+ ) {
229
+ return this.InnerNativeModule.subscribeForKeyboardEvents(
230
+ handler,
231
+ isStatusBarTranslucent
232
+ );
233
+ }
234
+
235
+ unsubscribeFromKeyboardEvents(listenerId: number) {
236
+ this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);
237
+ }
238
+ }
@@ -1,114 +1,114 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable no-var */
3
- 'use strict';
4
- import type {
5
- StyleProps,
6
- MeasuredDimensions,
7
- MapperRegistry,
8
- ShareableRef,
9
- ShareableSyncDataHolderRef,
10
- ShadowNodeWrapper,
11
- __ComplexWorkletFunction,
12
- FlatShareableRef,
13
- } from 'react-native-reanimated/src/reanimated2/commonTypes';
14
- import type { AnimatedStyle } from 'react-native-reanimated/src/reanimated2/helperTypes';
15
- import type { FrameCallbackRegistryUI } from 'react-native-reanimated/src/reanimated2/frameCallback/FrameCallbackRegistryUI';
16
- import type { NativeReanimatedModule } from 'react-native-reanimated/src/reanimated2/NativeReanimated/NativeReanimated';
17
- import type { SensorContainer } from 'react-native-reanimated/src/reanimated2/SensorContainer';
18
- import type { LayoutAnimationsManager } from 'react-native-reanimated/src/reanimated2/layoutReanimation/animationsManager';
19
- import type { ProgressTransitionRegister } from 'react-native-reanimated/src/reanimated2/layoutReanimation/sharedTransitions';
20
- import type { UpdatePropsManager } from 'react-native-reanimated/src/reanimated2/UpdateProps';
21
- import type { callGuardDEV } from 'react-native-reanimated/src/reanimated2/initializers';
22
- import type { WorkletRuntime } from 'react-native-reanimated/src/reanimated2/runtimes';
23
-
24
- declare global {
25
- var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;
26
- var _IS_FABRIC: boolean | undefined;
27
- var _REANIMATED_VERSION_CPP: string | undefined;
28
- var _REANIMATED_VERSION_JS: string | undefined;
29
- var _REANIMATED_VERSION_BABEL_PLUGIN: string | undefined;
30
- var __reanimatedModuleProxy: NativeReanimatedModule | undefined;
31
- var __callGuardDEV: typeof callGuardDEV | undefined;
32
- var evalWithSourceMap:
33
- | ((js: string, sourceURL: string, sourceMap: string) => any)
34
- | undefined;
35
- var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;
36
- var _log: (s: string) => void;
37
- var _toString: (value: unknown) => string;
38
- var _notifyAboutProgress: (
39
- tag: number,
40
- value: Record<string, unknown>,
41
- isSharedTransition: boolean
42
- ) => void;
43
- var _notifyAboutEnd: (tag: number, removeView: boolean) => void;
44
- var _setGestureState: (handlerTag: number, newState: number) => void;
45
- var _makeShareableClone: <T>(value: T) => FlatShareableRef<T>;
46
- var _updateDataSynchronously: (
47
- dataHolder: ShareableSyncDataHolderRef<any>,
48
- data: ShareableRef<any>
49
- ) => void;
50
- var _getDataSynchronously: <T>(
51
- dataHolder: ShareableSyncDataHolderRef<T>
52
- ) => ShareableRef<T>;
53
- var _scheduleOnJS: (
54
- fun: __ComplexWorkletFunction<A, R>,
55
- args?: unknown[]
56
- ) => void;
57
- var _scheduleOnRuntime: (
58
- runtime: WorkletRuntime,
59
- worklet: ShareableRef<() => void>
60
- ) => void;
61
- var _updatePropsPaper:
62
- | ((
63
- operations: {
64
- tag: number;
65
- name: string;
66
- updates: StyleProps | AnimatedStyle<any>;
67
- }[]
68
- ) => void)
69
- | undefined;
70
- var _updatePropsFabric:
71
- | ((
72
- operations: {
73
- shadowNodeWrapper: ShadowNodeWrapper;
74
- updates: StyleProps | AnimatedStyle<any>;
75
- }[]
76
- ) => void)
77
- | undefined;
78
- var _removeFromPropsRegistry: (viewTags: number[]) => void | undefined;
79
- var _measurePaper: ((viewTag: number) => MeasuredDimensions) | undefined;
80
- var _measureFabric:
81
- | ((shadowNodeWrapper: ShadowNodeWrapper) => MeasuredDimensions)
82
- | undefined;
83
- var _scrollToPaper:
84
- | ((viewTag: number, x: number, y: number, animated: boolean) => void)
85
- | undefined;
86
- var _dispatchCommandPaper:
87
- | ((viewTag: number, commandName: string, args: Array<unknown>) => void)
88
- | undefined;
89
- var _dispatchCommandFabric:
90
- | ((
91
- shadowNodeWrapper: ShadowNodeWrapper,
92
- commandName: string,
93
- args: Array<unknown>
94
- ) => void)
95
- | undefined;
96
- var _getAnimationTimestamp: () => number;
97
- var __ErrorUtils: {
98
- reportFatalError: (error: Error) => void;
99
- };
100
- var _frameCallbackRegistry: FrameCallbackRegistryUI;
101
- var console: Console;
102
- var __frameTimestamp: number | undefined;
103
- var __flushAnimationFrame: (timestamp: number) => void;
104
- var __workletsCache: Map<string, any>;
105
- var __handleCache: WeakMap<object, any>;
106
- var __callMicrotasks: () => void;
107
- var __mapperRegistry: MapperRegistry;
108
- var __sensorContainer: SensorContainer;
109
- var _maybeFlushUIUpdatesQueue: () => void;
110
- var LayoutAnimationsManager: LayoutAnimationsManager;
111
- var UpdatePropsManager: UpdatePropsManager;
112
- var ProgressTransitionRegister: ProgressTransitionRegister;
113
- var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;
114
- }
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable no-var */
3
+ 'use strict';
4
+ import type {
5
+ StyleProps,
6
+ MeasuredDimensions,
7
+ MapperRegistry,
8
+ ShareableRef,
9
+ ShareableSyncDataHolderRef,
10
+ ShadowNodeWrapper,
11
+ __ComplexWorkletFunction,
12
+ FlatShareableRef,
13
+ } from 'react-native-reanimated/src/reanimated2/commonTypes';
14
+ import type { AnimatedStyle } from 'react-native-reanimated/src/reanimated2/helperTypes';
15
+ import type { FrameCallbackRegistryUI } from 'react-native-reanimated/src/reanimated2/frameCallback/FrameCallbackRegistryUI';
16
+ import type { NativeReanimatedModule } from 'react-native-reanimated/src/reanimated2/NativeReanimated/NativeReanimated';
17
+ import type { SensorContainer } from 'react-native-reanimated/src/reanimated2/SensorContainer';
18
+ import type { LayoutAnimationsManager } from 'react-native-reanimated/src/reanimated2/layoutReanimation/animationsManager';
19
+ import type { ProgressTransitionRegister } from 'react-native-reanimated/src/reanimated2/layoutReanimation/sharedTransitions';
20
+ import type { UpdatePropsManager } from 'react-native-reanimated/src/reanimated2/UpdateProps';
21
+ import type { callGuardDEV } from 'react-native-reanimated/src/reanimated2/initializers';
22
+ import type { WorkletRuntime } from 'react-native-reanimated/src/reanimated2/runtimes';
23
+
24
+ declare global {
25
+ var _REANIMATED_IS_REDUCED_MOTION: boolean | undefined;
26
+ var _IS_FABRIC: boolean | undefined;
27
+ var _REANIMATED_VERSION_CPP: string | undefined;
28
+ var _REANIMATED_VERSION_JS: string | undefined;
29
+ var _REANIMATED_VERSION_BABEL_PLUGIN: string | undefined;
30
+ var __reanimatedModuleProxy: NativeReanimatedModule | undefined;
31
+ var __callGuardDEV: typeof callGuardDEV | undefined;
32
+ var evalWithSourceMap:
33
+ | ((js: string, sourceURL: string, sourceMap: string) => any)
34
+ | undefined;
35
+ var evalWithSourceUrl: ((js: string, sourceURL: string) => any) | undefined;
36
+ var _log: (s: string) => void;
37
+ var _toString: (value: unknown) => string;
38
+ var _notifyAboutProgress: (
39
+ tag: number,
40
+ value: Record<string, unknown>,
41
+ isSharedTransition: boolean
42
+ ) => void;
43
+ var _notifyAboutEnd: (tag: number, removeView: boolean) => void;
44
+ var _setGestureState: (handlerTag: number, newState: number) => void;
45
+ var _makeShareableClone: <T>(value: T) => FlatShareableRef<T>;
46
+ var _updateDataSynchronously: (
47
+ dataHolder: ShareableSyncDataHolderRef<any>,
48
+ data: ShareableRef<any>
49
+ ) => void;
50
+ var _getDataSynchronously: <T>(
51
+ dataHolder: ShareableSyncDataHolderRef<T>
52
+ ) => ShareableRef<T>;
53
+ var _scheduleOnJS: (
54
+ fun: __ComplexWorkletFunction<A, R>,
55
+ args?: unknown[]
56
+ ) => void;
57
+ var _scheduleOnRuntime: (
58
+ runtime: WorkletRuntime,
59
+ worklet: ShareableRef<() => void>
60
+ ) => void;
61
+ var _updatePropsPaper:
62
+ | ((
63
+ operations: {
64
+ tag: number;
65
+ name: string;
66
+ updates: StyleProps | AnimatedStyle<any>;
67
+ }[]
68
+ ) => void)
69
+ | undefined;
70
+ var _updatePropsFabric:
71
+ | ((
72
+ operations: {
73
+ shadowNodeWrapper: ShadowNodeWrapper;
74
+ updates: StyleProps | AnimatedStyle<any>;
75
+ }[]
76
+ ) => void)
77
+ | undefined;
78
+ var _removeFromPropsRegistry: (viewTags: number[]) => void | undefined;
79
+ var _measurePaper: ((viewTag: number) => MeasuredDimensions) | undefined;
80
+ var _measureFabric:
81
+ | ((shadowNodeWrapper: ShadowNodeWrapper) => MeasuredDimensions)
82
+ | undefined;
83
+ var _scrollToPaper:
84
+ | ((viewTag: number, x: number, y: number, animated: boolean) => void)
85
+ | undefined;
86
+ var _dispatchCommandPaper:
87
+ | ((viewTag: number, commandName: string, args: Array<unknown>) => void)
88
+ | undefined;
89
+ var _dispatchCommandFabric:
90
+ | ((
91
+ shadowNodeWrapper: ShadowNodeWrapper,
92
+ commandName: string,
93
+ args: Array<unknown>
94
+ ) => void)
95
+ | undefined;
96
+ var _getAnimationTimestamp: () => number;
97
+ var __ErrorUtils: {
98
+ reportFatalError: (error: Error) => void;
99
+ };
100
+ var _frameCallbackRegistry: FrameCallbackRegistryUI;
101
+ var console: Console;
102
+ var __frameTimestamp: number | undefined;
103
+ var __flushAnimationFrame: (timestamp: number) => void;
104
+ var __workletsCache: Map<string, any>;
105
+ var __handleCache: WeakMap<object, any>;
106
+ var __callMicrotasks: () => void;
107
+ var __mapperRegistry: MapperRegistry;
108
+ var __sensorContainer: SensorContainer;
109
+ var _maybeFlushUIUpdatesQueue: () => void;
110
+ var LayoutAnimationsManager: LayoutAnimationsManager;
111
+ var UpdatePropsManager: UpdatePropsManager;
112
+ var ProgressTransitionRegister: ProgressTransitionRegister;
113
+ var updateJSProps: (viewTag: number, props: Record<string, unknown>) => void;
114
+ }