react-native-reanimated 3.15.3 → 3.15.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.
@@ -32,6 +32,18 @@
32
32
  #include <fbjni/fbjni.h>
33
33
  #endif
34
34
 
35
+ // Standard `__cplusplus` macro reference:
36
+ // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros
37
+ #if REACT_NATIVE_MINOR_VERSION >= 75 || __cplusplus >= 20202L
38
+ // Implicit copy capture of `this` is deprecated in NDK27, which uses C++20.
39
+ #define COPY_CAPTURE_WITH_THIS [ =, this ] // NOLINT (whitespace/braces)
40
+ #else
41
+ // React Native 0.75 is the last one which allows NDK23. NDK23 uses C++17 and
42
+ // explicitly disallows C++20 features, including the syntax above. Therefore we
43
+ // fallback to the deprecated syntax here.
44
+ #define COPY_CAPTURE_WITH_THIS [=] // NOLINT (whitespace/braces)
45
+ #endif // REACT_NATIVE_MINOR_VERSION >= 75 || __cplusplus >= 20202L
46
+
35
47
  using namespace facebook;
36
48
 
37
49
  #if REACT_NATIVE_MINOR_VERSION == 73 && defined(RCT_NEW_ARCH_ENABLED)
@@ -195,13 +207,13 @@ void NativeReanimatedModule::scheduleOnUI(
195
207
  const jsi::Value &worklet) {
196
208
  auto shareableWorklet = extractShareableOrThrow<ShareableWorklet>(
197
209
  rt, worklet, "[Reanimated] Only worklets can be scheduled to run on UI.");
198
- uiScheduler_->scheduleOnUI([=, this] {
210
+ uiScheduler_->scheduleOnUI(COPY_CAPTURE_WITH_THIS {
199
211
  #if JS_RUNTIME_HERMES
200
- // JSI's scope defined here allows for JSI-objects to be cleared up after
201
- // each runtime loop. Within these loops we typically create some temporary
202
- // JSI objects and hence it allows for such objects to be garbage collected
203
- // much sooner.
204
- // Apparently the scope API is only supported on Hermes at the moment.
212
+ // JSI's scope defined here allows for JSI-objects to be cleared up
213
+ // after each runtime loop. Within these loops we typically create some
214
+ // temporary JSI objects and hence it allows for such objects to be
215
+ // garbage collected much sooner. Apparently the scope API is only
216
+ // supported on Hermes at the moment.
205
217
  const auto scope = jsi::Scope(uiWorkletRuntime_->getJSIRuntime());
206
218
  #endif
207
219
  uiWorkletRuntime_->runGuarded(shareableWorklet);
@@ -261,7 +273,7 @@ jsi::Value NativeReanimatedModule::registerEventHandler(
261
273
  rt, worklet, "[Reanimated] Event handler must be a worklet.");
262
274
  int emitterReactTagInt = emitterReactTag.asNumber();
263
275
 
264
- uiScheduler_->scheduleOnUI([=, this] {
276
+ uiScheduler_->scheduleOnUI(COPY_CAPTURE_WITH_THIS {
265
277
  auto handler = std::make_shared<WorkletEventHandler>(
266
278
  newRegistrationId, eventNameStr, emitterReactTagInt, handlerShareable);
267
279
  eventHandlerRegistry_->registerEventHandler(std::move(handler));
@@ -275,7 +287,9 @@ void NativeReanimatedModule::unregisterEventHandler(
275
287
  const jsi::Value &registrationId) {
276
288
  uint64_t id = registrationId.asNumber();
277
289
  uiScheduler_->scheduleOnUI(
278
- [=, this] { eventHandlerRegistry_->unregisterEventHandler(id); });
290
+ COPY_CAPTURE_WITH_THIS
291
+
292
+ { eventHandlerRegistry_->unregisterEventHandler(id); });
279
293
  }
280
294
 
281
295
  #ifdef RCT_NEW_ARCH_ENABLED
@@ -371,20 +385,23 @@ jsi::Value NativeReanimatedModule::getViewProp(
371
385
 
372
386
  const int viewTagInt = viewTag.asNumber();
373
387
 
374
- uiScheduler_->scheduleOnUI([=, this]() {
375
- jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
376
- const jsi::Value propNameValue =
377
- jsi::String::createFromUtf8(uiRuntime, propNameStr);
378
- const auto resultValue =
379
- obtainPropFunction_(uiRuntime, viewTagInt, propNameValue);
380
- const auto resultStr = resultValue.asString(uiRuntime).utf8(uiRuntime);
381
-
382
- jsScheduler_->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
383
- const auto resultValue =
384
- jsi::String::createFromUtf8(rnRuntime, resultStr);
385
- funPtr->call(rnRuntime, resultValue);
386
- });
387
- });
388
+ uiScheduler_->scheduleOnUI(
389
+ COPY_CAPTURE_WITH_THIS
390
+
391
+ () {
392
+ jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
393
+ const jsi::Value propNameValue =
394
+ jsi::String::createFromUtf8(uiRuntime, propNameStr);
395
+ const auto resultValue =
396
+ obtainPropFunction_(uiRuntime, viewTagInt, propNameValue);
397
+ const auto resultStr = resultValue.asString(uiRuntime).utf8(uiRuntime);
398
+
399
+ jsScheduler_->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
400
+ const auto resultValue =
401
+ jsi::String::createFromUtf8(rnRuntime, resultStr);
402
+ funPtr->call(rnRuntime, resultValue);
403
+ });
404
+ });
388
405
  return jsi::Value::undefined();
389
406
  }
390
407
 
@@ -872,7 +889,9 @@ jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents(
872
889
  handlerWorklet,
873
890
  "[Reanimated] Keyboard event handler must be a worklet.");
874
891
  return subscribeForKeyboardEventsFunction_(
875
- [=, this](int keyboardState, int height) {
892
+ COPY_CAPTURE_WITH_THIS
893
+
894
+ (int keyboardState, int height) {
876
895
  uiWorkletRuntime_->runGuarded(
877
896
  shareableHandler, jsi::Value(keyboardState), jsi::Value(height));
878
897
  },
@@ -5,5 +5,5 @@
5
5
  * with the version used to build the native part of the library in runtime.
6
6
  * Remember to keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '3.15.3';
8
+ export const jsVersion = '3.15.4';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.15.3';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,QAAQ","ignoreList":[]}
1
+ {"version":3,"names":["jsVersion"],"sources":["jsVersion.ts"],"sourcesContent":["'use strict';\n/**\n * We hardcode the version of Reanimated here in order to compare it\n * with the version used to build the native part of the library in runtime.\n * Remember to keep this in sync with the version declared in `package.json`\n */\nexport const jsVersion = '3.15.4';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,QAAQ","ignoreList":[]}
@@ -3,4 +3,4 @@
3
3
  * with the version used to build the native part of the library in runtime.
4
4
  * Remember to keep this in sync with the version declared in `package.json`
5
5
  */
6
- export declare const jsVersion = "3.15.3";
6
+ export declare const jsVersion = "3.15.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "3.15.3",
3
+ "version": "3.15.4",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "test": "yarn format:js && yarn lint:js && yarn test:unit",
@@ -4,4 +4,4 @@
4
4
  * with the version used to build the native part of the library in runtime.
5
5
  * Remember to keep this in sync with the version declared in `package.json`
6
6
  */
7
- export const jsVersion = '3.15.3';
7
+ export const jsVersion = '3.15.4';