react-native-smooth-clip-view 0.2.7 → 0.2.8

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.
@@ -87,6 +87,12 @@ static std::array<double, 7> SmoothClipVelocityChannels(
87
87
  BOOL _pendingAnimationInstall;
88
88
  CFTimeInterval _animationStartedAt;
89
89
  CFTimeInterval _animationDuration;
90
+ // Bumped on every CA install. updateLayoutMetrics captures it on entry so a
91
+ // registry-driven install that happens inside its own lifecycle notification
92
+ // (a latch resume during that very layout pass) is detectable: the local
93
+ // rebuild must then be skipped, because its captured remaining time predates
94
+ // the suspension and would shorten — or zero out — the fresh install.
95
+ uint32_t _animationInstallGeneration;
90
96
  smoothclip::TimingAnimation _timingAnimation;
91
97
  smoothclip::SpringAnimation _springAnimation;
92
98
  SmoothClipAnimationDelegate *_animationDelegate;
@@ -146,6 +152,7 @@ static std::array<double, 7> SmoothClipVelocityChannels(
146
152
  _activeAnimationId = 0;
147
153
  _activeAnimationKind = 0;
148
154
  _pendingAnimationInstall = NO;
155
+ _animationInstallGeneration = 0;
149
156
  smoothclip::clearVelocitySamples(_velocitySamples);
150
157
  // App-state transitions are observed by the registry itself (see
151
158
  // installApplicationStateObservers): the active flag is process-global,
@@ -624,6 +631,7 @@ static std::array<double, 7> SmoothClipVelocityChannels(
624
631
  [layer addAnimation:group forKey:@"smoothClip.geometry"];
625
632
  [_contentContainer.layer addAnimation:contentGroup
626
633
  forKey:@"smoothClip.content"];
634
+ _animationInstallGeneration += 1;
627
635
  }
628
636
 
629
637
  - (BOOL)startAnimationToRequestedGeometryWithDuration:(CFTimeInterval)duration {
@@ -780,6 +788,7 @@ static std::array<double, 7> SmoothClipVelocityChannels(
780
788
  [_clipContainer.layer addAnimation:group forKey:@"smoothClip.geometry"];
781
789
  [_contentContainer.layer addAnimation:contentGroup
782
790
  forKey:@"smoothClip.content"];
791
+ _animationInstallGeneration += 1;
783
792
  return YES;
784
793
  }
785
794
 
@@ -866,6 +875,7 @@ static std::array<double, 7> SmoothClipVelocityChannels(
866
875
  CGFloat visibleRadius = 0;
867
876
  const BOOL wasAnimating = _activeAnimationId != 0;
868
877
  const BOOL wasPending = _pendingAnimationInstall;
878
+ const uint32_t installGenerationAtEntry = _animationInstallGeneration;
869
879
  const smoothclip::Presentation visible = wasAnimating && !wasPending
870
880
  ? [self smoothClipCurrentPresentation]
871
881
  : smoothclip::Presentation{{0, 0, 0, 0, 0}, 0, 0};
@@ -906,6 +916,14 @@ static std::array<double, 7> SmoothClipVelocityChannels(
906
916
  // registry above. Its non-recording freeze is already the correct model
907
917
  // state for the new lifecycle; do not resurrect a local timer.
908
918
  if (_activeAnimationId == 0 || ![self smoothClipCanDisplay]) return;
919
+ // The lifecycle notification above may itself have installed this
920
+ // animation from the registry's trimmed remainder (a latch resume inside
921
+ // this very layout pass). That install rebased the clocks; the `remaining`
922
+ // captured on entry predates the suspension and would rebuild a shorter —
923
+ // possibly zero-duration — run on top of the fresh one. The id alone
924
+ // cannot detect this (a resume keeps the animation id), so compare the
925
+ // install generation.
926
+ if (_animationInstallGeneration != installGenerationAtEntry) return;
909
927
  const int32_t animationId = _activeAnimationId;
910
928
  const NSInteger animationKind = _activeAnimationKind;
911
929
  [self stopLayerAnimationWithoutCallback];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-smooth-clip-view",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "Layout-free animated rounded clipping for React Native Fabric",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",