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

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/README.md CHANGED
@@ -126,6 +126,20 @@ vsync clock with registry fanout; outline calculation and invalidation still
126
126
  run on its UI thread. Springs are physically integrated per geometry channel
127
127
  and finish when they settle below sub-pixel thresholds on both platforms.
128
128
  Retargeting starts from visible state.
129
+
130
+ Blocked-thread behavior: a blocked JS thread never stalls a running
131
+ transition on either platform — no JS runs on the frame path. A blocked
132
+ main thread stalls it on Android (the frame loop and the View property
133
+ writes are main-thread-only by platform design; the RenderThread only
134
+ replays what the main thread records) but not on iOS, where the render
135
+ server advances installed Core Animations out of process. The Android
136
+ behavior is not recoverable through public APIs — RenderThread-driven
137
+ property animation (`RenderNodeAnimator`, what ripples use) is hidden API —
138
+ and it is also the coherent choice for this library: parallel Reanimated
139
+ content runs on the main thread on both platforms, so on Android the clip
140
+ and its content stall and resume together, while on iOS a main-thread stall
141
+ lets the natively animated channels keep moving past any Reanimated-driven
142
+ ones.
129
143
  The same driver can be grabbed by a gesture without a visual jump:
130
144
 
131
145
  ```tsx
@@ -146,6 +160,9 @@ const gesture = Gesture.Pan()
146
160
  // geometry as `from` so the animation starts from exactly that value —
147
161
  // it fuses a setScalars hot write with the handoff in one call.
148
162
  const clip = geometryForDrag(dragStart.value, event.translationY);
163
+ // 'inherit' projects launch speed from the drag's last two samples. On
164
+ // Android that sampling is opt-in — create the driver with
165
+ // useSmoothClipDriver(initial, { velocityTracking: true }).
149
166
  driver.ui.animateTo(createClipPresentation(expandedClip), {
150
167
  type: 'spring',
151
168
  initialVelocity: 'inherit',
@@ -200,7 +217,16 @@ puts on screen, which is the property worth keeping identical.
200
217
  same normalized rate, so grab/release preserves the felt direction and
201
218
  speed. `'inherit'` (the default) estimates the scalar from the last two
202
219
  interactive samples on iOS and Android; the web fallback always inherits
203
- zero. How long the finger has been still since that last sample scales the
220
+ zero. On Android, sampling on the `setScalars` hot path is **opt-in**: pass
221
+ `velocityTracking: true` to `useSmoothClipDriver` or `'inherit'` inherits
222
+ zero after a hot-write drag (a dev-mode warning flags this). **Behavior
223
+ change:** earlier releases always recorded on Android, so an existing
224
+ `setScalars`-drag → inherit-spring handoff keeps its momentum only after
225
+ adding the flag. The recording
226
+ is a clock read plus channel copies on every per-frame write, so drivers
227
+ that never hand off into an inherit spring skip it by default. iOS always
228
+ records, and Android's declarative `presentation.value` channel always
229
+ records too. How long the finger has been still since that last sample scales the
204
230
  result: full credit for one frame (16.7 ms), then a linear decay to zero at
205
231
  100 ms. A release straight out of a drag is therefore untouched, and holding
206
232
  still before releasing bleeds the momentum off smoothly instead of keeping
@@ -40,3 +40,10 @@ target_link_libraries(
40
40
  fbjni::fbjni
41
41
  ReactAndroid::jsi
42
42
  ReactAndroid::reactnative)
43
+
44
+ # Debug-only hot-path ATrace slices; see SmoothClipTrace.h.
45
+ # Passed from the debug build type in build.gradle, never for release.
46
+ if(SMOOTH_CLIP_ENABLE_ATRACE)
47
+ target_compile_definitions(smoothclipview PRIVATE SMOOTH_CLIP_ENABLE_ATRACE=1)
48
+ target_link_libraries(smoothclipview android)
49
+ endif()
@@ -100,6 +100,14 @@ android {
100
100
  }
101
101
 
102
102
  buildTypes {
103
+ debug {
104
+ externalNativeBuild {
105
+ cmake {
106
+ // Hot-path ATrace slices; see SmoothClipTrace.h.
107
+ arguments "-DSMOOTH_CLIP_ENABLE_ATRACE=ON"
108
+ }
109
+ }
110
+ }
103
111
  release {
104
112
  minifyEnabled false
105
113
  }
@@ -166,17 +166,21 @@ void installBindings(
166
166
  Object bindings(runtime);
167
167
 
168
168
  setHostFunction(
169
- runtime, bindings, "setClipPresentation", 10,
169
+ runtime, bindings, "setClipPresentation", 11,
170
170
  [](Runtime &rt, const Value &, const Value *args, size_t count) -> Value {
171
171
  if (count < 9) return Value::undefined();
172
172
  const double driverId = args[0].asNumber();
173
173
  const Presentation presentation = presentationFromArgs(args, 1);
174
174
  const bool takeOwnership = boolArg(args, count, 8);
175
175
  const bool overridePendingAnimation = boolArg(args, count, 9);
176
+ // Optional trailing flag; absent means record (the pre-flag
177
+ // behavior), so only an explicit false skips the velocity sample.
178
+ const bool recordVelocity =
179
+ !(count > 10 && args[10].isBool() && !args[10].getBool());
176
180
  if (validDriverId(driverId) && finitePresentation(presentation)) {
177
181
  setPresentation(
178
182
  static_cast<uint64_t>(driverId), presentation, takeOwnership,
179
- overridePendingAnimation);
183
+ overridePendingAnimation, recordVelocity);
180
184
  }
181
185
  return Value::undefined();
182
186
  });
@@ -1,6 +1,7 @@
1
1
  #include "SmoothClipAndroid.h"
2
2
  #include "SmoothClipAnimationId.h"
3
3
  #include "SmoothClipAnimationCurve.h"
4
+ #include "SmoothClipTrace.h"
4
5
  #include "SmoothClipVelocityTracker.h"
5
6
 
6
7
  #include <fbjni/fbjni.h>
@@ -615,6 +616,7 @@ void advance(uint64_t driverId, DriverState &state, double now) {
615
616
  }
616
617
 
617
618
  void onFrameImpl(double now) {
619
+ SMOOTH_CLIP_TRACE("SmoothClip.frame");
618
620
  gFrameScheduled = false;
619
621
  // Snapshot: advance() clears live-list entries on completion. advance()
620
622
  // never erases registry entries and never starts animations (completion
@@ -675,8 +677,10 @@ void setPresentation(
675
677
  uint64_t driverId,
676
678
  Presentation presentation,
677
679
  bool takeOwnership,
678
- bool overridePendingAnimation) {
680
+ bool overridePendingAnimation,
681
+ bool recordVelocity) {
679
682
  if (!isOnMainThread()) return;
683
+ SMOOTH_CLIP_TRACE("SmoothClip.setPresentation");
680
684
  auto iterator = registry().find(driverId);
681
685
  if (!takeOwnership) {
682
686
  if (iterator == registry().end() || iterator->second.destroyed) {
@@ -703,7 +707,12 @@ void setPresentation(
703
707
  state.latest = presentation;
704
708
  state.hasLatest = true;
705
709
  state.ownership = Ownership::Interactive;
706
- recordVelocitySample(state.samples, toChannels(presentation), nowSeconds());
710
+ if (recordVelocity) {
711
+ recordVelocitySample(state.samples, toChannels(presentation), nowSeconds());
712
+ } else if (state.samples.hasLatest) {
713
+ // Untracked movement invalidates the recorded velocity pair.
714
+ clearVelocitySamples(state.samples);
715
+ }
707
716
  applyToViews(state, presentation);
708
717
  }
709
718
 
@@ -0,0 +1,25 @@
1
+ #pragma once
2
+
3
+ #if defined(SMOOTH_CLIP_ENABLE_ATRACE)
4
+
5
+ #include <android/trace.h>
6
+
7
+ namespace smoothclip::trace {
8
+
9
+ class ScopedSection {
10
+ public:
11
+ explicit ScopedSection(const char *name) { ATrace_beginSection(name); }
12
+
13
+ ~ScopedSection() { ATrace_endSection(); }
14
+ };
15
+
16
+ } // namespace smoothclip::trace
17
+
18
+ #define SMOOTH_CLIP_TRACE(name) \
19
+ ::smoothclip::trace::ScopedSection smoothClipTraceSection{name}
20
+
21
+ #else
22
+
23
+ #define SMOOTH_CLIP_TRACE(name)
24
+
25
+ #endif
@@ -2,6 +2,7 @@ package com.smoothclipview
2
2
 
3
3
  import android.content.res.Configuration
4
4
  import android.graphics.Outline
5
+ import android.os.Trace
5
6
  import android.view.MotionEvent
6
7
  import android.view.View
7
8
  import android.view.ViewOutlineProvider
@@ -138,12 +139,19 @@ class SmoothClipView(context: ThemedReactContext) : ReactViewGroup(context) {
138
139
  contentTranslateX: Float,
139
140
  contentTranslateY: Float,
140
141
  ) {
141
- // Stored only; applyNormalizedClipPx computes the clip residual and
142
- // applyClipPlacement writes both translations together, because the
143
- // content's final offset depends on the residual as well.
144
- requestedContentTranslateX = contentTranslateX
145
- requestedContentTranslateY = contentTranslateY
146
- applyNormalizedClipPx(left, top, right, bottom, radius)
142
+ // Debug-only Perfetto slice for the Kotlin share of the C++
143
+ // SmoothClip.setPresentation section (see SmoothClipTrace.h).
144
+ if (BuildConfig.DEBUG) Trace.beginSection("SmoothClip.applyPx")
145
+ try {
146
+ // Stored only; applyNormalizedClipPx computes the clip residual and
147
+ // applyClipPlacement writes both translations together, because the
148
+ // content's final offset depends on the residual as well.
149
+ requestedContentTranslateX = contentTranslateX
150
+ requestedContentTranslateY = contentTranslateY
151
+ applyNormalizedClipPx(left, top, right, bottom, radius)
152
+ } finally {
153
+ if (BuildConfig.DEBUG) Trace.endSection()
154
+ }
147
155
  }
148
156
 
149
157
  private fun applyRequestedGeometry() {
@@ -70,11 +70,17 @@ void setCompletionCallback(
70
70
  CompletionCallback callback);
71
71
  void clearCompletionCallback(const void *owner);
72
72
 
73
+ // recordVelocity gates the 'inherit' velocity-sample recording for this write.
74
+ // Default true (the pre-flag behavior); Android's JS layer passes false for
75
+ // setScalars hot writes on drivers without SmoothClipDriverOptions
76
+ // .velocityTracking, so the per-frame drag stream skips the clock read and
77
+ // channel copies. iOS callers never pass it and keep recording always.
73
78
  void setPresentation(
74
79
  uint64_t driverId,
75
80
  Presentation presentation,
76
81
  bool takeOwnership,
77
- bool overridePendingAnimation = false);
82
+ bool overridePendingAnimation = false,
83
+ bool recordVelocity = true);
78
84
  Presentation beginInteraction(uint64_t driverId);
79
85
  int32_t animateTiming(
80
86
  uint64_t driverId,
@@ -731,7 +731,8 @@ void setPresentation(
731
731
  uint64_t driverId,
732
732
  Presentation presentation,
733
733
  bool takeOwnership,
734
- bool overridePendingAnimation) {
734
+ bool overridePendingAnimation,
735
+ bool recordVelocity) {
735
736
  // CALayer writes require the main thread (not main-queue drain context).
736
737
  if (!NSThread.isMainThread) {
737
738
  // Never block an off-main caller: a synchronous hop can deadlock against
@@ -740,7 +741,8 @@ void setPresentation(
740
741
  // same mutex when draining scheduled worklets).
741
742
  RCTExecuteOnMainQueue(^{
742
743
  setPresentation(
743
- driverId, presentation, takeOwnership, overridePendingAnimation);
744
+ driverId, presentation, takeOwnership, overridePendingAnimation,
745
+ recordVelocity);
744
746
  });
745
747
  return;
746
748
  }
@@ -789,7 +791,7 @@ void setPresentation(
789
791
  }
790
792
  cancelActive(driverId, state, false);
791
793
  }
792
- applyPresentation(state, presentation);
794
+ applyPresentation(state, presentation, recordVelocity);
793
795
  #if defined(SMOOTH_CLIP_ENABLE_SIGNPOSTS) && SMOOTH_CLIP_ENABLE_SIGNPOSTS
794
796
  if (signpostsEnabled) {
795
797
  os_signpost_interval_end(
@@ -6,6 +6,7 @@
6
6
  // `./smoothClipNative` import below is platform-split. drivers.ts (no
7
7
  // suffix) is the web/Reanimated fallback, not this driver's sibling.
8
8
  import { useEffect, useRef } from 'react';
9
+ import { Platform } from 'react-native';
9
10
  import { useSharedValue } from 'react-native-reanimated';
10
11
  import { isRNRuntime, scheduleOnRN, scheduleOnUI } from 'react-native-worklets';
11
12
  import NativeSmoothClipModule from './smoothClipNative';
@@ -15,6 +16,20 @@ import { clipPresentationEquals, createClipPresentation, isFiniteClipPresentatio
15
16
  import { createReactRequest, rejectDriverRequests, resolveReactRequest } from "./reactRequests.js";
16
17
  const INTERACTIVE = 0;
17
18
  const NATIVE = 1;
19
+
20
+ // Only Android consumes the Reanimated start stamp (its frame-clock anchor —
21
+ // docs/android-frame-clock-anchor.md). iOS's TurboModule reads its declared
22
+ // parameters positionally and drops the trailing argument, so capturing the
23
+ // stamp there is a wasted native _getAnimationTimestamp() call per animateTo.
24
+ // Resolved once at module scope; the worklet captures the primitive.
25
+ const NEEDS_START_STAMP = Platform.OS === 'android';
26
+
27
+ // Widened like the animate* functions below: one trailing argument beyond the
28
+ // TurboModule spec — whether this write should record an `'inherit'` velocity
29
+ // sample. Android's JSI bindings read it (absent means record, the pre-flag
30
+ // behavior); the iOS TurboModule reads its declared parameters positionally
31
+ // and drops it, so iOS always records.
32
+
18
33
  const setPresentationHostFunction = NativeSmoothClipModule.setClipPresentation;
19
34
  const beginInteractionHostFunction = NativeSmoothClipModule.beginInteraction;
20
35
 
@@ -55,7 +70,7 @@ function reduceMotionCode(value) {
55
70
  return 0;
56
71
  }
57
72
  }
58
- function animationIsFinite(target, animation) {
73
+ function animationIsFinite(animation) {
59
74
  'worklet';
60
75
 
61
76
  if (animation.from !== undefined && !isFiniteClipPresentation(animation.from)) {
@@ -76,17 +91,12 @@ function animationIsFinite(target, animation) {
76
91
  if (animation.type === 'spring') {
77
92
  return [animation.mass ?? 1, animation.stiffness ?? 100, animation.damping ?? 10, animation.initialVelocity === 'inherit' ? 0 : animation.initialVelocity ?? 0].every(Number.isFinite);
78
93
  }
79
- if (!Number.isFinite(animation.duration) || animation.frames.length < 2) {
80
- return false;
81
- }
82
- let previousOffset = -1;
83
- for (const frame of animation.frames) {
84
- if (!Number.isFinite(frame.offset) || frame.offset < 0 || frame.offset > 1 || frame.offset <= previousOffset || !isFiniteClipPresentation(frame.presentation)) {
85
- return false;
86
- }
87
- previousOffset = frame.offset;
88
- }
89
- return animation.frames[0]?.offset === 0 && previousOffset === 1 && clipPresentationEquals(animation.frames[animation.frames.length - 1]?.presentation ?? null, target);
94
+ // Keyframe frames validate inside flattenFiniteKeyframes — one traversal
95
+ // both checks and flattens, instead of walking every frame twice. The type
96
+ // check is statically always-true for the TS union but load-bearing for JS
97
+ // callers: an unrecognized type must reject here, or it would skip the
98
+ // keyframe gate entirely and hand native a null frames array.
99
+ return animation.type === 'keyframes';
90
100
  }
91
101
  function presentationFromNative(values, fallback, offset = 0) {
92
102
  'worklet';
@@ -105,17 +115,37 @@ function presentationFromNative(values, fallback, offset = 0) {
105
115
  };
106
116
  return isFiniteClipPresentation(presentation) ? presentation : fallback;
107
117
  }
108
- function flattenedKeyframes(animation) {
118
+
119
+ // Validates and flattens the keyframe list in one traversal (the flat number
120
+ // array is the wire format the native side reads back positionally). Returns
121
+ // null when any frame is invalid — same rejection contract the two-pass
122
+ // validate-then-flatten had.
123
+ function flattenFiniteKeyframes(target, animation) {
109
124
  'worklet';
110
125
 
126
+ if (!Number.isFinite(animation.duration) || animation.frames.length < 2) {
127
+ return null;
128
+ }
111
129
  const values = [];
130
+ let previousOffset = -1;
112
131
  for (const frame of animation.frames) {
132
+ const {
133
+ offset,
134
+ presentation
135
+ } = frame;
136
+ if (!Number.isFinite(offset) || offset < 0 || offset > 1 || offset <= previousOffset || !isFiniteClipPresentation(presentation)) {
137
+ return null;
138
+ }
139
+ previousOffset = offset;
113
140
  const {
114
141
  clip,
115
142
  contentTranslateX,
116
143
  contentTranslateY
117
- } = frame.presentation;
118
- values.push(frame.offset, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY);
144
+ } = presentation;
145
+ values.push(offset, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY);
146
+ }
147
+ if (animation.frames[0]?.offset !== 0 || previousOffset !== 1 || !clipPresentationEquals(animation.frames[animation.frames.length - 1]?.presentation ?? null, target)) {
148
+ return null;
119
149
  }
120
150
  return values;
121
151
  }
@@ -148,6 +178,11 @@ export function useSmoothClipDriver(initialValue, options = {}) {
148
178
  if (driverRef.current === null) {
149
179
  const driverId = allocateDriverId();
150
180
  const reduceMotion = reduceMotionCode(options.reduceMotion ?? 'system');
181
+ // Captured once, like reduceMotion. Only the per-frame setScalars stream
182
+ // consults it; set(), the fused animateTo `from` seed, and the effect's
183
+ // declarative deliveries always record, so every once-per-call channel
184
+ // keeps its pre-flag 'inherit' behavior.
185
+ const velocityTracking = options.velocityTracking === true;
151
186
  const seedPresentation = next => {
152
187
  'worklet';
153
188
 
@@ -185,19 +220,36 @@ export function useSmoothClipDriver(initialValue, options = {}) {
185
220
  contentTranslateX,
186
221
  contentTranslateY
187
222
  } = next;
223
+ // Always records: only the per-frame setScalars hot path is gated by
224
+ // velocityTracking. set() already pays full validation and a SharedValue
225
+ // seed per call, so the sample recording is noise here.
188
226
  setPresentationHostFunction(driverId, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY, true, false);
189
227
  seedPresentation(next);
190
228
  };
191
- const setScalarsOnUI = (x, y, width, height, radius, contentTranslateX, contentTranslateY, overridePendingAnimation = false) => {
229
+ const setScalarsOnUI = (x, y, width, height, radius, contentTranslateX, contentTranslateY, overridePendingAnimation = false, forceRecordVelocity = false) => {
192
230
  'worklet';
193
231
 
232
+ // Resolved in the body, not as a default-parameter initializer: the
233
+ // worklets Babel plugin only captures closure variables referenced
234
+ // inside the function body, so `= velocityTracking` up in the parameter
235
+ // list would throw "Property 'velocityTracking' doesn't exist" on the
236
+ // UI runtime.
237
+ const recordVelocity = forceRecordVelocity || velocityTracking;
238
+ // Number.isFinite (not a fused arithmetic gate): it also rejects
239
+ // non-number types, which arithmetic would coerce past the gate and
240
+ // into a UI-runtime throw from the binding's asNumber. The gate must
241
+ // stay on this side of the bridge: the native binding drops non-finite
242
+ // writes silently, and flipping the ownership SharedValues below for a
243
+ // write native never applied would let the deliver listener record
244
+ // values native has not observed — a later identical declarative write
245
+ // then dedupes against them and is swallowed for good.
194
246
  if (disposed.value !== 0 || !Number.isFinite(x) || !Number.isFinite(y) || !Number.isFinite(width) || !Number.isFinite(height) || !Number.isFinite(radius) || !Number.isFinite(contentTranslateX) || !Number.isFinite(contentTranslateY)) {
195
247
  return;
196
248
  }
197
249
  if (activeAnimationId.value !== 0) activeAnimationId.value = 0;
198
250
  if (ownership.value !== INTERACTIVE) ownership.value = INTERACTIVE;
199
251
  if (scalarsStale.value === 0) scalarsStale.value = 1;
200
- setPresentationHostFunction(driverId, x, y, width, height, radius, contentTranslateX, contentTranslateY, true, overridePendingAnimation);
252
+ setPresentationHostFunction(driverId, x, y, width, height, radius, contentTranslateX, contentTranslateY, true, overridePendingAnimation, recordVelocity);
201
253
  };
202
254
  const animateOnUI = (target, animation) => {
203
255
  'worklet';
@@ -206,7 +258,8 @@ export function useSmoothClipDriver(initialValue, options = {}) {
206
258
  // invalid stale call cannot mint a native rejection id/completion against
207
259
  // a driver whose listener and registry entry are already gone.
208
260
  if (disposed.value !== 0) return 0;
209
- if (!isFiniteClipPresentation(target) || !animationIsFinite(target, animation)) {
261
+ const keyframeValues = animation.type === 'keyframes' ? flattenFiniteKeyframes(target, animation) : null;
262
+ if (!isFiniteClipPresentation(target) || !animationIsFinite(animation) || animation.type === 'keyframes' && keyframeValues === null) {
210
263
  return rejectAnimationHostFunction(driverId);
211
264
  }
212
265
  // Past the hook's cleanup the native entry is gone for good, and an
@@ -221,8 +274,13 @@ export function useSmoothClipDriver(initialValue, options = {}) {
221
274
  // before the handoff, so native's latest value — the animation
222
275
  // start below — is the caller's explicit presentation. Also
223
276
  // re-grabs from a running animation, which the implicit
224
- // interactive-start path would silently skip.
225
- setScalarsOnUI(from.clip.x, from.clip.y, from.clip.width, from.clip.height, from.clip.radius, from.contentTranslateX, from.contentTranslateY, true);
277
+ // interactive-start path would silently skip. Always records a
278
+ // velocity sample regardless of velocityTracking: this is one write
279
+ // per animateTo, not the per-frame stream the flag exists to keep
280
+ // cheap, and an unrecorded seed would invalidate the history a
281
+ // set()-driven drag just recorded (the tracker's coalesce and
282
+ // identical-re-record rules were designed for exactly this write).
283
+ setScalarsOnUI(from.clip.x, from.clip.y, from.clip.width, from.clip.height, from.clip.radius, from.contentTranslateX, from.contentTranslateY, true, true);
226
284
  }
227
285
 
228
286
  // After a setScalars hot write the SharedValue no longer matches what
@@ -247,9 +305,11 @@ export function useSmoothClipDriver(initialValue, options = {}) {
247
305
  // its rAF flush where __frameTimestamp is cleared, keeps the wall
248
306
  // clock — a lead lasting the whole animation. NaN when the globals are
249
307
  // absent (tests, non-worklets runtimes): native then falls back to its
250
- // own clock plus the min() anchor, the pre-stamp behavior.
308
+ // own clock plus the min() anchor, the pre-stamp behavior. On iOS the
309
+ // stamp is always NaN: Core Animation anchors at commit time and the
310
+ // TurboModule discards the argument, so the capture would only cost.
251
311
  const workletGlobal = globalThis;
252
- const startedAtMs = workletGlobal.__frameTimestamp || (typeof workletGlobal._getAnimationTimestamp === 'function' ? workletGlobal._getAnimationTimestamp() : Number.NaN);
312
+ const startedAtMs = !NEEDS_START_STAMP ? Number.NaN : workletGlobal.__frameTimestamp || (typeof workletGlobal._getAnimationTimestamp === 'function' ? workletGlobal._getAnimationTimestamp() : Number.NaN);
253
313
  let animationId;
254
314
  if (animation.type === 'timing') {
255
315
  const [x1, y1, x2, y2] = animation.controlPoints;
@@ -258,7 +318,10 @@ export function useSmoothClipDriver(initialValue, options = {}) {
258
318
  const inheritVelocity = animation.initialVelocity === undefined || animation.initialVelocity === 'inherit';
259
319
  animationId = animateSpringHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0.0001, animation.mass ?? 1), Math.max(0.0001, animation.stiffness ?? 100), Math.max(0, animation.damping ?? 10), inheritVelocity ? 0 : animation.initialVelocity, inheritVelocity, reduceMotion, startedAtMs);
260
320
  } else {
261
- animationId = animateKeyframesHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0, animation.duration), flattenedKeyframes(animation), reduceMotion, startedAtMs);
321
+ animationId = animateKeyframesHostFunction(driverId, hasInteractiveStart, startClip.x, startClip.y, startClip.width, startClip.height, startClip.radius, start.contentTranslateX, start.contentTranslateY, targetClip.x, targetClip.y, targetClip.width, targetClip.height, targetClip.radius, target.contentTranslateX, target.contentTranslateY, Math.max(0, animation.duration),
322
+ // Non-null here: the validation gate above rejected null before any
323
+ // side effect.
324
+ keyframeValues, reduceMotion, startedAtMs);
262
325
  }
263
326
  if (animationId === 0) {
264
327
  // The 0 sentinel: off-main, invalid-id, or otherwise unsupported
@@ -441,6 +504,8 @@ export function useSmoothClipDriver(initialValue, options = {}) {
441
504
  contentTranslateX,
442
505
  contentTranslateY
443
506
  } = next;
507
+ // Declarative deliveries always record velocity samples — only the
508
+ // setScalars hot path is gated by the velocityTracking option.
444
509
  setter(nativeDriverId, clip.x, clip.y, clip.width, clip.height, clip.radius, contentTranslateX, contentTranslateY, false, false);
445
510
  };
446
511
  source.addListener(listenerId, deliver);
@@ -1 +1 @@
1
- {"version":3,"names":["useEffect","useRef","useSharedValue","isRNRuntime","scheduleOnRN","scheduleOnUI","NativeSmoothClipModule","allocateDriverId","attachDriverState","createDriverState","detachDriverState","getDriverState","setDriverState","completeNativeAnimation","synchronizeNativeCompletion","clipPresentationEquals","createClipPresentation","isFiniteClipPresentation","createReactRequest","rejectDriverRequests","resolveReactRequest","INTERACTIVE","NATIVE","setPresentationHostFunction","setClipPresentation","beginInteractionHostFunction","beginInteraction","animateTimingHostFunction","animateTiming","animateSpringHostFunction","animateSpring","animateKeyframesHostFunction","animateKeyframes","rejectAnimationHostFunction","rejectAnimation","cancelAnimationHostFunction","cancelAnimation","destroyDriverHostFunction","destroyDriver","resolver","globalThis","__smoothClipPinnedResolver","reduceMotionCode","value","animationIsFinite","target","animation","from","undefined","type","x1","x2","controlPoints","Number","isFinite","duration","every","mass","stiffness","damping","initialVelocity","frames","length","previousOffset","frame","offset","presentation","presentationFromNative","values","fallback","clip","x","y","width","height","radius","contentTranslateX","contentTranslateY","flattenedKeyframes","push","uiOnly","Error","useSmoothClipDriver","initialValue","options","initialPresentation","ownership","suppressDeliveries","activeAnimationId","scalarsStale","disposed","callbackRef","onAnimationComplete","driverRef","current","driverId","reduceMotion","seedPresentation","next","beginOnUI","setOnUI","setScalarsOnUI","overridePendingAnimation","animateOnUI","scalarsWereStale","hasInteractiveStart","start","startClip","targetClip","workletGlobal","startedAtMs","__frameTimestamp","_getAnimationTimestamp","NaN","animationId","y1","y2","Math","max","inheritVelocity","cancelOnUI","behavior","driver","kind","ui","set","setScalars","animateTo","cancel","react","requestId","promise","result","currentDriver","state","subscription","onClipAnimationComplete","finished","source","listenerId","nativeDriverId","owner","suppressed","active","stale","gone","setter","last","deliver","addListener","remove","destroy","removeListener"],"sourceRoot":"../../src","sources":["drivers.native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,cAAc,QAA0B,yBAAyB;AAC1E,SAASC,WAAW,E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,QAAQ,EACRT,SAAS,EACTE,iBAAiB,EACjBC,YAAY,EACZF,kBAAkB,EAClBG,QAAQ,EACRrD,yBACF,CAAC;IACH,CAAC;EACH,CAAC,EAAE,CACDmD,iBAAiB,EACjBE,QAAQ,EACRJ,SAAS,EACTpB,YAAY,EACZuB,YAAY,EACZF,kBAAkB,CACnB,CAAC;EAEF,OAAOmC,MAAM;AACf","ignoreList":[]}
1
+ {"version":3,"names":["useEffect","useRef","Platform","useSharedValue","isRNRuntime","scheduleOnRN","scheduleOnUI","NativeSmoothClipModule","allocateDriverId","attachDriverState","createDriverState","detachDriverState","getDriverState","setDriverState","completeNativeAnimation","synchronizeNativeCompletion","clipPresentationEquals","createClipPresentation","isFiniteClipPresentation","createReactRequest","rejectDriverRequests","resolveReactRequest","INTERACTIVE","NATIVE","NEEDS_START_STAMP","OS","setPresentationHostFunction","setClipPresentation","beginInteractionHostFunction","beginInteraction","animateTimingHostFunction","animateTiming","animateSpringHostFunction","animateSpring","animateKeyframesHostFunction","animateKeyframes","rejectAnimationHostFunction","rejectAnimation","cancelAnimationHostFunction","cancelAnimation","destroyDriverHostFunction","destroyDriver","resolver","globalThis","__smoothClipPinnedResolver","reduceMotionCode","value","animationIsFinite","animation","from","undefined","type","x1","x2","controlPoints","Number","isFinite","duration","every","mass","stiffness","damping","initialVelocity","presentationFromNative","values","fallback","offset","length","presentation","clip","x","y","width","height","radius","contentTranslateX","contentTranslateY","flattenFiniteKeyframes","target","frames","previousOffset","frame","push","uiOnly","Error","useSmoothClipDriver","initialValue","options","initialPresentation","ownership","suppressDeliveries","activeAnimationId","scalarsStale","disposed","callbackRef","onAnimationComplete","driverRef","current","driverId","reduceMotion","velocityTracking","seedPresentation","next","beginOnUI","setOnUI","setScalarsOnUI","overridePendingAnimation","forceRecordVelocity","recordVelocity","animateOnUI","keyframeValues","scalarsWereStale","hasInteractiveStart","start","startClip","targetClip","workletGlobal","startedAtMs","NaN","__frameTimestamp","_getAnimationTimestamp","animationId","y1","y2","Math","max","inheritVelocity","cancelOnUI","behavior","driver","kind","ui","set","setScalars","animateTo","cancel","react","requestId","promise","result","currentDriver","state","subscription","onClipAnimationComplete","finished","source","listenerId","nativeDriverId","owner","suppressed","active","stale","gone","setter","last","deliver","addListener","remove","destroy","removeListener"],"sourceRoot":"../../src","sources":["drivers.native.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,cAAc,QAA0B,yBAAyB;AAC1E,SAASC,WAAW,EAAEC,YAAY,EAAEC,YAAY,QAAQ,uBAAuB;AAC/E,OAAOC,sBAAsB,MAAM,oBAAoB;AAUvD,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,EACjBC,cAAc,EACdC,cAAc,QACT,kBAAe;AACtB,SACEC,uBAAuB,EACvBC,2BAA2B,QACtB,uBAAoB;AAC3B,SACEC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QAGnB,eAAY;AACnB,SACEC,kBAAkB,EAClBC,oBAAoB,EACpBC,mBAAmB,QACd,oBAAiB;AAExB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,MAAM,GAAG,CAAC;;AAEhB;AACA;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAGtB,QAAQ,CAACuB,EAAE,KAAK,SAAS;;AAEnD;AACA;AACA;AACA;AACA;;AAIA,MAAMC,2BAEL,GAAGnB,sBAAsB,CAACoB,mBAAmB;AAC9C,MAAMC,4BAA4B,GAAGrB,sBAAsB,CAACsB,gBAAgB;;AAE5E;AACA;AACA;AACA;AACA;AACA;;AAIA,MAAMC,yBAEL,GAAGvB,sBAAsB,CAACwB,aAAa;AACxC,MAAMC,yBAEL,GAAGzB,sBAAsB,CAAC0B,aAAa;AACxC,MAAMC,4BAEL,GAAG3B,sBAAsB,CAAC4B,gBAAgB;AAC3C,MAAMC,2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ACTrB,YAAY,EACZwB,YAAY,EACZF,kBAAkB,CACnB,CAAC;EAEF,OAAOuC,MAAM;AACf","ignoreList":[]}
@@ -57,6 +57,20 @@ export type ClipAnimationResult = Readonly<{
57
57
  export type SmoothClipDriverOptions = Readonly<{
58
58
  reduceMotion?: ClipReduceMotion;
59
59
  onAnimationComplete?: (result: ClipAnimationResult) => void;
60
+ /**
61
+ * Android only; captured at driver creation. Records two-sample velocity
62
+ * history on `setScalars` hot writes so a spring `initialVelocity: 'inherit'`
63
+ * can project its launch speed from the live drag. Off by default: the
64
+ * recording (a clock read plus channel copies) rides the per-frame
65
+ * `setScalars` hot path, and drivers that never hand off into an inherit
66
+ * spring should not pay it. Without this flag, `'inherit'` inherits 0 after
67
+ * a `setScalars` drag on Android (each skipped write also invalidates older
68
+ * samples, so stale pre-drag motion never leaks in). `set()`, the fused
69
+ * `animateTo` `from` seed, and the declarative `presentation.value` channel
70
+ * always record regardless of the flag. iOS always records; the flag is a
71
+ * no-op there.
72
+ */
73
+ velocityTracking?: boolean;
60
74
  }>;
61
75
  export type SmoothClipUIControls = Readonly<{
62
76
  beginInteraction(): SmoothClipPresentation;
@@ -1 +1 @@
1
- {"version":3,"file":"driverTypes.d.ts","sourceRoot":"","sources":["../../../src/driverTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAY,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7D,8CAA8C;AAC9C,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IAChC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,IAAI,CAAC,EAAE,sBAAsB,CAAC;CAC/B,CAAC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,iBAAiB,GACjD,QAAQ,CAAC;IACP,IAAI,EAAE,QAAQ,CAA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C,sBAAsB,CAAC,CAAC;IAClD,EAAE,EAAE,oBAAoB,CAAC;IACzB,KAAK,EAAE,uBAAuB,CAAC;CAChC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"drivers.native.d.ts","sourceRoot":"","sources":["../../../src/drivers.native.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAavB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AA2KpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CAomBlB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
1
+ {"version":3,"file":"drivers.native.d.ts","sourceRoot":"","sources":["../../../src/drivers.native.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAe,CAAC;AAavB,OAAO,EAIL,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC5B,MAAM,eAAY,CAAC;AAuMpB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,YAAY,GAAG,sBAAsB,EACnD,OAAO,GAAE,uBAA4B,GACpC,gBAAgB,CA6oBlB;AAED,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,GACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-smooth-clip-view",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
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",
@@ -69,6 +69,20 @@ export type ClipAnimationResult = Readonly<{
69
69
  export type SmoothClipDriverOptions = Readonly<{
70
70
  reduceMotion?: ClipReduceMotion;
71
71
  onAnimationComplete?: (result: ClipAnimationResult) => void;
72
+ /**
73
+ * Android only; captured at driver creation. Records two-sample velocity
74
+ * history on `setScalars` hot writes so a spring `initialVelocity: 'inherit'`
75
+ * can project its launch speed from the live drag. Off by default: the
76
+ * recording (a clock read plus channel copies) rides the per-frame
77
+ * `setScalars` hot path, and drivers that never hand off into an inherit
78
+ * spring should not pay it. Without this flag, `'inherit'` inherits 0 after
79
+ * a `setScalars` drag on Android (each skipped write also invalidates older
80
+ * samples, so stale pre-drag motion never leaks in). `set()`, the fused
81
+ * `animateTo` `from` seed, and the declarative `presentation.value` channel
82
+ * always record regardless of the flag. iOS always records; the flag is a
83
+ * no-op there.
84
+ */
85
+ velocityTracking?: boolean;
72
86
  }>;
73
87
 
74
88
  export type SmoothClipUIControls = Readonly<{
@@ -4,6 +4,7 @@
4
4
  // `./smoothClipNative` import below is platform-split. drivers.ts (no
5
5
  // suffix) is the web/Reanimated fallback, not this driver's sibling.
6
6
  import { useEffect, useRef } from 'react';
7
+ import { Platform } from 'react-native';
7
8
  import { useSharedValue, type SharedValue } from 'react-native-reanimated';
8
9
  import { isRNRuntime, scheduleOnRN, scheduleOnUI } from 'react-native-worklets';
9
10
  import NativeSmoothClipModule from './smoothClipNative';
@@ -44,7 +45,24 @@ import {
44
45
  const INTERACTIVE = 0;
45
46
  const NATIVE = 1;
46
47
 
47
- const setPresentationHostFunction = NativeSmoothClipModule.setClipPresentation;
48
+ // Only Android consumes the Reanimated start stamp (its frame-clock anchor —
49
+ // docs/android-frame-clock-anchor.md). iOS's TurboModule reads its declared
50
+ // parameters positionally and drops the trailing argument, so capturing the
51
+ // stamp there is a wasted native _getAnimationTimestamp() call per animateTo.
52
+ // Resolved once at module scope; the worklet captures the primitive.
53
+ const NEEDS_START_STAMP = Platform.OS === 'android';
54
+
55
+ // Widened like the animate* functions below: one trailing argument beyond the
56
+ // TurboModule spec — whether this write should record an `'inherit'` velocity
57
+ // sample. Android's JSI bindings read it (absent means record, the pre-flag
58
+ // behavior); the iOS TurboModule reads its declared parameters positionally
59
+ // and drops it, so iOS always records.
60
+ type WithRecordVelocity<F> = F extends (...args: infer A) => infer R
61
+ ? (...args: [...A, recordVelocity?: boolean]) => R
62
+ : never;
63
+ const setPresentationHostFunction: WithRecordVelocity<
64
+ typeof NativeSmoothClipModule.setClipPresentation
65
+ > = NativeSmoothClipModule.setClipPresentation;
48
66
  const beginInteractionHostFunction = NativeSmoothClipModule.beginInteraction;
49
67
 
50
68
  // The animate* host functions take one argument beyond the TurboModule spec:
@@ -93,10 +111,7 @@ function reduceMotionCode(value: ClipReduceMotion): number {
93
111
  }
94
112
  }
95
113
 
96
- function animationIsFinite(
97
- target: SmoothClipPresentation,
98
- animation: SmoothClipAnimation
99
- ): boolean {
114
+ function animationIsFinite(animation: SmoothClipAnimation): boolean {
100
115
  'worklet';
101
116
  if (
102
117
  animation.from !== undefined &&
@@ -132,30 +147,12 @@ function animationIsFinite(
132
147
  : (animation.initialVelocity ?? 0),
133
148
  ].every(Number.isFinite);
134
149
  }
135
- if (!Number.isFinite(animation.duration) || animation.frames.length < 2) {
136
- return false;
137
- }
138
- let previousOffset = -1;
139
- for (const frame of animation.frames) {
140
- if (
141
- !Number.isFinite(frame.offset) ||
142
- frame.offset < 0 ||
143
- frame.offset > 1 ||
144
- frame.offset <= previousOffset ||
145
- !isFiniteClipPresentation(frame.presentation)
146
- ) {
147
- return false;
148
- }
149
- previousOffset = frame.offset;
150
- }
151
- return (
152
- animation.frames[0]?.offset === 0 &&
153
- previousOffset === 1 &&
154
- clipPresentationEquals(
155
- animation.frames[animation.frames.length - 1]?.presentation ?? null,
156
- target
157
- )
158
- );
150
+ // Keyframe frames validate inside flattenFiniteKeyframes — one traversal
151
+ // both checks and flattens, instead of walking every frame twice. The type
152
+ // check is statically always-true for the TS union but load-bearing for JS
153
+ // callers: an unrecognized type must reject here, or it would skip the
154
+ // keyframe gate entirely and hand native a null frames array.
155
+ return animation.type === 'keyframes';
159
156
  }
160
157
 
161
158
  function presentationFromNative(
@@ -179,13 +176,35 @@ function presentationFromNative(
179
176
  return isFiniteClipPresentation(presentation) ? presentation : fallback;
180
177
  }
181
178
 
182
- function flattenedKeyframes(animation: KeyframedClipAnimation): number[] {
179
+ // Validates and flattens the keyframe list in one traversal (the flat number
180
+ // array is the wire format the native side reads back positionally). Returns
181
+ // null when any frame is invalid — same rejection contract the two-pass
182
+ // validate-then-flatten had.
183
+ function flattenFiniteKeyframes(
184
+ target: SmoothClipPresentation,
185
+ animation: KeyframedClipAnimation
186
+ ): number[] | null {
183
187
  'worklet';
188
+ if (!Number.isFinite(animation.duration) || animation.frames.length < 2) {
189
+ return null;
190
+ }
184
191
  const values: number[] = [];
192
+ let previousOffset = -1;
185
193
  for (const frame of animation.frames) {
186
- const { clip, contentTranslateX, contentTranslateY } = frame.presentation;
194
+ const { offset, presentation } = frame;
195
+ if (
196
+ !Number.isFinite(offset) ||
197
+ offset < 0 ||
198
+ offset > 1 ||
199
+ offset <= previousOffset ||
200
+ !isFiniteClipPresentation(presentation)
201
+ ) {
202
+ return null;
203
+ }
204
+ previousOffset = offset;
205
+ const { clip, contentTranslateX, contentTranslateY } = presentation;
187
206
  values.push(
188
- frame.offset,
207
+ offset,
189
208
  clip.x,
190
209
  clip.y,
191
210
  clip.width,
@@ -195,6 +214,16 @@ function flattenedKeyframes(animation: KeyframedClipAnimation): number[] {
195
214
  contentTranslateY
196
215
  );
197
216
  }
217
+ if (
218
+ animation.frames[0]?.offset !== 0 ||
219
+ previousOffset !== 1 ||
220
+ !clipPresentationEquals(
221
+ animation.frames[animation.frames.length - 1]?.presentation ?? null,
222
+ target
223
+ )
224
+ ) {
225
+ return null;
226
+ }
198
227
  return values;
199
228
  }
200
229
 
@@ -236,7 +265,11 @@ export function useSmoothClipDriver(
236
265
  if (driverRef.current === null) {
237
266
  const driverId = allocateDriverId();
238
267
  const reduceMotion = reduceMotionCode(options.reduceMotion ?? 'system');
239
-
268
+ // Captured once, like reduceMotion. Only the per-frame setScalars stream
269
+ // consults it; set(), the fused animateTo `from` seed, and the effect's
270
+ // declarative deliveries always record, so every once-per-call channel
271
+ // keeps its pre-flag 'inherit' behavior.
272
+ const velocityTracking = options.velocityTracking === true;
240
273
  const seedPresentation = (next: SmoothClipPresentation) => {
241
274
  'worklet';
242
275
  if (clipPresentationEquals(presentation.value, next)) return;
@@ -272,6 +305,9 @@ export function useSmoothClipDriver(
272
305
  ownership.value = INTERACTIVE;
273
306
  scalarsStale.value = 0;
274
307
  const { clip, contentTranslateX, contentTranslateY } = next;
308
+ // Always records: only the per-frame setScalars hot path is gated by
309
+ // velocityTracking. set() already pays full validation and a SharedValue
310
+ // seed per call, so the sample recording is noise here.
275
311
  setPresentationHostFunction(
276
312
  driverId,
277
313
  clip.x,
@@ -295,9 +331,24 @@ export function useSmoothClipDriver(
295
331
  radius: number,
296
332
  contentTranslateX: number,
297
333
  contentTranslateY: number,
298
- overridePendingAnimation = false
334
+ overridePendingAnimation = false,
335
+ forceRecordVelocity = false
299
336
  ): void => {
300
337
  'worklet';
338
+ // Resolved in the body, not as a default-parameter initializer: the
339
+ // worklets Babel plugin only captures closure variables referenced
340
+ // inside the function body, so `= velocityTracking` up in the parameter
341
+ // list would throw "Property 'velocityTracking' doesn't exist" on the
342
+ // UI runtime.
343
+ const recordVelocity = forceRecordVelocity || velocityTracking;
344
+ // Number.isFinite (not a fused arithmetic gate): it also rejects
345
+ // non-number types, which arithmetic would coerce past the gate and
346
+ // into a UI-runtime throw from the binding's asNumber. The gate must
347
+ // stay on this side of the bridge: the native binding drops non-finite
348
+ // writes silently, and flipping the ownership SharedValues below for a
349
+ // write native never applied would let the deliver listener record
350
+ // values native has not observed — a later identical declarative write
351
+ // then dedupes against them and is swallowed for good.
301
352
  if (
302
353
  disposed.value !== 0 ||
303
354
  !Number.isFinite(x) ||
@@ -323,7 +374,8 @@ export function useSmoothClipDriver(
323
374
  contentTranslateX,
324
375
  contentTranslateY,
325
376
  true,
326
- overridePendingAnimation
377
+ overridePendingAnimation,
378
+ recordVelocity
327
379
  );
328
380
  };
329
381
 
@@ -336,9 +388,14 @@ export function useSmoothClipDriver(
336
388
  // invalid stale call cannot mint a native rejection id/completion against
337
389
  // a driver whose listener and registry entry are already gone.
338
390
  if (disposed.value !== 0) return 0;
391
+ const keyframeValues =
392
+ animation.type === 'keyframes'
393
+ ? flattenFiniteKeyframes(target, animation)
394
+ : null;
339
395
  if (
340
396
  !isFiniteClipPresentation(target) ||
341
- !animationIsFinite(target, animation)
397
+ !animationIsFinite(animation) ||
398
+ (animation.type === 'keyframes' && keyframeValues === null)
342
399
  ) {
343
400
  return rejectAnimationHostFunction(driverId);
344
401
  }
@@ -354,7 +411,12 @@ export function useSmoothClipDriver(
354
411
  // before the handoff, so native's latest value — the animation
355
412
  // start below — is the caller's explicit presentation. Also
356
413
  // re-grabs from a running animation, which the implicit
357
- // interactive-start path would silently skip.
414
+ // interactive-start path would silently skip. Always records a
415
+ // velocity sample regardless of velocityTracking: this is one write
416
+ // per animateTo, not the per-frame stream the flag exists to keep
417
+ // cheap, and an unrecorded seed would invalidate the history a
418
+ // set()-driven drag just recorded (the tracker's coalesce and
419
+ // identical-re-record rules were designed for exactly this write).
358
420
  setScalarsOnUI(
359
421
  from.clip.x,
360
422
  from.clip.y,
@@ -363,6 +425,7 @@ export function useSmoothClipDriver(
363
425
  from.clip.radius,
364
426
  from.contentTranslateX,
365
427
  from.contentTranslateY,
428
+ true,
366
429
  true
367
430
  );
368
431
  }
@@ -390,16 +453,19 @@ export function useSmoothClipDriver(
390
453
  // its rAF flush where __frameTimestamp is cleared, keeps the wall
391
454
  // clock — a lead lasting the whole animation. NaN when the globals are
392
455
  // absent (tests, non-worklets runtimes): native then falls back to its
393
- // own clock plus the min() anchor, the pre-stamp behavior.
456
+ // own clock plus the min() anchor, the pre-stamp behavior. On iOS the
457
+ // stamp is always NaN: Core Animation anchors at commit time and the
458
+ // TurboModule discards the argument, so the capture would only cost.
394
459
  const workletGlobal = globalThis as {
395
460
  __frameTimestamp?: number;
396
461
  _getAnimationTimestamp?: () => number;
397
462
  };
398
- const startedAtMs =
399
- workletGlobal.__frameTimestamp ||
400
- (typeof workletGlobal._getAnimationTimestamp === 'function'
401
- ? workletGlobal._getAnimationTimestamp()
402
- : Number.NaN);
463
+ const startedAtMs = !NEEDS_START_STAMP
464
+ ? Number.NaN
465
+ : workletGlobal.__frameTimestamp ||
466
+ (typeof workletGlobal._getAnimationTimestamp === 'function'
467
+ ? workletGlobal._getAnimationTimestamp()
468
+ : Number.NaN);
403
469
  let animationId: number;
404
470
 
405
471
  if (animation.type === 'timing') {
@@ -477,7 +543,9 @@ export function useSmoothClipDriver(
477
543
  target.contentTranslateX,
478
544
  target.contentTranslateY,
479
545
  Math.max(0, animation.duration),
480
- flattenedKeyframes(animation),
546
+ // Non-null here: the validation gate above rejected null before any
547
+ // side effect.
548
+ keyframeValues as number[],
481
549
  reduceMotion,
482
550
  startedAtMs
483
551
  );
@@ -713,6 +781,8 @@ export function useSmoothClipDriver(
713
781
  last = next;
714
782
  if (stale.value !== 0) stale.value = 0;
715
783
  const { clip, contentTranslateX, contentTranslateY } = next;
784
+ // Declarative deliveries always record velocity samples — only the
785
+ // setScalars hot path is gated by the velocityTracking option.
716
786
  setter(
717
787
  nativeDriverId,
718
788
  clip.x,