react-native-reanimated 3.16.5 → 3.16.6

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.
@@ -27,23 +27,31 @@ ReanimatedCommitHook::~ReanimatedCommitHook() noexcept {
27
27
  uiManager_->unregisterCommitHook(*this);
28
28
  }
29
29
 
30
+ void ReanimatedCommitHook::maybeInitializeLayoutAnimations(
31
+ SurfaceId surfaceId) {
32
+ auto lock = std::unique_lock<std::mutex>(mutex_);
33
+ if (surfaceId > currentMaxSurfaceId_) {
34
+ // when a new surfaceId is observed we call setMountingOverrideDelegate
35
+ // for all yet unseen surfaces
36
+ uiManager_->getShadowTreeRegistry().enumerate(
37
+ [this](const ShadowTree &shadowTree, bool &stop) {
38
+ if (shadowTree.getSurfaceId() <= currentMaxSurfaceId_) {
39
+ // the set function actually adds our delegate to a list, so we
40
+ // shouldn't invoke it twice for the same surface
41
+ return;
42
+ }
43
+ shadowTree.getMountingCoordinator()->setMountingOverrideDelegate(
44
+ layoutAnimationsProxy_);
45
+ });
46
+ currentMaxSurfaceId_ = surfaceId;
47
+ }
48
+ }
49
+
30
50
  RootShadowNode::Unshared ReanimatedCommitHook::shadowTreeWillCommit(
31
51
  ShadowTree const &,
32
52
  RootShadowNode::Shared const &,
33
53
  RootShadowNode::Unshared const &newRootShadowNode) noexcept {
34
- auto surfaceId = newRootShadowNode->getSurfaceId();
35
-
36
- {
37
- auto lock = std::unique_lock<std::mutex>(mutex_);
38
- if (surfaceId > currentMaxSurfaceId_) {
39
- uiManager_->getShadowTreeRegistry().enumerate(
40
- [this](const ShadowTree &shadowTree, bool &stop) {
41
- shadowTree.getMountingCoordinator()->setMountingOverrideDelegate(
42
- layoutAnimationsProxy_);
43
- });
44
- currentMaxSurfaceId_ = surfaceId;
45
- }
46
- }
54
+ maybeInitializeLayoutAnimations(newRootShadowNode->getSurfaceId());
47
55
 
48
56
  auto reaShadowNode =
49
57
  std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
@@ -42,6 +42,8 @@ class ReanimatedCommitHook : public UIManagerCommitHook {
42
42
  const noexcept override;
43
43
  #endif
44
44
 
45
+ void maybeInitializeLayoutAnimations(SurfaceId surfaceId);
46
+
45
47
  private:
46
48
  std::shared_ptr<PropsRegistry> propsRegistry_;
47
49
 
@@ -5,5 +5,5 @@
5
5
  * version used to build the native part of the library in runtime. Remember to
6
6
  * keep this in sync with the version declared in `package.json`
7
7
  */
8
- export const jsVersion = '3.16.5';
8
+ export const jsVersion = '3.16.6';
9
9
  //# sourceMappingURL=jsVersion.js.map
@@ -3,5 +3,5 @@
3
3
  * version used to build the native part of the library in runtime. Remember to
4
4
  * keep this in sync with the version declared in `package.json`
5
5
  */
6
- export declare const jsVersion = "3.16.5";
6
+ export declare const jsVersion = "3.16.6";
7
7
  //# sourceMappingURL=jsVersion.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-reanimated",
3
- "version": "3.16.5",
3
+ "version": "3.16.6",
4
4
  "description": "More powerful alternative to Animated library for React Native.",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -4,4 +4,4 @@
4
4
  * version used to build the native part of the library in runtime. Remember to
5
5
  * keep this in sync with the version declared in `package.json`
6
6
  */
7
- export const jsVersion = '3.16.5';
7
+ export const jsVersion = '3.16.6';