react-native-reanimated 4.2.1 → 4.2.3
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/AnimatedSensor/AnimatedSensorModule.cpp +0 -4
- package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +0 -1
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +3 -1
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +12 -0
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +1 -0
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +463 -416
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +3 -1
- package/android/src/main/cpp/reanimated/android/NativeProxy.cpp +7 -2
- package/android/src/main/cpp/reanimated/android/NativeProxy.h +2 -1
- package/android/src/main/java/com/swmansion/reanimated/DrawPassDetector.java +82 -0
- package/android/src/main/java/com/swmansion/reanimated/NativeProxy.java +4 -2
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +32 -4
- package/apple/reanimated/apple/native/NativeProxy.mm +1 -1
- package/compatibility.json +3 -3
- package/lib/module/common/style/processors/colors.js +1 -1
- package/lib/module/common/style/processors/colors.js.map +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js +10 -6
- package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
- package/lib/module/hook/useComposedEventHandler.js +1 -1
- package/lib/module/hook/useComposedEventHandler.js.map +1 -1
- package/lib/module/hook/useHandler.js +3 -8
- package/lib/module/hook/useHandler.js.map +1 -1
- package/lib/module/hook/utils.js +27 -6
- package/lib/module/hook/utils.js.map +1 -1
- package/lib/module/jestUtils/common.js +18 -0
- package/lib/module/jestUtils/common.js.map +1 -0
- package/lib/module/{jestUtils.js → jestUtils/index.js} +6 -3
- package/lib/module/jestUtils/index.js.map +1 -0
- package/lib/module/{jestUtils.web.js → jestUtils/index.web.js} +2 -1
- package/lib/module/jestUtils/index.web.js.map +1 -0
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/hook/utils.d.ts +1 -1
- package/lib/typescript/hook/utils.d.ts.map +1 -1
- package/lib/typescript/jestUtils/common.d.ts +12 -0
- package/lib/typescript/jestUtils/common.d.ts.map +1 -0
- package/lib/typescript/{jestUtils.d.ts → jestUtils/index.d.ts} +4 -2
- package/lib/typescript/jestUtils/index.d.ts.map +1 -0
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +21 -15
- package/scripts/worklets-version.json +1 -4
- package/src/common/style/processors/colors.ts +1 -1
- package/src/createAnimatedComponent/AnimatedComponent.tsx +12 -10
- package/src/hook/useComposedEventHandler.ts +1 -1
- package/src/hook/useHandler.ts +4 -14
- package/src/hook/utils.ts +38 -8
- package/src/jestUtils/common.ts +24 -0
- package/src/{jestUtils.ts → jestUtils/index.ts} +8 -4
- package/src/{jestUtils.web.ts → jestUtils/index.web.ts} +2 -0
- package/src/platform-specific/jsVersion.ts +1 -1
- package/lib/module/jestUtils.js.map +0 -1
- package/lib/module/jestUtils.web.js.map +0 -1
- package/lib/typescript/jestUtils.d.ts.map +0 -1
|
@@ -10,10 +10,6 @@ AnimatedSensorModule::AnimatedSensorModule(const PlatformDepMethodsHolder &platf
|
|
|
10
10
|
: platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor),
|
|
11
11
|
platformUnregisterSensorFunction_(platformDepMethodsHolder.unregisterSensor) {}
|
|
12
12
|
|
|
13
|
-
AnimatedSensorModule::~AnimatedSensorModule() {
|
|
14
|
-
react_native_assert(sensorsIds_.empty() && "Tried to deallocate AnimatedSensorModule with registered sensors");
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
jsi::Value AnimatedSensorModule::registerSensor(
|
|
18
14
|
jsi::Runtime &rt,
|
|
19
15
|
const std::shared_ptr<WorkletRuntime> &uiWorkletRuntime,
|
|
@@ -33,13 +33,15 @@ void AnimatedPropsRegistry::update(jsi::Runtime &rt, const jsi::Value &operation
|
|
|
33
33
|
|
|
34
34
|
void AnimatedPropsRegistry::remove(const Tag tag) {
|
|
35
35
|
updatesRegistry_.erase(tag);
|
|
36
|
+
timestampMap_.erase(tag);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
jsi::Value AnimatedPropsRegistry::getUpdatesOlderThanTimestamp(jsi::Runtime &rt, const double timestamp) {
|
|
39
40
|
std::vector<std::pair<Tag, std::reference_wrapper<const folly::dynamic>>> updates;
|
|
40
41
|
|
|
41
42
|
for (const auto &[viewTag, pair] : updatesRegistry_) {
|
|
42
|
-
|
|
43
|
+
auto it = timestampMap_.find(viewTag);
|
|
44
|
+
if (it != timestampMap_.end() && it->second < timestamp) {
|
|
43
45
|
updates.emplace_back(viewTag, std::cref(pair.second));
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -38,6 +38,18 @@ void UpdatesRegistry::flushUpdates(UpdatesBatch &updatesBatch) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
UpdatesBatch UpdatesRegistry::getPendingUpdates() {
|
|
42
|
+
auto lock = std::lock_guard<std::mutex>{mutex_};
|
|
43
|
+
flushUpdatesToRegistry(updatesBatch_);
|
|
44
|
+
|
|
45
|
+
UpdatesBatch updatesBatch;
|
|
46
|
+
for (const auto &[tag, pair] : updatesRegistry_) {
|
|
47
|
+
const auto &[shadowNode, props] = pair;
|
|
48
|
+
updatesBatch.emplace_back(shadowNode, props);
|
|
49
|
+
}
|
|
50
|
+
return updatesBatch;
|
|
51
|
+
}
|
|
52
|
+
|
|
41
53
|
void UpdatesRegistry::collectProps(PropsMap &propsMap) {
|
|
42
54
|
std::lock_guard<std::mutex> lock{mutex_};
|
|
43
55
|
|