@react-native-ohos/react-native-reanimated 3.18.1-rc.2 → 3.18.1-rc.5

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,6 +1,6 @@
1
1
  {
2
2
  name: '@react-native-ohos/react-native-reanimated',
3
- version: '3.18.1-rc.2',
3
+ version: '3.18.1-rc.5',
4
4
  description: "",
5
5
  type: 'module',
6
6
  main: 'index.ets',
@@ -28,6 +28,9 @@ jsi::Value installTurboModule(facebook::jsi::Runtime &rt, react::TurboModule &tu
28
28
  const facebook::jsi::Value *args, size_t count)
29
29
  {
30
30
  auto self = static_cast<ReanimatedModule *>(&turboModule);
31
+ if (self == nullptr) {
32
+ return facebook::jsi::Value::undefined();
33
+ }
31
34
  self->installTurboModule(rt);
32
35
  return facebook::jsi::Value(true);
33
36
  }
@@ -162,7 +165,25 @@ void ReanimatedModule::installTurboModule(facebook::jsi::Runtime &rt)
162
165
  }
163
166
  return instance->getTurboModule<WorkletsModule>("WorkletsModule");
164
167
  };
165
- auto nativeReanimatedModule = std::make_shared<ReanimatedModuleProxy>(workletsModule()->getWorkletsModuleProxy(),
168
+ auto workletsModulePtr = workletsModule();
169
+ if (!workletsModulePtr) {
170
+ LOG(ERROR) << "ReanimatedModule: Failed to get WorkletsModule";
171
+ return;
172
+ }
173
+ auto workletsModuleProxy = workletsModulePtr->getWorkletsModuleProxy();
174
+ if (!workletsModuleProxy) {
175
+ LOG(ERROR) << "ReanimatedModule: WorkletsModuleProxy is null, WorkletsModule may not be initialized yet";
176
+ return;
177
+ }
178
+ if (!jsInvoker_) {
179
+ LOG(ERROR) << "ReanimatedModule: jsInvoker_ is null";
180
+ return;
181
+ }
182
+ if (!m_ctx.scheduler) {
183
+ LOG(ERROR) << "ReanimatedModule: m_ctx.scheduler is null";
184
+ return;
185
+ }
186
+ auto nativeReanimatedModule = std::make_shared<ReanimatedModuleProxy>(workletsModuleProxy,
166
187
  rt, jsInvoker_, platformDepMethodsHolder, isBridgeless, isReducedMotion);
167
188
  weakNativeReanimatedModule_ = nativeReanimatedModule;
168
189
  nativeReanimatedModule->init(platformDepMethodsHolder);
@@ -203,11 +224,24 @@ void ReanimatedModule::installTurboModule(facebook::jsi::Runtime &rt)
203
224
  }
204
225
  return nativeReanimatedModule->handleRawEvent(rawEvent, frameTime);
205
226
  });
206
- m_ctx.scheduler->addEventListener(eventListener);
227
+ if (m_ctx.scheduler) {
228
+ m_ctx.scheduler->addEventListener(eventListener);
229
+ } else {
230
+ LOG(ERROR) << "ReanimatedModule: Cannot add event listener, scheduler is null";
231
+ }
207
232
  }
233
+
208
234
  void ReanimatedModule::injectDependencies(facebook::jsi::Runtime & /* rt */)
209
235
  {
236
+ if (!m_ctx.scheduler) {
237
+ LOG(ERROR) << "ReanimatedModule::injectDependencies: scheduler is null";
238
+ return;
239
+ }
210
240
  const auto uiManager = m_ctx.scheduler->getUIManager();
241
+ if (!uiManager) {
242
+ LOG(WARNING) << "ReanimatedModule::injectDependencies: uiManager is null";
243
+ return;
244
+ }
211
245
  if (auto nativeReanimatedModule = weakNativeReanimatedModule_.lock()) {
212
246
  nativeReanimatedModule->initializeFabric(uiManager);
213
247
  }
@@ -24,6 +24,9 @@ jsi::Value installTurboModule(facebook::jsi::Runtime &rt, react::TurboModule &tu
24
24
  }
25
25
 
26
26
  std::string valueUnpackerCode = args[0].getString(rt).utf8(rt);
27
+ if (self == nullptr) {
28
+ return facebook::jsi::Value::undefined();
29
+ }
27
30
  self->installTurboModule(rt, valueUnpackerCode);
28
31
  return facebook::jsi::Value(true);
29
32
  }
Binary file
package/package.json CHANGED
@@ -4,14 +4,14 @@
4
4
  "alias": "react-native-reanimated",
5
5
  "redirectInternalImports": true
6
6
  },
7
- "version": "3.18.1-rc.2",
7
+ "version": "3.18.1-rc.5",
8
8
  "description": "",
9
9
  "main": "lib/index.js",
10
10
  "scripts": {
11
11
  "build": "tsc",
12
12
  "pack:prod": "npm pack",
13
13
  "prepack": "npm run build",
14
- "prepublishOnly": "npm run prepack ",
14
+ "prepublishOnly": "npm run prepack && react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
15
15
  "update_version": "node ./scripts/update-version.js",
16
16
  "deploy": "node ./scripts/deploy.js"
17
17
  },