react-native-reanimated 2.6.0 → 2.9.0
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/SharedItems/ShareableValue.cpp +2 -2
- package/Common/cpp/Tools/RuntimeDecorator.cpp +17 -25
- package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/CMakeLists.txt +19 -8
- package/android/build.gradle +22 -8
- package/android/react-native-reanimated-65-hermes.aar +0 -0
- package/android/react-native-reanimated-65-jsc.aar +0 -0
- package/android/react-native-reanimated-66-hermes.aar +0 -0
- package/android/react-native-reanimated-66-jsc.aar +0 -0
- package/android/react-native-reanimated-67-hermes.aar +0 -0
- package/android/react-native-reanimated-67-jsc.aar +0 -0
- package/android/react-native-reanimated-68-hermes.aar +0 -0
- package/android/react-native-reanimated-68-jsc.aar +0 -0
- package/android/react-native-reanimated-69-hermes.aar +0 -0
- package/android/react-native-reanimated-69-jsc.aar +0 -0
- package/android/rnVersionPatch/69/.gitkeep +0 -0
- package/android/src/main/cpp/NativeProxy.cpp +35 -14
- package/android/src/main/cpp/headers/NativeProxy.h +2 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +11 -8
- package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +13 -6
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
- package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
- package/ios/LayoutReanimation/REAAnimationsManager.h +1 -1
- package/ios/LayoutReanimation/REAAnimationsManager.m +2 -2
- package/ios/LayoutReanimation/REASnapshot.m +1 -1
- package/ios/LayoutReanimation/REAUIManager.h +1 -1
- package/ios/LayoutReanimation/REAUIManager.mm +4 -5
- package/ios/Nodes/REAAlwaysNode.h +1 -1
- package/ios/Nodes/REAAlwaysNode.m +5 -5
- package/ios/Nodes/REABezierNode.h +1 -1
- package/ios/Nodes/REABezierNode.m +4 -5
- package/ios/Nodes/REABlockNode.h +1 -1
- package/ios/Nodes/REABlockNode.m +2 -2
- package/ios/Nodes/REACallFuncNode.h +1 -1
- package/ios/Nodes/REACallFuncNode.m +5 -5
- package/ios/Nodes/REAClockNodes.h +1 -1
- package/ios/Nodes/REAClockNodes.m +4 -4
- package/ios/Nodes/REAConcatNode.h +1 -1
- package/ios/Nodes/REAConcatNode.m +3 -3
- package/ios/Nodes/REACondNode.h +1 -1
- package/ios/Nodes/REACondNode.m +3 -3
- package/ios/Nodes/READebugNode.h +1 -1
- package/ios/Nodes/READebugNode.m +3 -3
- package/ios/Nodes/REAEventNode.h +1 -2
- package/ios/Nodes/REAEventNode.m +3 -3
- package/ios/Nodes/REAFunctionNode.h +1 -1
- package/ios/Nodes/REAFunctionNode.m +3 -3
- package/ios/Nodes/REAJSCallNode.h +1 -1
- package/ios/Nodes/REAJSCallNode.m +3 -3
- package/ios/Nodes/REANode.m +2 -2
- package/ios/Nodes/REAOperatorNode.h +1 -1
- package/ios/Nodes/REAOperatorNode.m +2 -3
- package/ios/Nodes/REAParamNode.h +1 -1
- package/ios/Nodes/REAParamNode.m +4 -4
- package/ios/Nodes/REAPropsNode.h +1 -1
- package/ios/Nodes/REAPropsNode.m +4 -6
- package/ios/Nodes/REASetNode.h +1 -1
- package/ios/Nodes/REASetNode.m +4 -4
- package/ios/Nodes/REAStyleNode.h +1 -1
- package/ios/Nodes/REAStyleNode.m +2 -3
- package/ios/Nodes/REATransformNode.h +1 -1
- package/ios/Nodes/REATransformNode.m +2 -2
- package/ios/Nodes/REAValueNode.h +1 -3
- package/ios/Nodes/REAValueNode.m +1 -1
- package/ios/REAEventDispatcher.m +1 -1
- package/ios/REAModule.h +1 -1
- package/ios/REAModule.m +4 -5
- package/ios/REANodesManager.h +1 -2
- package/ios/REANodesManager.m +21 -23
- package/ios/Transitioning/RCTConvert+REATransition.h +1 -2
- package/ios/Transitioning/RCTConvert+REATransition.m +1 -1
- package/ios/Transitioning/REAAllTransitions.h +1 -1
- package/ios/Transitioning/REAAllTransitions.m +2 -3
- package/ios/Transitioning/REATransition.h +2 -3
- package/ios/Transitioning/REATransition.m +3 -4
- package/ios/Transitioning/REATransitionAnimation.m +1 -2
- package/ios/Transitioning/REATransitionManager.m +2 -4
- package/ios/Transitioning/REATransitionValues.m +2 -3
- package/ios/native/NativeMethods.h +1 -3
- package/ios/native/NativeMethods.mm +1 -1
- package/ios/native/NativeProxy.h +2 -2
- package/ios/native/NativeProxy.mm +20 -17
- package/ios/native/REAIOSErrorHandler.h +2 -4
- package/ios/native/REAIOSErrorHandler.mm +1 -1
- package/ios/native/REAIOSLogger.h +1 -3
- package/ios/native/REAIOSLogger.mm +1 -1
- package/ios/native/REAIOSScheduler.h +1 -3
- package/ios/native/REAIOSScheduler.mm +2 -2
- package/ios/native/REAInitializer.h +0 -7
- package/ios/native/REAInitializer.mm +13 -3
- package/ios/native/UIResponder+Reanimated.mm +3 -3
- package/ios/sensor/ReanimatedSensor.h +1 -1
- package/ios/sensor/ReanimatedSensor.m +3 -3
- package/ios/sensor/ReanimatedSensorContainer.h +1 -1
- package/ios/sensor/ReanimatedSensorContainer.m +2 -2
- package/lib/Animated.js +8 -30
- package/lib/ConfigHelper.js +0 -1
- package/lib/index.js +5 -30
- package/lib/reanimated2/Easing.js +9 -3
- package/lib/reanimated2/NativeReanimated/NativeReanimated.js +1 -1
- package/lib/reanimated2/animation/sequence.js +0 -3
- package/lib/reanimated2/component/FlatList.js +3 -3
- package/lib/reanimated2/component/Image.js +4 -0
- package/lib/reanimated2/component/ScrollView.js +4 -0
- package/lib/reanimated2/component/Text.js +4 -0
- package/lib/reanimated2/component/View.js +4 -0
- package/lib/reanimated2/core.js +0 -41
- package/lib/reanimated2/globals.d.ts +1 -2
- package/lib/reanimated2/hook/utils.js +0 -5
- package/lib/reanimated2/js-reanimated/global.js +25 -0
- package/lib/reanimated2/js-reanimated/index.js +0 -24
- package/lib/reanimated2/mock.js +6 -0
- package/lib/types/lib/Animated.d.ts +8 -0
- package/lib/types/lib/index.d.ts +4 -0
- package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -1
- package/lib/types/lib/reanimated2/component/Image.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/ScrollView.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/Text.d.ts +3 -0
- package/lib/types/lib/reanimated2/component/View.d.ts +3 -0
- package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +1 -3
- package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +1 -0
- package/lib/types/lib/reanimated2/mock.d.ts +6 -0
- package/package.json +18 -14
- package/plugin.js +36 -33
- package/react-native-reanimated.d.ts +16 -7
- package/src/Animated.ts +13 -0
- package/src/ConfigHelper.ts +0 -1
- package/src/index.ts +7 -0
- package/src/reanimated2/Easing.ts +9 -3
- package/src/reanimated2/NativeReanimated/NativeReanimated.ts +1 -1
- package/src/reanimated2/animation/sequence.ts +0 -5
- package/src/reanimated2/commonTypes.ts +0 -1
- package/src/reanimated2/component/FlatList.tsx +3 -6
- package/src/reanimated2/component/Image.ts +6 -0
- package/src/reanimated2/component/ScrollView.ts +6 -0
- package/src/reanimated2/component/Text.ts +6 -0
- package/src/reanimated2/component/View.ts +6 -0
- package/src/reanimated2/core.ts +0 -52
- package/src/reanimated2/globals.d.ts +1 -2
- package/src/reanimated2/hook/useAnimatedSensor.ts +1 -3
- package/src/reanimated2/hook/utils.ts +0 -6
- package/src/reanimated2/js-reanimated/global.ts +33 -0
- package/src/reanimated2/js-reanimated/index.ts +0 -31
- package/src/reanimated2/mock.ts +6 -0
- package/android/react-native-reanimated-64-hermes.aar +0 -0
- package/android/react-native-reanimated-64-jsc.aar +0 -0
- package/lib/reanimated2/component/WrappedComponents.js +0 -9
- package/lib/reanimated2/component/index.js +0 -4
- package/lib/types/lib/reanimated2/component/WrappedComponents.d.ts +0 -8
- package/lib/types/lib/reanimated2/component/index.d.ts +0 -9
- package/src/Animated.js +0 -31
- package/src/reanimated2/component/WrappedComponents.ts +0 -11
- package/src/reanimated2/component/index.ts +0 -9
|
@@ -64,7 +64,7 @@ void ShareableValue::adapt(
|
|
|
64
64
|
jsi::Object hiddenProperty = hiddenValue.asObject(rt);
|
|
65
65
|
if (hiddenProperty.isHostObject<FrozenObject>(rt)) {
|
|
66
66
|
type = ValueType::FrozenObjectType;
|
|
67
|
-
if (object.hasProperty(rt, "
|
|
67
|
+
if (object.hasProperty(rt, "__workletHash") && object.isFunction(rt)) {
|
|
68
68
|
type = ValueType::WorkletFunctionType;
|
|
69
69
|
}
|
|
70
70
|
valueContainer = std::make_unique<FrozenObjectWrapper>(
|
|
@@ -99,7 +99,7 @@ void ShareableValue::adapt(
|
|
|
99
99
|
} else if (value.isObject()) {
|
|
100
100
|
auto object = value.asObject(rt);
|
|
101
101
|
if (object.isFunction(rt)) {
|
|
102
|
-
if (object.getProperty(rt, "
|
|
102
|
+
if (object.getProperty(rt, "__workletHash").isUndefined()) {
|
|
103
103
|
// not a worklet, we treat this as a host function
|
|
104
104
|
type = ValueType::HostFunctionType;
|
|
105
105
|
containsHostFunction = true;
|
|
@@ -31,20 +31,6 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
31
31
|
rt, "_LABEL", jsi::String::createFromAscii(rt, label));
|
|
32
32
|
|
|
33
33
|
jsi::Object dummyGlobal(rt);
|
|
34
|
-
auto dummyFunction = [](jsi::Runtime &rt,
|
|
35
|
-
const jsi::Value &thisValue,
|
|
36
|
-
const jsi::Value *args,
|
|
37
|
-
size_t count) -> jsi::Value {
|
|
38
|
-
return jsi::Value::undefined();
|
|
39
|
-
};
|
|
40
|
-
jsi::Function __reanimatedWorkletInit = jsi::Function::createFromHostFunction(
|
|
41
|
-
rt,
|
|
42
|
-
jsi::PropNameID::forAscii(rt, "__reanimatedWorkletInit"),
|
|
43
|
-
1,
|
|
44
|
-
dummyFunction);
|
|
45
|
-
|
|
46
|
-
dummyGlobal.setProperty(
|
|
47
|
-
rt, "__reanimatedWorkletInit", __reanimatedWorkletInit);
|
|
48
34
|
rt.global().setProperty(rt, "global", dummyGlobal);
|
|
49
35
|
|
|
50
36
|
rt.global().setProperty(rt, "jsThis", jsi::Value::undefined());
|
|
@@ -85,21 +71,27 @@ void RuntimeDecorator::decorateRuntime(
|
|
|
85
71
|
1,
|
|
86
72
|
setGlobalConsole));
|
|
87
73
|
|
|
74
|
+
auto chronoNow = [](jsi::Runtime &rt,
|
|
75
|
+
const jsi::Value &thisValue,
|
|
76
|
+
const jsi::Value *args,
|
|
77
|
+
size_t count) -> jsi::Value {
|
|
78
|
+
double now = std::chrono::system_clock::now().time_since_epoch() /
|
|
79
|
+
std::chrono::milliseconds(1);
|
|
80
|
+
return jsi::Value(now);
|
|
81
|
+
};
|
|
82
|
+
|
|
88
83
|
rt.global().setProperty(
|
|
89
84
|
rt,
|
|
90
85
|
"_chronoNow",
|
|
91
86
|
jsi::Function::createFromHostFunction(
|
|
92
|
-
rt,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
std::chrono::milliseconds(1);
|
|
101
|
-
return jsi::Value(now);
|
|
102
|
-
}));
|
|
87
|
+
rt, jsi::PropNameID::forAscii(rt, "_chronoNow"), 0, chronoNow));
|
|
88
|
+
jsi::Object performance(rt);
|
|
89
|
+
performance.setProperty(
|
|
90
|
+
rt,
|
|
91
|
+
"now",
|
|
92
|
+
jsi::Function::createFromHostFunction(
|
|
93
|
+
rt, jsi::PropNameID::forAscii(rt, "now"), 0, chronoNow));
|
|
94
|
+
rt.global().setProperty(rt, "performance", performance);
|
|
103
95
|
}
|
|
104
96
|
|
|
105
97
|
void RuntimeDecorator::decorateUIRuntime(
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Thu Jun 30 13:53:38 UTC 2022
|
|
2
2
|
gradle.version=7.2
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/android/CMakeLists.txt
CHANGED
|
@@ -119,12 +119,23 @@ find_library(
|
|
|
119
119
|
PATHS ${LIBRN_DIR}
|
|
120
120
|
NO_CMAKE_FIND_ROOT_PATH
|
|
121
121
|
)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
|
|
123
|
+
if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
|
|
124
|
+
find_library(
|
|
125
|
+
FOLLY_LIB
|
|
126
|
+
folly_json
|
|
127
|
+
PATHS ${LIBRN_DIR}
|
|
128
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
129
|
+
)
|
|
130
|
+
else()
|
|
131
|
+
find_library(
|
|
132
|
+
FOLLY_LIB
|
|
133
|
+
folly_runtime
|
|
134
|
+
PATHS ${LIBRN_DIR}
|
|
135
|
+
NO_CMAKE_FIND_ROOT_PATH
|
|
136
|
+
)
|
|
137
|
+
endif()
|
|
138
|
+
|
|
128
139
|
find_library(
|
|
129
140
|
REACT_NATIVE_JNI_LIB
|
|
130
141
|
reactnativejni
|
|
@@ -169,7 +180,7 @@ if(${FOR_HERMES})
|
|
|
169
180
|
${HERMES_LIB}
|
|
170
181
|
${GLOG_LIB}
|
|
171
182
|
${FBJNI_LIB}
|
|
172
|
-
${
|
|
183
|
+
${FOLLY_LIB}
|
|
173
184
|
${REACT_NATIVE_JNI_LIB}
|
|
174
185
|
android
|
|
175
186
|
)
|
|
@@ -181,7 +192,7 @@ else()
|
|
|
181
192
|
${JSEXECUTOR_LIB}
|
|
182
193
|
${GLOG_LIB}
|
|
183
194
|
${FBJNI_LIB}
|
|
184
|
-
${
|
|
195
|
+
${FOLLY_LIB}
|
|
185
196
|
${REACT_NATIVE_JNI_LIB}
|
|
186
197
|
android
|
|
187
198
|
)
|
package/android/build.gradle
CHANGED
|
@@ -149,10 +149,10 @@ def detectAAR(minor, engine) {
|
|
|
149
149
|
println "\n\n\n"
|
|
150
150
|
println "****************************************************************************************"
|
|
151
151
|
println "\n\n\n"
|
|
152
|
-
println "WARNING reanimated - no version-specific reanimated AAR for react-native version $
|
|
152
|
+
println "WARNING reanimated - no version-specific reanimated AAR for react-native version $minor found."
|
|
153
153
|
println "Falling back to AAR for react-native version $rnMinorVersionCopy."
|
|
154
154
|
println "The react-native JSI interface is not ABI-safe yet, this may result in crashes."
|
|
155
|
-
println "Please post a pull request to implement support for react-native version $
|
|
155
|
+
println "Please post a pull request to implement support for react-native version $minor to the reanimated repo."
|
|
156
156
|
println "Thanks!"
|
|
157
157
|
println "\n\n\n"
|
|
158
158
|
println "****************************************************************************************"
|
|
@@ -351,8 +351,8 @@ buildscript {
|
|
|
351
351
|
}
|
|
352
352
|
}
|
|
353
353
|
dependencies {
|
|
354
|
-
classpath "com.android.tools.build:gradle:
|
|
355
|
-
classpath "de.undercouch:gradle-download-task:
|
|
354
|
+
classpath "com.android.tools.build:gradle:7.1.1"
|
|
355
|
+
classpath "de.undercouch:gradle-download-task:5.0.1"
|
|
356
356
|
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.15.0"
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -381,8 +381,7 @@ android {
|
|
|
381
381
|
"-DBOOST_VERSION=${BOOST_VERSION}",
|
|
382
382
|
"-DBUILD_DIR=${buildDir}",
|
|
383
383
|
"-DFOR_HERMES=${FOR_HERMES}",
|
|
384
|
-
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}"
|
|
385
|
-
"--clean-first"
|
|
384
|
+
"-DCLIENT_SIDE_BUILD=${CLIENT_SIDE_BUILD}"
|
|
386
385
|
abiFilters (*reactNativeArchitectures())
|
|
387
386
|
_stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
|
|
388
387
|
}
|
|
@@ -459,7 +458,12 @@ task createNativeDepsDirectories(dependsOn: applyJavaPatches) {
|
|
|
459
458
|
}
|
|
460
459
|
|
|
461
460
|
task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
|
|
462
|
-
|
|
461
|
+
def transformedVersion = BOOST_VERSION.replace("_", ".")
|
|
462
|
+
def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
|
|
463
|
+
if (rnMinorVersion < 69) {
|
|
464
|
+
srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
|
|
465
|
+
}
|
|
466
|
+
src(srcUrl)
|
|
463
467
|
onlyIfNewer(true)
|
|
464
468
|
overwrite(false)
|
|
465
469
|
dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
|
|
@@ -672,7 +676,17 @@ dependencies {
|
|
|
672
676
|
extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
|
|
673
677
|
extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)
|
|
674
678
|
|
|
675
|
-
def
|
|
679
|
+
def buildType = "debug"
|
|
680
|
+
tasks.all({ task ->
|
|
681
|
+
if (task.name == "buildCMakeRelease") {
|
|
682
|
+
buildType = "release"
|
|
683
|
+
}
|
|
684
|
+
})
|
|
685
|
+
def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
|
|
686
|
+
if (rnMinorVersion < 69) {
|
|
687
|
+
rnAarMatcher = "**/**/*.aar"
|
|
688
|
+
}
|
|
689
|
+
def rnAAR = fileTree("$reactNative/android").matching({ it.include rnAarMatcher }).singleFile
|
|
676
690
|
def jscAAR = fileTree("$reactNative/../jsc-android/dist/org/webkit/android-jsc").matching({ it.include "**/**/*.aar" }).singleFile
|
|
677
691
|
extractSO(files(rnAAR, jscAAR))
|
|
678
692
|
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -37,6 +37,13 @@ NativeProxy::NativeProxy(
|
|
|
37
37
|
scheduler_(scheduler),
|
|
38
38
|
layoutAnimations(std::move(_layoutAnimations)) {}
|
|
39
39
|
|
|
40
|
+
NativeProxy::~NativeProxy() {
|
|
41
|
+
runtime_->global().setProperty(
|
|
42
|
+
*runtime_,
|
|
43
|
+
jsi::PropNameID::forAscii(*runtime_, "__reanimatedModuleProxy"),
|
|
44
|
+
jsi::Value::undefined());
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
jni::local_ref<NativeProxy::jhybriddata> NativeProxy::initHybrid(
|
|
41
48
|
jni::alias_ref<jhybridobject> jThis,
|
|
42
49
|
jlong jsContext,
|
|
@@ -138,11 +145,22 @@ void NativeProxy::installJSIBindings() {
|
|
|
138
145
|
std::shared_ptr<jsi::Runtime> animatedRuntime =
|
|
139
146
|
facebook::jsc::makeJSCRuntime();
|
|
140
147
|
#endif
|
|
148
|
+
auto workletRuntimeValue = runtime_->global()
|
|
149
|
+
.getProperty(*runtime_, "ArrayBuffer")
|
|
150
|
+
.asObject(*runtime_)
|
|
151
|
+
.asFunction(*runtime_)
|
|
152
|
+
.callAsConstructor(*runtime_, {static_cast<double>(sizeof(void*))});
|
|
153
|
+
uintptr_t* workletRuntimeData = reinterpret_cast<uintptr_t*>(
|
|
154
|
+
workletRuntimeValue
|
|
155
|
+
.getObject(*runtime_)
|
|
156
|
+
.getArrayBuffer(*runtime_)
|
|
157
|
+
.data(*runtime_));
|
|
158
|
+
workletRuntimeData[0] = reinterpret_cast<uintptr_t>(animatedRuntime.get());
|
|
159
|
+
|
|
141
160
|
runtime_->global().setProperty(
|
|
142
161
|
*runtime_,
|
|
143
162
|
"_WORKLET_RUNTIME",
|
|
144
|
-
|
|
145
|
-
reinterpret_cast<std::uintptr_t>(animatedRuntime.get())));
|
|
163
|
+
workletRuntimeValue);
|
|
146
164
|
|
|
147
165
|
std::shared_ptr<ErrorHandler> errorHandler =
|
|
148
166
|
std::make_shared<AndroidErrorHandler>(scheduler_);
|
|
@@ -192,18 +210,21 @@ void NativeProxy::installJSIBindings() {
|
|
|
192
210
|
platformDepMethodsHolder);
|
|
193
211
|
|
|
194
212
|
_nativeReanimatedModule = module;
|
|
195
|
-
|
|
196
|
-
this->registerEventHandler(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
213
|
+
std::weak_ptr<NativeReanimatedModule> weakModule = module;
|
|
214
|
+
this->registerEventHandler(
|
|
215
|
+
[weakModule, getCurrentTime](
|
|
216
|
+
std::string eventName, std::string eventAsString) {
|
|
217
|
+
if (auto module = weakModule.lock()) {
|
|
218
|
+
jsi::Object global = module->runtime->global();
|
|
219
|
+
jsi::String eventTimestampName =
|
|
220
|
+
jsi::String::createFromAscii(*module->runtime, "_eventTimestamp");
|
|
221
|
+
global.setProperty(
|
|
222
|
+
*module->runtime, eventTimestampName, getCurrentTime());
|
|
223
|
+
module->onEvent(eventName, eventAsString);
|
|
224
|
+
global.setProperty(
|
|
225
|
+
*module->runtime, eventTimestampName, jsi::Value::undefined());
|
|
226
|
+
}
|
|
227
|
+
});
|
|
207
228
|
|
|
208
229
|
runtime_->global().setProperty(
|
|
209
230
|
*runtime_,
|
|
@@ -131,6 +131,8 @@ class NativeProxy : public jni::HybridClass<NativeProxy> {
|
|
|
131
131
|
jni::alias_ref<LayoutAnimations::javaobject> layoutAnimations);
|
|
132
132
|
static void registerNatives();
|
|
133
133
|
|
|
134
|
+
~NativeProxy();
|
|
135
|
+
|
|
134
136
|
private:
|
|
135
137
|
friend HybridBase;
|
|
136
138
|
jni::global_ref<NativeProxy::javaobject> javaPart_;
|
|
@@ -147,14 +147,17 @@ public class NativeProxy {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
private void addDevMenuOption() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
// In Expo, `ApplicationContext` is not an instance of `ReactApplication`
|
|
151
|
+
if (mContext.get().getApplicationContext() instanceof ReactApplication) {
|
|
152
|
+
final DevSupportManager devSupportManager =
|
|
153
|
+
((ReactApplication) mContext.get().getApplicationContext())
|
|
154
|
+
.getReactNativeHost()
|
|
155
|
+
.getReactInstanceManager()
|
|
156
|
+
.getDevSupportManager();
|
|
157
|
+
|
|
158
|
+
devSupportManager.addCustomDevOption(
|
|
159
|
+
"Toggle slow animations (Reanimated)", this::toggleSlowAnimations);
|
|
160
|
+
}
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
@DoNotStrip
|
package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
package com.swmansion.reanimated.layoutReanimation;
|
|
2
2
|
|
|
3
|
+
import android.app.Activity;
|
|
3
4
|
import android.util.DisplayMetrics;
|
|
4
5
|
import android.util.Log;
|
|
5
6
|
import android.view.View;
|
|
@@ -368,12 +369,18 @@ public class AnimationsManager implements ViewHierarchyObserver {
|
|
|
368
369
|
preparedValues.put(key, PixelUtil.toDIPFromPixel((int) values.get(key)));
|
|
369
370
|
}
|
|
370
371
|
|
|
371
|
-
DisplayMetrics
|
|
372
|
-
mContext.getCurrentActivity()
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
373
|
+
Activity currentActivity = mContext.getCurrentActivity();
|
|
374
|
+
if (currentActivity != null) {
|
|
375
|
+
currentActivity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
|
376
|
+
int height = displayMetrics.heightPixels;
|
|
377
|
+
int width = displayMetrics.widthPixels;
|
|
378
|
+
preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(width));
|
|
379
|
+
preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(height));
|
|
380
|
+
} else {
|
|
381
|
+
preparedValues.put("windowWidth", PixelUtil.toDIPFromPixel(0));
|
|
382
|
+
preparedValues.put("windowHeight", PixelUtil.toDIPFromPixel(0));
|
|
383
|
+
}
|
|
377
384
|
return preparedValues;
|
|
378
385
|
}
|
|
379
386
|
|
|
@@ -3,6 +3,7 @@ package com.swmansion.reanimated.sensor;
|
|
|
3
3
|
import android.hardware.Sensor;
|
|
4
4
|
import android.hardware.SensorEvent;
|
|
5
5
|
import android.hardware.SensorEventListener;
|
|
6
|
+
import android.hardware.SensorManager;
|
|
6
7
|
import com.swmansion.reanimated.NativeProxy;
|
|
7
8
|
|
|
8
9
|
public class ReanimatedSensorListener implements SensorEventListener {
|
|
@@ -11,6 +12,10 @@ public class ReanimatedSensorListener implements SensorEventListener {
|
|
|
11
12
|
private double lastRead = (double) System.currentTimeMillis();
|
|
12
13
|
private final double interval;
|
|
13
14
|
|
|
15
|
+
private float[] rotation = new float[9];
|
|
16
|
+
private float[] orientation = new float[3];
|
|
17
|
+
private float[] quaternion = new float[4];
|
|
18
|
+
|
|
14
19
|
ReanimatedSensorListener(NativeProxy.SensorSetter setter, double interval) {
|
|
15
20
|
this.setter = setter;
|
|
16
21
|
this.interval = interval;
|
|
@@ -22,8 +27,26 @@ public class ReanimatedSensorListener implements SensorEventListener {
|
|
|
22
27
|
if (current - lastRead < interval) {
|
|
23
28
|
return;
|
|
24
29
|
}
|
|
30
|
+
int sensorType = event.sensor.getType();
|
|
25
31
|
lastRead = current;
|
|
26
|
-
|
|
32
|
+
if (sensorType == Sensor.TYPE_ROTATION_VECTOR) {
|
|
33
|
+
SensorManager.getQuaternionFromVector(quaternion, event.values);
|
|
34
|
+
SensorManager.getRotationMatrixFromVector(rotation, event.values);
|
|
35
|
+
SensorManager.getOrientation(rotation, orientation);
|
|
36
|
+
float[] data =
|
|
37
|
+
new float[] {
|
|
38
|
+
quaternion[1], // qx
|
|
39
|
+
quaternion[2], // qy
|
|
40
|
+
quaternion[3], // qz
|
|
41
|
+
quaternion[0], // qw
|
|
42
|
+
orientation[0], // yaw
|
|
43
|
+
orientation[1], // pitch
|
|
44
|
+
orientation[2] // roll
|
|
45
|
+
};
|
|
46
|
+
setter.sensorSetter(data);
|
|
47
|
+
} else {
|
|
48
|
+
setter.sensorSetter(event.values);
|
|
49
|
+
}
|
|
27
50
|
}
|
|
28
51
|
|
|
29
52
|
@Override
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
package com.swmansion.reanimated.sensor;
|
|
2
2
|
|
|
3
|
+
import android.hardware.Sensor;
|
|
4
|
+
|
|
3
5
|
public enum ReanimatedSensorType {
|
|
4
|
-
ACCELEROMETER(
|
|
5
|
-
GYROSCOPE(
|
|
6
|
-
GRAVITY(
|
|
7
|
-
MAGNETIC_FIELD(
|
|
8
|
-
ROTATION_VECTOR(
|
|
6
|
+
ACCELEROMETER(Sensor.TYPE_ACCELEROMETER),
|
|
7
|
+
GYROSCOPE(Sensor.TYPE_GYROSCOPE),
|
|
8
|
+
GRAVITY(Sensor.TYPE_GRAVITY),
|
|
9
|
+
MAGNETIC_FIELD(Sensor.TYPE_MAGNETIC_FIELD),
|
|
10
|
+
ROTATION_VECTOR(Sensor.TYPE_ROTATION_VECTOR);
|
|
9
11
|
|
|
10
12
|
private final int type;
|
|
11
13
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#import
|
|
1
|
+
#import <RNReanimated/REAAnimationsManager.h>
|
|
2
|
+
#import <RNReanimated/REAUIManager.h>
|
|
2
3
|
#import <React/RCTComponentData.h>
|
|
3
4
|
#import <React/RCTTextView.h>
|
|
4
5
|
#import <React/UIView+Private.h>
|
|
5
6
|
#import <React/UIView+React.h>
|
|
6
|
-
#import "REAUIManager.h"
|
|
7
7
|
|
|
8
8
|
@interface REAAnimationsManager ()
|
|
9
9
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
#import "REAUIManager.h"
|
|
2
1
|
#import <Foundation/Foundation.h>
|
|
3
|
-
#
|
|
4
|
-
#import
|
|
5
|
-
#
|
|
6
|
-
|
|
2
|
+
#import <RNReanimated/FeaturesConfig.h>
|
|
3
|
+
#import <RNReanimated/REAIOSScheduler.h>
|
|
4
|
+
#import <RNReanimated/REAUIManager.h>
|
|
5
|
+
#import <RNReanimated/Scheduler.h>
|
|
7
6
|
#import <React/RCTComponentData.h>
|
|
8
7
|
#import <React/RCTLayoutAnimation.h>
|
|
9
8
|
#import <React/RCTLayoutAnimationGroup.h>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#import
|
|
1
|
+
#import <RNReanimated/REAAlwaysNode.h>
|
|
2
|
+
#import <RNReanimated/REAModule.h>
|
|
3
|
+
#import <RNReanimated/REANodesManager.h>
|
|
4
|
+
#import <RNReanimated/REAStyleNode.h>
|
|
5
|
+
#import <RNReanimated/REAUtils.h>
|
|
2
6
|
#import <React/RCTConvert.h>
|
|
3
7
|
#import <React/RCTLog.h>
|
|
4
8
|
#import <React/RCTUIManager.h>
|
|
5
|
-
#import "REAModule.h"
|
|
6
|
-
#import "REANodesManager.h"
|
|
7
|
-
#import "REAStyleNode.h"
|
|
8
|
-
#import "REAUtils.h"
|
|
9
9
|
|
|
10
10
|
@implementation REAAlwaysNode {
|
|
11
11
|
NSNumber *_nodeToBeEvaluated;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
#import <RNReanimated/REABezierNode.h>
|
|
2
|
+
#import <RNReanimated/REANodesManager.h>
|
|
3
|
+
#import <RNReanimated/REAUtils.h>
|
|
3
4
|
#import <React/RCTConvert.h>
|
|
4
5
|
#import <React/RCTLog.h>
|
|
5
|
-
#
|
|
6
|
-
#import "REANodesManager.h"
|
|
7
|
-
#import "REAUtils.h"
|
|
6
|
+
#include <tgmath.h>
|
|
8
7
|
|
|
9
8
|
#define EPS 1e-5
|
|
10
9
|
|
package/ios/Nodes/REABlockNode.h
CHANGED
package/ios/Nodes/REABlockNode.m
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
#import
|
|
4
|
-
#import
|
|
5
|
-
#import
|
|
6
|
-
#import
|
|
7
|
-
#import
|
|
3
|
+
#import <RNReanimated/REACallFuncNode.h>
|
|
4
|
+
#import <RNReanimated/REAFunctionNode.h>
|
|
5
|
+
#import <RNReanimated/REANodesManager.h>
|
|
6
|
+
#import <RNReanimated/REAParamNode.h>
|
|
7
|
+
#import <RNReanimated/REAUtils.h>
|
|
8
8
|
|
|
9
9
|
@implementation REACallFuncNode {
|
|
10
10
|
NSNumber *_whatNodeID;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#import
|
|
1
|
+
#import <RNReanimated/REAClockNodes.h>
|
|
2
|
+
#import <RNReanimated/REANodesManager.h>
|
|
3
|
+
#import <RNReanimated/REAParamNode.h>
|
|
4
|
+
#import <RNReanimated/REAUtils.h>
|
|
2
5
|
#import <React/RCTConvert.h>
|
|
3
6
|
#import <React/RCTLog.h>
|
|
4
|
-
#import "REANodesManager.h"
|
|
5
|
-
#import "REAParamNode.h"
|
|
6
|
-
#import "REAUtils.h"
|
|
7
7
|
|
|
8
8
|
@interface REAClockNode ()
|
|
9
9
|
|