react-native-reanimated 3.0.0-rc.6 → 3.0.0-rc.7
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/RNReanimated.podspec +2 -1
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +9 -4
- package/android/src/main/cpp/NativeProxy.cpp +10 -0
- package/ios/REAModule.mm +11 -5
- package/ios/native/REAInitializer.mm +9 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +27 -0
- package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +25 -0
- package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
- package/lib/module/reanimated2/globals.d.js.map +1 -1
- package/package.json +2 -2
- package/scripts/reanimated_utils.rb +3 -2
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +28 -0
- package/src/reanimated2/globals.d.ts +2 -0
package/RNReanimated.podspec
CHANGED
|
@@ -12,6 +12,7 @@ folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comm
|
|
|
12
12
|
folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32'
|
|
13
13
|
boost_compiler_flags = '-Wno-documentation'
|
|
14
14
|
fabric_flags = fabric_enabled ? '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED' : ''
|
|
15
|
+
version_flag = '-DREANIMATED_VERSION=' + reanimated_package_json["version"]
|
|
15
16
|
|
|
16
17
|
Pod::Spec.new do |s|
|
|
17
18
|
|
|
@@ -46,7 +47,7 @@ Pod::Spec.new do |s|
|
|
|
46
47
|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + ' -DHERMES_ENABLE_DEBUGGER'
|
|
47
48
|
s.xcconfig = {
|
|
48
49
|
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/#{folly_prefix}Folly\" \"$(PODS_ROOT)/Headers/Public/React-hermes\" \"$(PODS_ROOT)/Headers/Public/hermes-engine\" \"$(PODS_ROOT)/#{config[:react_native_common_dir]}\"",
|
|
49
|
-
"OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags
|
|
50
|
+
"OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags + " " + fabric_flags + " " + version_flag
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
s.requires_arc = true
|
package/android/CMakeLists.txt
CHANGED
|
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.8)
|
|
|
3
3
|
|
|
4
4
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
|
5
5
|
set (CMAKE_CXX_STANDARD 17)
|
|
6
|
-
set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DANDROID -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION} -DHERMES_ENABLE_DEBUGGER=${HERMES_ENABLE_DEBUGGER} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall -Werror")
|
|
6
|
+
set (DEFAULT_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DANDROID -DREACT_NATIVE_MINOR_VERSION=${REACT_NATIVE_MINOR_VERSION} -DREANIMATED_VERSION=${REANIMATED_VERSION} -DHERMES_ENABLE_DEBUGGER=${HERMES_ENABLE_DEBUGGER} -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -std=c++17 -Wall -Werror")
|
|
7
7
|
if(${IS_NEW_ARCHITECTURE_ENABLED})
|
|
8
8
|
set (ALL_FLAGS "${DEFAULT_FLAGS} -DRCT_NEW_ARCH_ENABLED")
|
|
9
9
|
else()
|
package/android/build.gradle
CHANGED
|
@@ -179,8 +179,11 @@ def checkNoMultipleInstances() {
|
|
|
179
179
|
def getReanimatedVersion() {
|
|
180
180
|
def inputFile = file(projectDir.path + '/../package.json')
|
|
181
181
|
def json = new JsonSlurper().parseText(inputFile.text)
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
return json.version
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
def getReanimatedMajorVersion() {
|
|
186
|
+
def (major, minor, patch) = getReanimatedVersion().tokenize('.')
|
|
184
187
|
return major.toInteger()
|
|
185
188
|
}
|
|
186
189
|
|
|
@@ -209,7 +212,8 @@ def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
|
|
|
209
212
|
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
|
|
210
213
|
def FBJNI_VERSION = "0.3.0"
|
|
211
214
|
def REANIMATED_PACKAGE_BUILD = System.getenv("REANIMATED_PACKAGE_BUILD")
|
|
212
|
-
def
|
|
215
|
+
def REANIMATED_VERSION = getReanimatedVersion()
|
|
216
|
+
def REANIMATED_MAJOR_VERSION = getReanimatedMajorVersion()
|
|
213
217
|
|
|
214
218
|
// We download various C++ open-source dependencies into downloads.
|
|
215
219
|
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
|
|
@@ -461,7 +465,8 @@ android {
|
|
|
461
465
|
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}",
|
|
462
466
|
"-DIS_NEW_ARCHITECTURE_ENABLED=${isNewArchitectureEnabled()}",
|
|
463
467
|
"-DPLAYGROUND_APP_NAME=${getPlaygroundAppName()}",
|
|
464
|
-
"-DREANIMATED_PACKAGE_BUILD=${REANIMATED_PACKAGE_BUILD}"
|
|
468
|
+
"-DREANIMATED_PACKAGE_BUILD=${REANIMATED_PACKAGE_BUILD}",
|
|
469
|
+
"-DREANIMATED_VERSION=${REANIMATED_VERSION}"
|
|
465
470
|
abiFilters (*reactNativeArchitectures())
|
|
466
471
|
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
|
|
467
472
|
}
|
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
#include "ReanimatedUIManagerBinding.h"
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
|
+
#ifdef REANIMATED_VERSION
|
|
27
|
+
#define STRINGIZE(x) #x
|
|
28
|
+
#define STRINGIZE2(x) STRINGIZE(x)
|
|
29
|
+
#define REANIMATED_VERSION_STRING STRINGIZE2(REANIMATED_VERSION)
|
|
30
|
+
#endif // REANIMATED_VERSION
|
|
31
|
+
|
|
26
32
|
namespace reanimated {
|
|
27
33
|
|
|
28
34
|
using namespace facebook;
|
|
@@ -225,6 +231,10 @@ void NativeProxy::installJSIBindings(
|
|
|
225
231
|
runtime_->global().setProperty(*runtime_, "_IS_FABRIC", false);
|
|
226
232
|
#endif
|
|
227
233
|
|
|
234
|
+
auto version =
|
|
235
|
+
jsi::String::createFromUtf8(*runtime_, REANIMATED_VERSION_STRING);
|
|
236
|
+
runtime_->global().setProperty(*runtime_, "_REANIMATED_VERSION_CPP", version);
|
|
237
|
+
|
|
228
238
|
std::shared_ptr<ErrorHandler> errorHandler =
|
|
229
239
|
std::make_shared<AndroidErrorHandler>(scheduler_);
|
|
230
240
|
|
package/ios/REAModule.mm
CHANGED
|
@@ -21,6 +21,12 @@
|
|
|
21
21
|
#import <RNReanimated/REANodesManager.h>
|
|
22
22
|
#import <RNReanimated/SingleInstanceChecker.h>
|
|
23
23
|
|
|
24
|
+
#ifdef REANIMATED_VERSION
|
|
25
|
+
#define STRINGIZE(x) #x
|
|
26
|
+
#define STRINGIZE2(x) STRINGIZE(x)
|
|
27
|
+
#define REANIMATED_VERSION_STRING STRINGIZE2(REANIMATED_VERSION)
|
|
28
|
+
#endif // REANIMATED_VERSION
|
|
29
|
+
|
|
24
30
|
using namespace facebook::react;
|
|
25
31
|
using namespace reanimated;
|
|
26
32
|
|
|
@@ -44,7 +50,6 @@ typedef void (^AnimatedOperation)(REANodesManager *nodesManager);
|
|
|
44
50
|
__weak RCTSurfacePresenter *_surfacePresenter;
|
|
45
51
|
std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry;
|
|
46
52
|
std::weak_ptr<NativeReanimatedModule> reanimatedModule_;
|
|
47
|
-
std::shared_ptr<EventListener> eventListener_;
|
|
48
53
|
#else
|
|
49
54
|
NSMutableArray<AnimatedOperation> *_operations;
|
|
50
55
|
#endif
|
|
@@ -66,8 +71,6 @@ RCT_EXPORT_MODULE(ReanimatedModule);
|
|
|
66
71
|
- (void)invalidate
|
|
67
72
|
{
|
|
68
73
|
#ifdef RCT_NEW_ARCH_ENABLED
|
|
69
|
-
RCTScheduler *scheduler = [_surfacePresenter scheduler];
|
|
70
|
-
[scheduler removeEventListener:eventListener_];
|
|
71
74
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
72
75
|
#endif
|
|
73
76
|
[_nodesManager invalidate];
|
|
@@ -146,7 +149,7 @@ RCT_EXPORT_MODULE(ReanimatedModule);
|
|
|
146
149
|
return;
|
|
147
150
|
}
|
|
148
151
|
if (auto reanimatedModule = strongSelf->reanimatedModule_.lock()) {
|
|
149
|
-
|
|
152
|
+
auto eventListener =
|
|
150
153
|
std::make_shared<facebook::react::EventListener>([reanimatedModule](const RawEvent &rawEvent) {
|
|
151
154
|
if (!RCTIsMainQueue()) {
|
|
152
155
|
// event listener called on the JS thread, let's ignore this event
|
|
@@ -156,7 +159,7 @@ RCT_EXPORT_MODULE(ReanimatedModule);
|
|
|
156
159
|
}
|
|
157
160
|
return reanimatedModule->handleRawEvent(rawEvent, CACurrentMediaTime() * 1000);
|
|
158
161
|
});
|
|
159
|
-
[scheduler addEventListener:
|
|
162
|
+
[scheduler addEventListener:eventListener];
|
|
160
163
|
}
|
|
161
164
|
});
|
|
162
165
|
}
|
|
@@ -219,6 +222,9 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(installTurboModule)
|
|
|
219
222
|
|
|
220
223
|
runtime.global().setProperty(runtime, "_IS_FABRIC", true);
|
|
221
224
|
|
|
225
|
+
auto version = jsi::String::createFromUtf8(runtime, REANIMATED_VERSION_STRING);
|
|
226
|
+
runtime.global().setProperty(runtime, "_REANIMATED_VERSION_CPP", version);
|
|
227
|
+
|
|
222
228
|
runtime.global().setProperty(
|
|
223
229
|
runtime,
|
|
224
230
|
jsi::PropNameID::forAscii(runtime, "__reanimatedModuleProxy"),
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#import <RNReanimated/REAInitializer.h>
|
|
2
2
|
#import <RNReanimated/REAUIManager.h>
|
|
3
3
|
|
|
4
|
+
#ifdef REANIMATED_VERSION
|
|
5
|
+
#define STRINGIZE(x) #x
|
|
6
|
+
#define STRINGIZE2(x) STRINGIZE(x)
|
|
7
|
+
#define REANIMATED_VERSION_STRING STRINGIZE2(REANIMATED_VERSION)
|
|
8
|
+
#endif // REANIMATED_VERSION
|
|
9
|
+
|
|
4
10
|
@interface RCTEventDispatcher (Reanimated)
|
|
5
11
|
|
|
6
12
|
- (void)setBridge:(RCTBridge *)bridge;
|
|
@@ -58,6 +64,9 @@ JSIExecutor::RuntimeInstaller REAJSIExecutorRuntimeInstaller(
|
|
|
58
64
|
|
|
59
65
|
runtime.global().setProperty(runtime, "_IS_FABRIC", false);
|
|
60
66
|
|
|
67
|
+
auto version = jsi::String::createFromUtf8(runtime, REANIMATED_VERSION_STRING);
|
|
68
|
+
runtime.global().setProperty(runtime, "_REANIMATED_VERSION_CPP", version);
|
|
69
|
+
|
|
61
70
|
runtime.global().setProperty(
|
|
62
71
|
runtime,
|
|
63
72
|
jsi::PropNameID::forAscii(runtime, "__reanimatedModuleProxy"),
|
|
@@ -7,6 +7,8 @@ exports.NativeReanimated = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
|
|
10
|
+
var _package = require("../../../package.json");
|
|
11
|
+
|
|
10
12
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
13
|
|
|
12
14
|
class NativeReanimated {
|
|
@@ -26,6 +28,31 @@ class NativeReanimated {
|
|
|
26
28
|
|
|
27
29
|
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
28
30
|
this.native = native;
|
|
31
|
+
|
|
32
|
+
if (native) {
|
|
33
|
+
this.checkVersion();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
checkVersion() {
|
|
38
|
+
const cppVersion = global._REANIMATED_VERSION_CPP;
|
|
39
|
+
|
|
40
|
+
const ok = (() => {
|
|
41
|
+
if (_package.version.match(/^\d+\.\d+\.\d+$/) && cppVersion.match(/^\d+\.\d+\.\d+$/)) {
|
|
42
|
+
// x.y.z, compare only major and minor, skip patch
|
|
43
|
+
const [jsMajor, jsMinor] = _package.version.split('.');
|
|
44
|
+
|
|
45
|
+
const [cppMajor, cppMinor] = cppVersion.split('.');
|
|
46
|
+
return jsMajor === cppMajor && jsMinor === cppMinor;
|
|
47
|
+
} else {
|
|
48
|
+
// alpha, beta or rc, compare everything
|
|
49
|
+
return _package.version === cppVersion;
|
|
50
|
+
}
|
|
51
|
+
})();
|
|
52
|
+
|
|
53
|
+
if (!ok) {
|
|
54
|
+
console.error(`[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${_package.version} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`); // TODO: detect Expo managed workflow
|
|
55
|
+
}
|
|
29
56
|
}
|
|
30
57
|
|
|
31
58
|
installCoreFunctions(valueSetter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;;;;;;AAAA;;;;
|
|
1
|
+
{"version":3,"names":["NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","NativeModules","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","jsVersion","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (\n tag: number,\n cancelled: boolean,\n removeView: boolean\n ) => void;\n const _startObservingProgress: (\n tag: number,\n viewSharedValue: { value: unknown; _value: unknown },\n type: string\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const LayoutAnimationRepository: {\n configs: Record<string, unknown>;\n registerConfig(tag: number, config: Record<string, unknown>): void;\n removeConfig(tag: number): void;\n startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;\n };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n _setGlobalConsole: (console?: ReanimatedConsole) => void;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _stopObservingProgress: (tag: number, flag: boolean) => void;\n _startObservingProgress: (\n tag: number,\n flag: { value: boolean; _value: boolean }\n ) => void;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationRepository: {\n startAnimationForTag(\n tag: number,\n type: string,\n yogaValues: Record<string, number>,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: { value: unknown; _value: unknown }\n ): void;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n }\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _REANIMATED_VERSION_CPP: string;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (\n tag: number,\n cancelled: boolean,\n removeView: boolean\n ) => void;\n const _startObservingProgress: (\n tag: number,\n viewSharedValue: { value: unknown; _value: unknown },\n type: string\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const LayoutAnimationRepository: {\n configs: Record<string, unknown>;\n registerConfig(tag: number, config: Record<string, unknown>): void;\n removeConfig(tag: number): void;\n startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;\n };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _REANIMATED_VERSION_CPP: string;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n _setGlobalConsole: (console?: ReanimatedConsole) => void;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _stopObservingProgress: (tag: number, flag: boolean) => void;\n _startObservingProgress: (\n tag: number,\n flag: { value: boolean; _value: boolean }\n ) => void;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationRepository: {\n startAnimationForTag(\n tag: number,\n type: string,\n yogaValues: Record<string, number>,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: { value: unknown; _value: unknown }\n ): void;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n }\n }\n}\n"],"mappings":""}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
|
+
import { version as jsVersion } from '../../../package.json';
|
|
4
5
|
export class NativeReanimated {
|
|
5
6
|
constructor() {
|
|
6
7
|
let native = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
@@ -18,6 +19,30 @@ export class NativeReanimated {
|
|
|
18
19
|
|
|
19
20
|
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
20
21
|
this.native = native;
|
|
22
|
+
|
|
23
|
+
if (native) {
|
|
24
|
+
this.checkVersion();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
checkVersion() {
|
|
29
|
+
const cppVersion = global._REANIMATED_VERSION_CPP;
|
|
30
|
+
|
|
31
|
+
const ok = (() => {
|
|
32
|
+
if (jsVersion.match(/^\d+\.\d+\.\d+$/) && cppVersion.match(/^\d+\.\d+\.\d+$/)) {
|
|
33
|
+
// x.y.z, compare only major and minor, skip patch
|
|
34
|
+
const [jsMajor, jsMinor] = jsVersion.split('.');
|
|
35
|
+
const [cppMajor, cppMinor] = cppVersion.split('.');
|
|
36
|
+
return jsMajor === cppMajor && jsMinor === cppMinor;
|
|
37
|
+
} else {
|
|
38
|
+
// alpha, beta or rc, compare everything
|
|
39
|
+
return jsVersion === cppVersion;
|
|
40
|
+
}
|
|
41
|
+
})();
|
|
42
|
+
|
|
43
|
+
if (!ok) {
|
|
44
|
+
console.error(`[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`); // TODO: detect Expo managed workflow
|
|
45
|
+
}
|
|
21
46
|
}
|
|
22
47
|
|
|
23
48
|
installCoreFunctions(valueSetter) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":";;AAAA,SAASA,aAAT,QAA8B,cAA9B;
|
|
1
|
+
{"version":3,"names":["NativeModules","version","jsVersion","NativeReanimated","constructor","native","global","__reanimatedModuleProxy","undefined","ReanimatedModule","installTurboModule","InnerNativeModule","checkVersion","cppVersion","_REANIMATED_VERSION_CPP","ok","match","jsMajor","jsMinor","split","cppMajor","cppMinor","console","error","installCoreFunctions","valueSetter","makeShareable","value","makeMutable","makeRemote","object","registerSensor","sensorType","interval","sensorData","unregisterSensor","sensorId","startMapper","mapper","inputs","outputs","updater","viewDescriptors","stopMapper","mapperId","registerEventHandler","eventHash","eventHandler","unregisterEventHandler","id","getViewProp","viewTag","propName","callback","configureLayoutAnimation","type","config","viewSharedValue","enableLayoutAnimations","flag","configureProps","uiProps","nativeProps","subscribeForKeyboardEvents","keyboardEventData","unsubscribeFromKeyboardEvents","listenerId"],"sources":["NativeReanimated.ts"],"sourcesContent":["import { NativeModules } from 'react-native';\nimport {\n SharedValue,\n SensorValue3D,\n SensorValueRotation,\n AnimatedKeyboardInfo,\n} from '../commonTypes';\nimport { Descriptor } from '../hook/commonTypes';\nimport { LayoutAnimationFunction } from '../layoutReanimation';\nimport { version as jsVersion } from '../../../package.json';\n\nexport class NativeReanimated {\n native: boolean;\n private InnerNativeModule: any;\n\n constructor(native = true) {\n if (global.__reanimatedModuleProxy === undefined && native) {\n const { ReanimatedModule } = NativeModules;\n ReanimatedModule?.installTurboModule();\n }\n this.InnerNativeModule = global.__reanimatedModuleProxy;\n this.native = native;\n if (native) {\n this.checkVersion();\n }\n }\n\n checkVersion(): void {\n const cppVersion = global._REANIMATED_VERSION_CPP;\n const ok = (() => {\n if (\n jsVersion.match(/^\\d+\\.\\d+\\.\\d+$/) &&\n cppVersion.match(/^\\d+\\.\\d+\\.\\d+$/)\n ) {\n // x.y.z, compare only major and minor, skip patch\n const [jsMajor, jsMinor] = jsVersion.split('.');\n const [cppMajor, cppMinor] = cppVersion.split('.');\n return jsMajor === cppMajor && jsMinor === cppMinor;\n } else {\n // alpha, beta or rc, compare everything\n return jsVersion === cppVersion;\n }\n })();\n if (!ok) {\n console.error(\n `[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`\n );\n // TODO: detect Expo managed workflow\n }\n }\n\n installCoreFunctions(valueSetter: <T>(value: T) => void): void {\n return this.InnerNativeModule.installCoreFunctions(valueSetter);\n }\n\n makeShareable<T>(value: T): T {\n return this.InnerNativeModule.makeShareable(value);\n }\n\n makeMutable<T>(value: T): SharedValue<T> {\n return this.InnerNativeModule.makeMutable(value);\n }\n\n makeRemote<T>(object = {}): T {\n return this.InnerNativeModule.makeRemote(object);\n }\n\n registerSensor(\n sensorType: number,\n interval: number,\n sensorData: SensorValue3D | SensorValueRotation\n ) {\n return this.InnerNativeModule.registerSensor(\n sensorType,\n interval,\n sensorData\n );\n }\n\n unregisterSensor(sensorId: number) {\n return this.InnerNativeModule.unregisterSensor(sensorId);\n }\n\n startMapper(\n mapper: () => void,\n inputs: any[] = [],\n outputs: any[] = [],\n updater: () => void,\n viewDescriptors: Descriptor[] | SharedValue<Descriptor[]>\n ): number {\n return this.InnerNativeModule.startMapper(\n mapper,\n inputs,\n outputs,\n updater,\n viewDescriptors\n );\n }\n\n stopMapper(mapperId: number): void {\n return this.InnerNativeModule.stopMapper(mapperId);\n }\n\n registerEventHandler<T>(\n eventHash: string,\n eventHandler: (event: T) => void\n ): string {\n return this.InnerNativeModule.registerEventHandler(eventHash, eventHandler);\n }\n\n unregisterEventHandler(id: string): void {\n return this.InnerNativeModule.unregisterEventHandler(id);\n }\n\n getViewProp<T>(\n viewTag: string,\n propName: string,\n callback?: (result: T) => void\n ): Promise<T> {\n return this.InnerNativeModule.getViewProp(viewTag, propName, callback);\n }\n\n configureLayoutAnimation(\n viewTag: number,\n type: string,\n config: Keyframe | LayoutAnimationFunction,\n viewSharedValue: SharedValue<null | Record<string, unknown>> | null\n ) {\n this.InnerNativeModule.configureLayoutAnimation(\n viewTag,\n type,\n config,\n viewSharedValue\n );\n }\n\n enableLayoutAnimations(flag: boolean): void {\n this.InnerNativeModule.enableLayoutAnimations(flag);\n }\n\n configureProps(uiProps: string[], nativeProps: string[]): void {\n this.InnerNativeModule.configureProps(uiProps, nativeProps);\n }\n\n subscribeForKeyboardEvents(keyboardEventData: AnimatedKeyboardInfo): number {\n return this.InnerNativeModule.subscribeForKeyboardEvents(keyboardEventData);\n }\n\n unsubscribeFromKeyboardEvents(listenerId: number): void {\n this.InnerNativeModule.unsubscribeFromKeyboardEvents(listenerId);\n }\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (\n tag: number,\n cancelled: boolean,\n removeView: boolean\n ) => void;\n const _startObservingProgress: (\n tag: number,\n viewSharedValue: { value: unknown; _value: unknown },\n type: string\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const LayoutAnimationRepository: {\n configs: Record<string, unknown>;\n registerConfig(tag: number, config: Record<string, unknown>): void;\n removeConfig(tag: number): void;\n startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;\n };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n _setGlobalConsole: (console?: ReanimatedConsole) => void;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _stopObservingProgress: (tag: number, flag: boolean) => void;\n _startObservingProgress: (\n tag: number,\n flag: { value: boolean; _value: boolean }\n ) => void;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationRepository: {\n startAnimationForTag(\n tag: number,\n type: string,\n yogaValues: Record<string, number>,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: { value: unknown; _value: unknown }\n ): void;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n }\n }\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["globals.d.ts"],"sourcesContent":["import type {\n AnimatedStyle,\n StyleProps,\n MeasuredDimensions,\n} from './commonTypes';\nimport type { ReanimatedConsole } from './core';\nimport type { FrameCallbackRegistryUI } from './frameCallback/FrameCallbackRegistryUI';\nimport type { ShadowNodeWrapper } from './hook/commonTypes';\nimport type { NativeReanimated } from './NativeReanimated/NativeReanimated';\n\ndeclare global {\n const _WORKLET: boolean;\n const _IS_FABRIC: boolean;\n const _REANIMATED_VERSION_CPP: string;\n const _frameTimestamp: number | null;\n const _eventTimestamp: number;\n const __reanimatedModuleProxy: NativeReanimated;\n const _setGlobalConsole: (console?: ReanimatedConsole) => void;\n const _log: (s: string) => void;\n const _getCurrentTime: () => number;\n const _stopObservingProgress: (\n tag: number,\n cancelled: boolean,\n removeView: boolean\n ) => void;\n const _startObservingProgress: (\n tag: number,\n viewSharedValue: { value: unknown; _value: unknown },\n type: string\n ) => void;\n const _setGestureState: (handlerTag: number, newState: number) => void;\n const _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n const _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n const _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n const _measure: (viewTag: number) => MeasuredDimensions;\n const _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n const _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n const _chronoNow: () => number;\n const performance: { now: () => number };\n const LayoutAnimationRepository: {\n configs: Record<string, unknown>;\n registerConfig(tag: number, config: Record<string, unknown>): void;\n removeConfig(tag: number): void;\n startAnimationForTag(tag: number, type: string, yogaValues: unknown): void;\n };\n const ReanimatedDataMock: {\n now: () => number;\n };\n const _frameCallbackRegistry: FrameCallbackRegistryUI;\n\n namespace NodeJS {\n interface Global {\n _WORKLET: boolean;\n _IS_FABRIC: boolean;\n _REANIMATED_VERSION_CPP: string;\n _frameTimestamp: number | null;\n _eventTimestamp: number;\n __reanimatedModuleProxy: NativeReanimated;\n _setGlobalConsole: (console?: ReanimatedConsole) => void;\n _log: (s: string) => void;\n _getCurrentTime: () => number;\n _stopObservingProgress: (tag: number, flag: boolean) => void;\n _startObservingProgress: (\n tag: number,\n flag: { value: boolean; _value: boolean }\n ) => void;\n _setGestureState: (handlerTag: number, newState: number) => void;\n _updatePropsPaper: (\n tag: number,\n name: string,\n updates: StyleProps | AnimatedStyle\n ) => void;\n _updatePropsFabric: (\n shadowNodeWrapper: ShadowNodeWrapper,\n props: StyleProps | AnimatedStyle\n ) => void;\n _removeShadowNodeFromRegistry: (\n shadowNodeWrapper: ShadowNodeWrapper\n ) => void;\n _measure: (viewTag: number) => MeasuredDimensions;\n _scrollTo: (\n viewTag: number,\n x: number,\n y: number,\n animated: boolean\n ) => void;\n _dispatchCommand: (\n shadowNodeWrapper: ShadowNodeWrapper,\n commandName: string,\n args: Array<unknown>\n ) => void;\n _chronoNow: () => number;\n performance: { now: () => number };\n LayoutAnimationRepository: {\n startAnimationForTag(\n tag: number,\n type: string,\n yogaValues: Record<string, number>,\n config: LayoutAnimationFunction | Keyframe,\n viewSharedValue: { value: unknown; _value: unknown }\n ): void;\n };\n ReanimatedDataMock: {\n now: () => number;\n };\n _frameCallbackRegistry: FrameCallbackRegistryUI;\n }\n }\n}\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.7",
|
|
4
4
|
"description": "More powerful alternative to Animated library for React Native.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "yarn run format:js && yarn run lint:js && yarn run test:unit",
|
|
@@ -76,7 +76,6 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"@babel/plugin-transform-object-assign": "^7.16.7",
|
|
78
78
|
"@babel/preset-typescript": "^7.16.7",
|
|
79
|
-
"@types/invariant": "^2.2.35",
|
|
80
79
|
"invariant": "^2.2.4",
|
|
81
80
|
"lodash.isequal": "^4.5.0",
|
|
82
81
|
"setimmediate": "^1.0.5",
|
|
@@ -101,6 +100,7 @@
|
|
|
101
100
|
"@types/babel__core": "^7.1.18",
|
|
102
101
|
"@types/babel__generator": "^7.6.4",
|
|
103
102
|
"@types/babel__traverse": "^7.14.2",
|
|
103
|
+
"@types/invariant": "^2.2.35",
|
|
104
104
|
"@types/jest": "^27.4.0",
|
|
105
105
|
"@types/react-native": "^0.66.0",
|
|
106
106
|
"@typescript-eslint/eslint-plugin": "^5.11.0",
|
|
@@ -17,7 +17,7 @@ def find_config()
|
|
|
17
17
|
:react_native_common_dir => nil,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
react_native_node_modules_dir = File.join(File.dirname(`cd #{Pod::Config.instance.installation_root.to_s} && node --print "require.resolve('react-native/package.json')"`), '..')
|
|
20
|
+
react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..')
|
|
21
21
|
react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir)
|
|
22
22
|
|
|
23
23
|
if react_native_json == nil
|
|
@@ -52,6 +52,7 @@ def assert_no_multiple_instances(react_native_info)
|
|
|
52
52
|
|
|
53
53
|
lib_instances_in_react_native_node_modules = %x[find #{react_native_info[:react_native_node_modules_dir]} -name "package.json" | grep "/react-native-reanimated/package.json"]
|
|
54
54
|
lib_instances_in_react_native_node_modules_array = lib_instances_in_react_native_node_modules.split("\n")
|
|
55
|
+
lib_instances_in_reanimated_node_modules_array = Array.new
|
|
55
56
|
reanimated_instances = lib_instances_in_react_native_node_modules_array.length()
|
|
56
57
|
if react_native_info[:react_native_node_modules_dir] != react_native_info[:reanimated_node_modules_dir]
|
|
57
58
|
lib_instances_in_reanimated_node_modules = %x[find #{react_native_info[:reanimated_node_modules_dir]} -name "package.json" | grep "/react-native-reanimated/package.json"]
|
|
@@ -64,7 +65,7 @@ def assert_no_multiple_instances(react_native_info)
|
|
|
64
65
|
location['/package.json'] = ''
|
|
65
66
|
parsed_location += "- " + location + "\n"
|
|
66
67
|
end
|
|
67
|
-
raise "[react-native-reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsed_location
|
|
68
|
+
raise "[react-native-reanimated] Multiple versions of Reanimated were detected. Only one instance of react-native-reanimated can be installed in a project. You need to resolve the conflict manually. Check out the documentation: https://docs.swmansion.com/react-native-reanimated/docs/next/fundamentals/troubleshooting#multiple-versions-of-reanimated-were-detected \n\nConflict between: \n" + parsed_location
|
|
68
69
|
end
|
|
69
70
|
end
|
|
70
71
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from '../commonTypes';
|
|
8
8
|
import { Descriptor } from '../hook/commonTypes';
|
|
9
9
|
import { LayoutAnimationFunction } from '../layoutReanimation';
|
|
10
|
+
import { version as jsVersion } from '../../../package.json';
|
|
10
11
|
|
|
11
12
|
export class NativeReanimated {
|
|
12
13
|
native: boolean;
|
|
@@ -19,6 +20,33 @@ export class NativeReanimated {
|
|
|
19
20
|
}
|
|
20
21
|
this.InnerNativeModule = global.__reanimatedModuleProxy;
|
|
21
22
|
this.native = native;
|
|
23
|
+
if (native) {
|
|
24
|
+
this.checkVersion();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
checkVersion(): void {
|
|
29
|
+
const cppVersion = global._REANIMATED_VERSION_CPP;
|
|
30
|
+
const ok = (() => {
|
|
31
|
+
if (
|
|
32
|
+
jsVersion.match(/^\d+\.\d+\.\d+$/) &&
|
|
33
|
+
cppVersion.match(/^\d+\.\d+\.\d+$/)
|
|
34
|
+
) {
|
|
35
|
+
// x.y.z, compare only major and minor, skip patch
|
|
36
|
+
const [jsMajor, jsMinor] = jsVersion.split('.');
|
|
37
|
+
const [cppMajor, cppMinor] = cppVersion.split('.');
|
|
38
|
+
return jsMajor === cppMajor && jsMinor === cppMinor;
|
|
39
|
+
} else {
|
|
40
|
+
// alpha, beta or rc, compare everything
|
|
41
|
+
return jsVersion === cppVersion;
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
if (!ok) {
|
|
45
|
+
console.error(
|
|
46
|
+
`[Reanimated] Mismatch between JavaScript part and native part of Reanimated (${jsVersion} vs. ${cppVersion}). Did you forget to re-build the app after upgrading react-native-reanimated? If you use Expo Go, you must downgrade to ${cppVersion} which is bundled into Expo SDK.`
|
|
47
|
+
);
|
|
48
|
+
// TODO: detect Expo managed workflow
|
|
49
|
+
}
|
|
22
50
|
}
|
|
23
51
|
|
|
24
52
|
installCoreFunctions(valueSetter: <T>(value: T) => void): void {
|
|
@@ -11,6 +11,7 @@ import type { NativeReanimated } from './NativeReanimated/NativeReanimated';
|
|
|
11
11
|
declare global {
|
|
12
12
|
const _WORKLET: boolean;
|
|
13
13
|
const _IS_FABRIC: boolean;
|
|
14
|
+
const _REANIMATED_VERSION_CPP: string;
|
|
14
15
|
const _frameTimestamp: number | null;
|
|
15
16
|
const _eventTimestamp: number;
|
|
16
17
|
const __reanimatedModuleProxy: NativeReanimated;
|
|
@@ -69,6 +70,7 @@ declare global {
|
|
|
69
70
|
interface Global {
|
|
70
71
|
_WORKLET: boolean;
|
|
71
72
|
_IS_FABRIC: boolean;
|
|
73
|
+
_REANIMATED_VERSION_CPP: string;
|
|
72
74
|
_frameTimestamp: number | null;
|
|
73
75
|
_eventTimestamp: number;
|
|
74
76
|
__reanimatedModuleProxy: NativeReanimated;
|