react-native-reanimated 3.15.3 → 3.15.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.
- package/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp +42 -23
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/module/platform-specific/jsVersion.js.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +14 -18
- package/src/platform-specific/jsVersion.ts +1 -1
|
@@ -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 >= 202002L
|
|
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 >= 202002L
|
|
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(
|
|
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
|
|
201
|
-
// each runtime loop. Within these loops we typically create some
|
|
202
|
-
// JSI objects and hence it allows for such objects to be
|
|
203
|
-
// much sooner.
|
|
204
|
-
//
|
|
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(
|
|
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 ®istrationId) {
|
|
276
288
|
uint64_t id = registrationId.asNumber();
|
|
277
289
|
uiScheduler_->scheduleOnUI(
|
|
278
|
-
|
|
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(
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
-
|
|
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.
|
|
8
|
+
export const jsVersion = '3.15.5';
|
|
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.
|
|
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.5';\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,QAAQ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.5",
|
|
4
4
|
"description": "More powerful alternative to Animated library for React Native.",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "
|
|
7
|
-
"
|
|
8
|
-
"test:update-snapshot": "jest --updateSnapshot",
|
|
9
|
-
"lint": "yarn lint:js && yarn lint:plugin && yarn lint:cpp && yarn lint:java && yarn lint:ios",
|
|
6
|
+
"test": "jest",
|
|
7
|
+
"lint": "yarn lint:js && yarn lint:plugin && yarn lint:common && yarn lint:android && yarn lint:apple",
|
|
10
8
|
"lint:js": "eslint --ext '.js,.ts,.tsx' src __tests__ __typetests__ && yarn prettier --check src __tests__ __typetests__",
|
|
11
|
-
"lint:plugin": "cd plugin && yarn lint
|
|
12
|
-
"lint:
|
|
13
|
-
"lint:
|
|
14
|
-
"lint:
|
|
15
|
-
"
|
|
16
|
-
"format": "yarn format:js && yarn format:plugin && yarn format:java && yarn format:ios && yarn format:android && yarn format:common",
|
|
9
|
+
"lint:plugin": "cd plugin && yarn lint",
|
|
10
|
+
"lint:android": "./android/gradlew -p android spotlessCheck -q && yarn format:android:cpp --dry-run -Werror",
|
|
11
|
+
"lint:common": "./scripts/cpplint.sh Common && yarn format:common --dry-run -Werror",
|
|
12
|
+
"lint:apple": "yarn format:apple --dry-run -Werror",
|
|
13
|
+
"format": "yarn format:js && yarn format:plugin && yarn format:apple && yarn format:android:java && yarn format:android:cpp && yarn format:common",
|
|
17
14
|
"format:js": "prettier --write --list-different src __tests__ __typetests__",
|
|
18
15
|
"format:plugin": "cd plugin && yarn format",
|
|
19
|
-
"format:
|
|
20
|
-
"format:
|
|
21
|
-
"format:android": "find android/src
|
|
22
|
-
"format:common": "find Common
|
|
23
|
-
"format:docs": "cd docs && yarn format",
|
|
16
|
+
"format:apple": "find apple -iname \"*.h\" -o -iname \"*.m\" -o -iname \"*.mm\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
17
|
+
"format:android:java": "node ./scripts/format-java.js",
|
|
18
|
+
"format:android:cpp": "find android/src -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
19
|
+
"format:common": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs clang-format -i",
|
|
24
20
|
"find-unused-code:js": "yarn ts-prune --ignore \"index|.web.\" --error",
|
|
21
|
+
"type:check": "yarn type:check:src && yarn type:check:plugin && ./scripts/test-ts.sh ../../apps/common-app/src/App.tsx __typetests__/common __typetests__/72plus __typetests__/legacy",
|
|
25
22
|
"type:check:src": "yarn tsc --noEmit",
|
|
26
|
-
"type:check:plugin": "cd plugin && yarn type:check:src
|
|
23
|
+
"type:check:plugin": "cd plugin && yarn type:check:src",
|
|
27
24
|
"type:check:app": "./scripts/test-ts.sh ../../apps/common-app/src/App.tsx",
|
|
28
25
|
"type:check:tests:common": "./scripts/test-ts.sh __typetests__/common",
|
|
29
26
|
"type:check:tests:0.72+": "./scripts/test-ts.sh __typetests__/72plus",
|
|
30
27
|
"type:check:tests:legacy": "./scripts/test-ts.sh __typetests__/legacy",
|
|
31
|
-
"type:check:all": "yarn type:check:src && yarn type:check:plugin && ./scripts/test-ts.sh ../../apps/common-app/src/App.tsx __typetests__/common __typetests__/72plus __typetests__/legacy",
|
|
32
28
|
"build": "yarn build:plugin && bob build",
|
|
33
29
|
"build:plugin": "cd plugin && yarn install && yarn build",
|
|
34
30
|
"circular-dependency-check": "yarn madge --extensions js,ts,tsx --circular src lib",
|