react-native-smooth-clip-view 0.2.8 → 0.3.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/README.md +86 -21
- package/android/CMakeLists.txt +7 -0
- package/android/build.gradle +14 -2
- package/android/proguard-rules.pro +3 -3
- package/android/src/main/cpp/SmoothClipAndroid.h +10 -0
- package/android/src/main/cpp/SmoothClipBindings.cpp +896 -6
- package/android/src/main/cpp/SmoothClipRegistry.cpp +1067 -46
- package/android/src/main/cpp/SmoothClipTrace.h +25 -0
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +265 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +21 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +283 -0
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +385 -24
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +138 -24
- package/cpp/SmoothClipAnimationCurve.h +151 -122
- package/cpp/SmoothClipRegistry.h +102 -4
- package/cpp/SmoothClipSharedGeometry.h +146 -7
- package/cpp/SmoothClipVelocityTracker.h +13 -9
- package/ios/SmoothClipGeometry.h +184 -6
- package/ios/SmoothClipRegistry.mm +1033 -25
- package/ios/SmoothClipRegistrySnapshot.h +13 -0
- package/ios/SmoothClipTurboModule.cpp +857 -2
- package/ios/SmoothClipTurboModule.h +310 -0
- package/ios/SmoothClipView.mm +714 -183
- package/ios/SmoothClipViewRegistry.h +1 -0
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/reactnativesmoothclipview.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/lib/module/NativeSmoothClipModule.js.map +1 -1
- package/lib/module/SmoothClipView.ios.js +22 -6
- package/lib/module/SmoothClipView.ios.js.map +1 -1
- package/lib/module/SmoothClipView.js +1 -46
- package/lib/module/SmoothClipView.js.map +1 -1
- package/lib/module/SmoothClipViewNativeComponent.ts +27 -1
- package/lib/module/capabilities.js +4 -0
- package/lib/module/capabilities.js.map +1 -0
- package/lib/module/capabilities.native.js +36 -0
- package/lib/module/capabilities.native.js.map +1 -0
- package/lib/module/capabilityTypes.js +11 -0
- package/lib/module/capabilityTypes.js.map +1 -0
- package/lib/module/driverState.js +0 -28
- package/lib/module/driverState.js.map +1 -1
- package/lib/module/drivers.js +1 -281
- package/lib/module/drivers.js.map +1 -1
- package/lib/module/drivers.native.js +340 -75
- package/lib/module/drivers.native.js.map +1 -1
- package/lib/module/geometry.js +147 -17
- package/lib/module/geometry.js.map +1 -1
- package/lib/module/groupDriverTypes.js +4 -0
- package/lib/module/groupDriverTypes.js.map +1 -0
- package/lib/module/groupDrivers.android.js +4 -0
- package/lib/module/groupDrivers.android.js.map +1 -0
- package/lib/module/groupDrivers.ios.js +4 -0
- package/lib/module/groupDrivers.ios.js.map +1 -0
- package/lib/module/groupDrivers.js +4 -0
- package/lib/module/groupDrivers.js.map +1 -0
- package/lib/module/groupDrivers.native.js +799 -0
- package/lib/module/groupDrivers.native.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/presentationProtocol.js +15 -0
- package/lib/module/presentationProtocol.js.map +1 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts +25 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.d.ts +2 -10
- package/lib/typescript/src/SmoothClipView.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipView.ios.d.ts +133 -2
- package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +8 -0
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/capabilities.d.ts +3 -0
- package/lib/typescript/src/capabilities.d.ts.map +1 -0
- package/lib/typescript/src/capabilities.native.d.ts +3 -0
- package/lib/typescript/src/capabilities.native.d.ts.map +1 -0
- package/lib/typescript/src/capabilityTypes.d.ts +10 -0
- package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
- package/lib/typescript/src/driverState.d.ts +1 -6
- package/lib/typescript/src/driverState.d.ts.map +1 -1
- package/lib/typescript/src/driverTypes.d.ts +39 -11
- package/lib/typescript/src/driverTypes.d.ts.map +1 -1
- package/lib/typescript/src/drivers.d.ts +2 -4
- package/lib/typescript/src/drivers.d.ts.map +1 -1
- package/lib/typescript/src/drivers.native.d.ts.map +1 -1
- package/lib/typescript/src/geometry.d.ts +36 -2
- package/lib/typescript/src/geometry.d.ts.map +1 -1
- package/lib/typescript/src/groupDriverTypes.d.ts +66 -0
- package/lib/typescript/src/groupDriverTypes.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.android.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.android.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.ios.d.ts +2 -0
- package/lib/typescript/src/groupDrivers.ios.d.ts.map +1 -0
- package/lib/typescript/src/groupDrivers.native.d.ts +4 -0
- package/lib/typescript/src/groupDrivers.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/presentationProtocol.d.ts +4 -0
- package/lib/typescript/src/presentationProtocol.d.ts.map +1 -0
- package/package.json +10 -11
- package/src/NativeSmoothClipModule.ts +275 -0
- package/src/SmoothClipView.ios.tsx +30 -11
- package/src/SmoothClipView.tsx +2 -76
- package/src/SmoothClipViewNativeComponent.ts +27 -1
- package/src/capabilities.native.ts +69 -0
- package/src/capabilities.ts +2 -0
- package/src/capabilityTypes.ts +17 -0
- package/src/driverState.ts +1 -41
- package/src/driverTypes.ts +56 -11
- package/src/drivers.native.ts +921 -151
- package/src/drivers.ts +2 -423
- package/src/geometry.ts +231 -27
- package/src/groupDriverTypes.ts +117 -0
- package/src/groupDrivers.android.ts +1 -0
- package/src/groupDrivers.ios.ts +1 -0
- package/src/groupDrivers.native.ts +1189 -0
- package/src/groupDrivers.ts +1 -0
- package/src/index.ts +30 -2
- package/src/presentationProtocol.ts +28 -0
- package/lib/module/SmoothClipView.web.js +0 -54
- package/lib/module/SmoothClipView.web.js.map +0 -1
- package/lib/module/index.web.js +0 -8
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/webClipPath.js +0 -25
- package/lib/module/webClipPath.js.map +0 -1
- package/lib/typescript/src/SmoothClipView.web.d.ts +0 -10
- package/lib/typescript/src/SmoothClipView.web.d.ts.map +0 -1
- package/lib/typescript/src/index.web.d.ts +0 -9
- package/lib/typescript/src/index.web.d.ts.map +0 -1
- package/lib/typescript/src/webClipPath.d.ts +0 -7
- package/lib/typescript/src/webClipPath.d.ts.map +0 -1
- package/src/SmoothClipView.web.tsx +0 -66
- package/src/index.web.ts +0 -23
- package/src/webClipPath.ts +0 -30
|
@@ -9,6 +9,81 @@ export interface Spec extends TurboModule {
|
|
|
9
9
|
finished: boolean;
|
|
10
10
|
}>
|
|
11
11
|
>;
|
|
12
|
+
readonly onClipGroupAnimationComplete: CodegenTypes.EventEmitter<
|
|
13
|
+
Readonly<{
|
|
14
|
+
controllerId: CodegenTypes.Double;
|
|
15
|
+
groupId: CodegenTypes.Int32;
|
|
16
|
+
finished: boolean;
|
|
17
|
+
driverIds: ReadonlyArray<CodegenTypes.Double>;
|
|
18
|
+
}>
|
|
19
|
+
>;
|
|
20
|
+
getPresentationProtocolVersion(): CodegenTypes.Int32;
|
|
21
|
+
supportsAutonomousComplexPathAnimation(): boolean;
|
|
22
|
+
beginGroupInteractionV2(
|
|
23
|
+
driverIds: ReadonlyArray<CodegenTypes.Double>
|
|
24
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
25
|
+
snapshotGroupV2(
|
|
26
|
+
driverIds: ReadonlyArray<CodegenTypes.Double>
|
|
27
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
28
|
+
setClipPresentationBatchV2(
|
|
29
|
+
entries: ReadonlyArray<CodegenTypes.Double>
|
|
30
|
+
): boolean;
|
|
31
|
+
animateTimingGroupV2(
|
|
32
|
+
controllerId: CodegenTypes.Double,
|
|
33
|
+
entries: ReadonlyArray<CodegenTypes.Double>,
|
|
34
|
+
durationMs: CodegenTypes.Double,
|
|
35
|
+
controlPoint1X: CodegenTypes.Double,
|
|
36
|
+
controlPoint1Y: CodegenTypes.Double,
|
|
37
|
+
controlPoint2X: CodegenTypes.Double,
|
|
38
|
+
controlPoint2Y: CodegenTypes.Double,
|
|
39
|
+
reduceMotion: CodegenTypes.Int32,
|
|
40
|
+
suspensionPolicy: CodegenTypes.Int32
|
|
41
|
+
): CodegenTypes.Int32;
|
|
42
|
+
animateSpringGroupV2(
|
|
43
|
+
controllerId: CodegenTypes.Double,
|
|
44
|
+
entries: ReadonlyArray<CodegenTypes.Double>,
|
|
45
|
+
mass: CodegenTypes.Double,
|
|
46
|
+
stiffness: CodegenTypes.Double,
|
|
47
|
+
damping: CodegenTypes.Double,
|
|
48
|
+
initialVelocity: CodegenTypes.Double,
|
|
49
|
+
inheritVelocity: boolean,
|
|
50
|
+
reduceMotion: CodegenTypes.Int32,
|
|
51
|
+
suspensionPolicy: CodegenTypes.Int32
|
|
52
|
+
): CodegenTypes.Int32;
|
|
53
|
+
animateKeyframesGroupV2(
|
|
54
|
+
controllerId: CodegenTypes.Double,
|
|
55
|
+
entries: ReadonlyArray<CodegenTypes.Double>,
|
|
56
|
+
durationMs: CodegenTypes.Double,
|
|
57
|
+
reduceMotion: CodegenTypes.Int32,
|
|
58
|
+
suspensionPolicy: CodegenTypes.Int32
|
|
59
|
+
): CodegenTypes.Int32;
|
|
60
|
+
cancelAnimationGroupV2(
|
|
61
|
+
groupId: CodegenTypes.Int32,
|
|
62
|
+
behavior: CodegenTypes.Int32
|
|
63
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
64
|
+
setClipPresentationV2(
|
|
65
|
+
driverId: CodegenTypes.Double,
|
|
66
|
+
x: CodegenTypes.Double,
|
|
67
|
+
y: CodegenTypes.Double,
|
|
68
|
+
width: CodegenTypes.Double,
|
|
69
|
+
height: CodegenTypes.Double,
|
|
70
|
+
topLeftRadius: CodegenTypes.Double,
|
|
71
|
+
topRightRadius: CodegenTypes.Double,
|
|
72
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
73
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
74
|
+
curveCode: CodegenTypes.Int32,
|
|
75
|
+
contentTranslateX: CodegenTypes.Double,
|
|
76
|
+
contentTranslateY: CodegenTypes.Double,
|
|
77
|
+
contentScale: CodegenTypes.Double,
|
|
78
|
+
takeOwnership: boolean,
|
|
79
|
+
overridePendingAnimation: boolean
|
|
80
|
+
): void;
|
|
81
|
+
beginInteractionV2(
|
|
82
|
+
driverId: CodegenTypes.Double
|
|
83
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
84
|
+
snapshotCurrentV2(
|
|
85
|
+
driverId: CodegenTypes.Double
|
|
86
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
12
87
|
setClipPresentation(
|
|
13
88
|
driverId: CodegenTypes.Double,
|
|
14
89
|
x: CodegenTypes.Double,
|
|
@@ -48,6 +123,40 @@ export interface Spec extends TurboModule {
|
|
|
48
123
|
controlPoint2Y: CodegenTypes.Double,
|
|
49
124
|
reduceMotion: CodegenTypes.Int32
|
|
50
125
|
): CodegenTypes.Int32;
|
|
126
|
+
animateTimingV2(
|
|
127
|
+
driverId: CodegenTypes.Double,
|
|
128
|
+
hasInteractiveStart: boolean,
|
|
129
|
+
startX: CodegenTypes.Double,
|
|
130
|
+
startY: CodegenTypes.Double,
|
|
131
|
+
startWidth: CodegenTypes.Double,
|
|
132
|
+
startHeight: CodegenTypes.Double,
|
|
133
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
134
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
135
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
136
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
137
|
+
startCurveCode: CodegenTypes.Int32,
|
|
138
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
139
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
140
|
+
startContentScale: CodegenTypes.Double,
|
|
141
|
+
x: CodegenTypes.Double,
|
|
142
|
+
y: CodegenTypes.Double,
|
|
143
|
+
width: CodegenTypes.Double,
|
|
144
|
+
height: CodegenTypes.Double,
|
|
145
|
+
topLeftRadius: CodegenTypes.Double,
|
|
146
|
+
topRightRadius: CodegenTypes.Double,
|
|
147
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
148
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
149
|
+
curveCode: CodegenTypes.Int32,
|
|
150
|
+
contentTranslateX: CodegenTypes.Double,
|
|
151
|
+
contentTranslateY: CodegenTypes.Double,
|
|
152
|
+
contentScale: CodegenTypes.Double,
|
|
153
|
+
durationMs: CodegenTypes.Double,
|
|
154
|
+
controlPoint1X: CodegenTypes.Double,
|
|
155
|
+
controlPoint1Y: CodegenTypes.Double,
|
|
156
|
+
controlPoint2X: CodegenTypes.Double,
|
|
157
|
+
controlPoint2Y: CodegenTypes.Double,
|
|
158
|
+
reduceMotion: CodegenTypes.Int32
|
|
159
|
+
): CodegenTypes.Int32;
|
|
51
160
|
animateSpring(
|
|
52
161
|
driverId: CodegenTypes.Double,
|
|
53
162
|
hasInteractiveStart: boolean,
|
|
@@ -72,6 +181,40 @@ export interface Spec extends TurboModule {
|
|
|
72
181
|
inheritVelocity: boolean,
|
|
73
182
|
reduceMotion: CodegenTypes.Int32
|
|
74
183
|
): CodegenTypes.Int32;
|
|
184
|
+
animateSpringV2(
|
|
185
|
+
driverId: CodegenTypes.Double,
|
|
186
|
+
hasInteractiveStart: boolean,
|
|
187
|
+
startX: CodegenTypes.Double,
|
|
188
|
+
startY: CodegenTypes.Double,
|
|
189
|
+
startWidth: CodegenTypes.Double,
|
|
190
|
+
startHeight: CodegenTypes.Double,
|
|
191
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
192
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
193
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
194
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
195
|
+
startCurveCode: CodegenTypes.Int32,
|
|
196
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
197
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
198
|
+
startContentScale: CodegenTypes.Double,
|
|
199
|
+
x: CodegenTypes.Double,
|
|
200
|
+
y: CodegenTypes.Double,
|
|
201
|
+
width: CodegenTypes.Double,
|
|
202
|
+
height: CodegenTypes.Double,
|
|
203
|
+
topLeftRadius: CodegenTypes.Double,
|
|
204
|
+
topRightRadius: CodegenTypes.Double,
|
|
205
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
206
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
207
|
+
curveCode: CodegenTypes.Int32,
|
|
208
|
+
contentTranslateX: CodegenTypes.Double,
|
|
209
|
+
contentTranslateY: CodegenTypes.Double,
|
|
210
|
+
contentScale: CodegenTypes.Double,
|
|
211
|
+
mass: CodegenTypes.Double,
|
|
212
|
+
stiffness: CodegenTypes.Double,
|
|
213
|
+
damping: CodegenTypes.Double,
|
|
214
|
+
initialVelocity: CodegenTypes.Double,
|
|
215
|
+
inheritVelocity: boolean,
|
|
216
|
+
reduceMotion: CodegenTypes.Int32
|
|
217
|
+
): CodegenTypes.Int32;
|
|
75
218
|
animateKeyframes(
|
|
76
219
|
driverId: CodegenTypes.Double,
|
|
77
220
|
hasInteractiveStart: boolean,
|
|
@@ -93,12 +236,144 @@ export interface Spec extends TurboModule {
|
|
|
93
236
|
frames: ReadonlyArray<CodegenTypes.Double>,
|
|
94
237
|
reduceMotion: CodegenTypes.Int32
|
|
95
238
|
): CodegenTypes.Int32;
|
|
239
|
+
animateKeyframesV2(
|
|
240
|
+
driverId: CodegenTypes.Double,
|
|
241
|
+
hasInteractiveStart: boolean,
|
|
242
|
+
startX: CodegenTypes.Double,
|
|
243
|
+
startY: CodegenTypes.Double,
|
|
244
|
+
startWidth: CodegenTypes.Double,
|
|
245
|
+
startHeight: CodegenTypes.Double,
|
|
246
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
247
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
248
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
249
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
250
|
+
startCurveCode: CodegenTypes.Int32,
|
|
251
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
252
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
253
|
+
startContentScale: CodegenTypes.Double,
|
|
254
|
+
x: CodegenTypes.Double,
|
|
255
|
+
y: CodegenTypes.Double,
|
|
256
|
+
width: CodegenTypes.Double,
|
|
257
|
+
height: CodegenTypes.Double,
|
|
258
|
+
topLeftRadius: CodegenTypes.Double,
|
|
259
|
+
topRightRadius: CodegenTypes.Double,
|
|
260
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
261
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
262
|
+
curveCode: CodegenTypes.Int32,
|
|
263
|
+
contentTranslateX: CodegenTypes.Double,
|
|
264
|
+
contentTranslateY: CodegenTypes.Double,
|
|
265
|
+
contentScale: CodegenTypes.Double,
|
|
266
|
+
durationMs: CodegenTypes.Double,
|
|
267
|
+
frames: ReadonlyArray<CodegenTypes.Double>,
|
|
268
|
+
reduceMotion: CodegenTypes.Int32
|
|
269
|
+
): CodegenTypes.Int32;
|
|
270
|
+
animateTimingFromV2(
|
|
271
|
+
driverId: CodegenTypes.Double,
|
|
272
|
+
startX: CodegenTypes.Double,
|
|
273
|
+
startY: CodegenTypes.Double,
|
|
274
|
+
startWidth: CodegenTypes.Double,
|
|
275
|
+
startHeight: CodegenTypes.Double,
|
|
276
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
277
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
278
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
279
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
280
|
+
startCurveCode: CodegenTypes.Int32,
|
|
281
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
282
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
283
|
+
startContentScale: CodegenTypes.Double,
|
|
284
|
+
x: CodegenTypes.Double,
|
|
285
|
+
y: CodegenTypes.Double,
|
|
286
|
+
width: CodegenTypes.Double,
|
|
287
|
+
height: CodegenTypes.Double,
|
|
288
|
+
topLeftRadius: CodegenTypes.Double,
|
|
289
|
+
topRightRadius: CodegenTypes.Double,
|
|
290
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
291
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
292
|
+
curveCode: CodegenTypes.Int32,
|
|
293
|
+
contentTranslateX: CodegenTypes.Double,
|
|
294
|
+
contentTranslateY: CodegenTypes.Double,
|
|
295
|
+
contentScale: CodegenTypes.Double,
|
|
296
|
+
durationMs: CodegenTypes.Double,
|
|
297
|
+
controlPoint1X: CodegenTypes.Double,
|
|
298
|
+
controlPoint1Y: CodegenTypes.Double,
|
|
299
|
+
controlPoint2X: CodegenTypes.Double,
|
|
300
|
+
controlPoint2Y: CodegenTypes.Double,
|
|
301
|
+
reduceMotion: CodegenTypes.Int32
|
|
302
|
+
): CodegenTypes.Int32;
|
|
303
|
+
animateSpringFromV2(
|
|
304
|
+
driverId: CodegenTypes.Double,
|
|
305
|
+
startX: CodegenTypes.Double,
|
|
306
|
+
startY: CodegenTypes.Double,
|
|
307
|
+
startWidth: CodegenTypes.Double,
|
|
308
|
+
startHeight: CodegenTypes.Double,
|
|
309
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
310
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
311
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
312
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
313
|
+
startCurveCode: CodegenTypes.Int32,
|
|
314
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
315
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
316
|
+
startContentScale: CodegenTypes.Double,
|
|
317
|
+
x: CodegenTypes.Double,
|
|
318
|
+
y: CodegenTypes.Double,
|
|
319
|
+
width: CodegenTypes.Double,
|
|
320
|
+
height: CodegenTypes.Double,
|
|
321
|
+
topLeftRadius: CodegenTypes.Double,
|
|
322
|
+
topRightRadius: CodegenTypes.Double,
|
|
323
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
324
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
325
|
+
curveCode: CodegenTypes.Int32,
|
|
326
|
+
contentTranslateX: CodegenTypes.Double,
|
|
327
|
+
contentTranslateY: CodegenTypes.Double,
|
|
328
|
+
contentScale: CodegenTypes.Double,
|
|
329
|
+
mass: CodegenTypes.Double,
|
|
330
|
+
stiffness: CodegenTypes.Double,
|
|
331
|
+
damping: CodegenTypes.Double,
|
|
332
|
+
initialVelocity: CodegenTypes.Double,
|
|
333
|
+
inheritVelocity: boolean,
|
|
334
|
+
reduceMotion: CodegenTypes.Int32
|
|
335
|
+
): CodegenTypes.Int32;
|
|
336
|
+
animateKeyframesFromV2(
|
|
337
|
+
driverId: CodegenTypes.Double,
|
|
338
|
+
startX: CodegenTypes.Double,
|
|
339
|
+
startY: CodegenTypes.Double,
|
|
340
|
+
startWidth: CodegenTypes.Double,
|
|
341
|
+
startHeight: CodegenTypes.Double,
|
|
342
|
+
startTopLeftRadius: CodegenTypes.Double,
|
|
343
|
+
startTopRightRadius: CodegenTypes.Double,
|
|
344
|
+
startBottomRightRadius: CodegenTypes.Double,
|
|
345
|
+
startBottomLeftRadius: CodegenTypes.Double,
|
|
346
|
+
startCurveCode: CodegenTypes.Int32,
|
|
347
|
+
startContentTranslateX: CodegenTypes.Double,
|
|
348
|
+
startContentTranslateY: CodegenTypes.Double,
|
|
349
|
+
startContentScale: CodegenTypes.Double,
|
|
350
|
+
x: CodegenTypes.Double,
|
|
351
|
+
y: CodegenTypes.Double,
|
|
352
|
+
width: CodegenTypes.Double,
|
|
353
|
+
height: CodegenTypes.Double,
|
|
354
|
+
topLeftRadius: CodegenTypes.Double,
|
|
355
|
+
topRightRadius: CodegenTypes.Double,
|
|
356
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
357
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
358
|
+
curveCode: CodegenTypes.Int32,
|
|
359
|
+
contentTranslateX: CodegenTypes.Double,
|
|
360
|
+
contentTranslateY: CodegenTypes.Double,
|
|
361
|
+
contentScale: CodegenTypes.Double,
|
|
362
|
+
durationMs: CodegenTypes.Double,
|
|
363
|
+
frames: ReadonlyArray<CodegenTypes.Double>,
|
|
364
|
+
reduceMotion: CodegenTypes.Int32
|
|
365
|
+
): CodegenTypes.Int32;
|
|
96
366
|
rejectAnimation(driverId: CodegenTypes.Double): CodegenTypes.Int32;
|
|
97
367
|
cancelAnimation(
|
|
98
368
|
driverId: CodegenTypes.Double,
|
|
99
369
|
animationId: CodegenTypes.Int32,
|
|
100
370
|
behavior: CodegenTypes.Int32
|
|
101
371
|
): ReadonlyArray<CodegenTypes.Double>;
|
|
372
|
+
cancelAnimationV2(
|
|
373
|
+
driverId: CodegenTypes.Double,
|
|
374
|
+
animationId: CodegenTypes.Int32,
|
|
375
|
+
behavior: CodegenTypes.Int32
|
|
376
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
102
377
|
destroyDriver(driverId: CodegenTypes.Double): void;
|
|
103
378
|
}
|
|
104
379
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { forwardRef, type ComponentRef, type ReactNode } from 'react';
|
|
2
2
|
import { type ViewProps } from 'react-native';
|
|
3
3
|
import type { SmoothClipDriver } from './driverTypes';
|
|
4
4
|
import { getDriverState } from './driverState';
|
|
5
|
+
import { getSmoothClipCapabilities } from './capabilities';
|
|
6
|
+
import { canonicalizeClipPresentation } from './geometry';
|
|
7
|
+
import { assertInitialPresentationProtocol } from './presentationProtocol';
|
|
5
8
|
import NativeSmoothClipView, {
|
|
6
9
|
type NativeProps,
|
|
7
10
|
} from './SmoothClipViewNativeComponent';
|
|
@@ -11,13 +14,20 @@ export type SmoothClipViewProps = ViewProps & {
|
|
|
11
14
|
children?: ReactNode;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
export const SmoothClipView = forwardRef<
|
|
18
|
+
ComponentRef<typeof NativeSmoothClipView>,
|
|
19
|
+
SmoothClipViewProps
|
|
20
|
+
>(function SmoothClipViewComponent(
|
|
21
|
+
{ driver, children, ...viewProps },
|
|
22
|
+
forwardedRef
|
|
23
|
+
) {
|
|
19
24
|
const { driverId, initialPresentation } = getDriverState(driver);
|
|
20
|
-
const
|
|
25
|
+
const canonical = canonicalizeClipPresentation(initialPresentation);
|
|
26
|
+
if (canonical === null) return null;
|
|
27
|
+
const { clip } = canonical;
|
|
28
|
+
const protocolVersion =
|
|
29
|
+
getSmoothClipCapabilities().presentationProtocolVersion;
|
|
30
|
+
assertInitialPresentationProtocol(canonical, protocolVersion);
|
|
21
31
|
const nativeProps: NativeProps = {
|
|
22
32
|
...viewProps,
|
|
23
33
|
driverId,
|
|
@@ -26,11 +36,20 @@ export function SmoothClipView({
|
|
|
26
36
|
initialClipWidth: clip.width,
|
|
27
37
|
initialClipHeight: clip.height,
|
|
28
38
|
initialClipRadius: clip.radius,
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
presentationVersion: protocolVersion,
|
|
40
|
+
initialClipTopLeftRadius: clip.topLeftRadius,
|
|
41
|
+
initialClipTopRightRadius: clip.topRightRadius,
|
|
42
|
+
initialClipBottomRightRadius: clip.bottomRightRadius,
|
|
43
|
+
initialClipBottomLeftRadius: clip.bottomLeftRadius,
|
|
44
|
+
initialClipCurve: clip.curve === 'continuous' ? 1 : 0,
|
|
45
|
+
initialContentTranslateX: canonical.contentTranslateX,
|
|
46
|
+
initialContentTranslateY: canonical.contentTranslateY,
|
|
47
|
+
initialContentScale: canonical.contentScale,
|
|
31
48
|
};
|
|
32
49
|
|
|
33
50
|
return (
|
|
34
|
-
<NativeSmoothClipView {...nativeProps}>
|
|
51
|
+
<NativeSmoothClipView ref={forwardedRef} {...nativeProps}>
|
|
52
|
+
{children}
|
|
53
|
+
</NativeSmoothClipView>
|
|
35
54
|
);
|
|
36
|
-
}
|
|
55
|
+
});
|
package/src/SmoothClipView.tsx
CHANGED
|
@@ -1,76 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { type ViewProps } from 'react-native';
|
|
4
|
-
import Animated, {
|
|
5
|
-
dispatchCommand,
|
|
6
|
-
useAnimatedReaction,
|
|
7
|
-
useAnimatedRef,
|
|
8
|
-
} from 'react-native-reanimated';
|
|
9
|
-
import type { SmoothClipDriver } from './driverTypes';
|
|
10
|
-
import { getDriverState, registerDriverView } from './driverState';
|
|
11
|
-
import { clipPresentationEquals, isFiniteClipPresentation } from './geometry';
|
|
12
|
-
import NativeSmoothClipView, {
|
|
13
|
-
type NativeProps,
|
|
14
|
-
} from './SmoothClipViewNativeComponent';
|
|
15
|
-
|
|
16
|
-
const AnimatedNativeSmoothClipView =
|
|
17
|
-
Animated.createAnimatedComponent(NativeSmoothClipView);
|
|
18
|
-
|
|
19
|
-
export type SmoothClipViewProps = ViewProps & {
|
|
20
|
-
driver: SmoothClipDriver;
|
|
21
|
-
children?: ReactNode;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/** Android fallback. iOS resolves SmoothClipView.ios.tsx instead. */
|
|
25
|
-
export function SmoothClipView({
|
|
26
|
-
driver,
|
|
27
|
-
children,
|
|
28
|
-
...viewProps
|
|
29
|
-
}: SmoothClipViewProps) {
|
|
30
|
-
const { driverId, initialPresentation, source } = getDriverState(driver);
|
|
31
|
-
const { clip } = initialPresentation;
|
|
32
|
-
useEffect(() => registerDriverView(driver), [driver]);
|
|
33
|
-
const nativeRef =
|
|
34
|
-
useAnimatedRef<React.ComponentRef<typeof NativeSmoothClipView>>();
|
|
35
|
-
|
|
36
|
-
useAnimatedReaction(
|
|
37
|
-
() => source.value,
|
|
38
|
-
(presentation, previousPresentation) => {
|
|
39
|
-
if (
|
|
40
|
-
!isFiniteClipPresentation(presentation) ||
|
|
41
|
-
clipPresentationEquals(previousPresentation, presentation)
|
|
42
|
-
) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
dispatchCommand(nativeRef, 'setClipPresentation', [
|
|
47
|
-
presentation.clip.x,
|
|
48
|
-
presentation.clip.y,
|
|
49
|
-
presentation.clip.width,
|
|
50
|
-
presentation.clip.height,
|
|
51
|
-
presentation.clip.radius,
|
|
52
|
-
presentation.contentTranslateX,
|
|
53
|
-
presentation.contentTranslateY,
|
|
54
|
-
]);
|
|
55
|
-
},
|
|
56
|
-
[nativeRef, source]
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const nativeProps: NativeProps = {
|
|
60
|
-
...viewProps,
|
|
61
|
-
driverId,
|
|
62
|
-
initialClipX: clip.x,
|
|
63
|
-
initialClipY: clip.y,
|
|
64
|
-
initialClipWidth: clip.width,
|
|
65
|
-
initialClipHeight: clip.height,
|
|
66
|
-
initialClipRadius: clip.radius,
|
|
67
|
-
initialContentTranslateX: initialPresentation.contentTranslateX,
|
|
68
|
-
initialContentTranslateY: initialPresentation.contentTranslateY,
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<AnimatedNativeSmoothClipView ref={nativeRef} {...nativeProps}>
|
|
73
|
-
{children}
|
|
74
|
-
</AnimatedNativeSmoothClipView>
|
|
75
|
-
);
|
|
76
|
-
}
|
|
1
|
+
export { SmoothClipView } from './SmoothClipView.ios';
|
|
2
|
+
export type { SmoothClipViewProps } from './SmoothClipView.ios';
|
|
@@ -13,8 +13,15 @@ export interface NativeProps extends ViewProps {
|
|
|
13
13
|
initialClipWidth: CodegenTypes.Double;
|
|
14
14
|
initialClipHeight: CodegenTypes.Double;
|
|
15
15
|
initialClipRadius: CodegenTypes.Double;
|
|
16
|
+
presentationVersion: CodegenTypes.Int32;
|
|
17
|
+
initialClipTopLeftRadius: CodegenTypes.Double;
|
|
18
|
+
initialClipTopRightRadius: CodegenTypes.Double;
|
|
19
|
+
initialClipBottomRightRadius: CodegenTypes.Double;
|
|
20
|
+
initialClipBottomLeftRadius: CodegenTypes.Double;
|
|
21
|
+
initialClipCurve: CodegenTypes.Int32;
|
|
16
22
|
initialContentTranslateX: CodegenTypes.Double;
|
|
17
23
|
initialContentTranslateY: CodegenTypes.Double;
|
|
24
|
+
initialContentScale: CodegenTypes.Double;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
interface NativeCommands {
|
|
@@ -36,10 +43,29 @@ interface NativeCommands {
|
|
|
36
43
|
contentTranslateX: CodegenTypes.Double,
|
|
37
44
|
contentTranslateY: CodegenTypes.Double
|
|
38
45
|
) => void;
|
|
46
|
+
setClipPresentationV2: (
|
|
47
|
+
viewRef: React.ElementRef<HostComponent<NativeProps>>,
|
|
48
|
+
x: CodegenTypes.Double,
|
|
49
|
+
y: CodegenTypes.Double,
|
|
50
|
+
width: CodegenTypes.Double,
|
|
51
|
+
height: CodegenTypes.Double,
|
|
52
|
+
topLeftRadius: CodegenTypes.Double,
|
|
53
|
+
topRightRadius: CodegenTypes.Double,
|
|
54
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
55
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
56
|
+
curveCode: CodegenTypes.Int32,
|
|
57
|
+
contentTranslateX: CodegenTypes.Double,
|
|
58
|
+
contentTranslateY: CodegenTypes.Double,
|
|
59
|
+
contentScale: CodegenTypes.Double
|
|
60
|
+
) => void;
|
|
39
61
|
}
|
|
40
62
|
|
|
41
63
|
export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
|
|
42
|
-
supportedCommands: [
|
|
64
|
+
supportedCommands: [
|
|
65
|
+
'setClipGeometry',
|
|
66
|
+
'setClipPresentation',
|
|
67
|
+
'setClipPresentationV2',
|
|
68
|
+
],
|
|
43
69
|
});
|
|
44
70
|
|
|
45
71
|
export default codegenNativeComponent<NativeProps>(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import NativeSmoothClipModule from './smoothClipNative';
|
|
2
|
+
import {
|
|
3
|
+
SMOOTH_CLIP_V1_CAPABILITIES,
|
|
4
|
+
type SmoothClipCapabilities,
|
|
5
|
+
} from './capabilityTypes';
|
|
6
|
+
|
|
7
|
+
type VersionedModule = typeof NativeSmoothClipModule & {
|
|
8
|
+
getPresentationProtocolVersion?: () => number;
|
|
9
|
+
supportsAutonomousComplexPathAnimation?: () => boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let cached: SmoothClipCapabilities | undefined;
|
|
13
|
+
|
|
14
|
+
export function getSmoothClipCapabilities(): SmoothClipCapabilities {
|
|
15
|
+
if (cached) return cached;
|
|
16
|
+
const module = NativeSmoothClipModule as VersionedModule;
|
|
17
|
+
let version = 1;
|
|
18
|
+
try {
|
|
19
|
+
version = module.getPresentationProtocolVersion?.() === 2 ? 2 : 1;
|
|
20
|
+
} catch {
|
|
21
|
+
version = 1;
|
|
22
|
+
}
|
|
23
|
+
if (version !== 2) {
|
|
24
|
+
cached = SMOOTH_CLIP_V1_CAPABILITIES;
|
|
25
|
+
return cached;
|
|
26
|
+
}
|
|
27
|
+
let autonomousComplexPathAnimation = false;
|
|
28
|
+
try {
|
|
29
|
+
autonomousComplexPathAnimation =
|
|
30
|
+
module.supportsAutonomousComplexPathAnimation?.() === true;
|
|
31
|
+
} catch {
|
|
32
|
+
autonomousComplexPathAnimation = false;
|
|
33
|
+
}
|
|
34
|
+
const groups =
|
|
35
|
+
typeof (
|
|
36
|
+
module as Partial<{
|
|
37
|
+
beginGroupInteractionV2: unknown;
|
|
38
|
+
snapshotGroupV2: unknown;
|
|
39
|
+
setClipPresentationBatchV2: unknown;
|
|
40
|
+
animateTimingGroupV2: unknown;
|
|
41
|
+
animateSpringGroupV2: unknown;
|
|
42
|
+
animateKeyframesGroupV2: unknown;
|
|
43
|
+
cancelAnimationGroupV2: unknown;
|
|
44
|
+
}>
|
|
45
|
+
).beginGroupInteractionV2 === 'function' &&
|
|
46
|
+
typeof (module as Partial<{ snapshotGroupV2: unknown }>).snapshotGroupV2 ===
|
|
47
|
+
'function' &&
|
|
48
|
+
typeof (module as Partial<{ setClipPresentationBatchV2: unknown }>)
|
|
49
|
+
.setClipPresentationBatchV2 === 'function' &&
|
|
50
|
+
typeof (module as Partial<{ animateTimingGroupV2: unknown }>)
|
|
51
|
+
.animateTimingGroupV2 === 'function' &&
|
|
52
|
+
typeof (module as Partial<{ animateSpringGroupV2: unknown }>)
|
|
53
|
+
.animateSpringGroupV2 === 'function' &&
|
|
54
|
+
typeof (module as Partial<{ animateKeyframesGroupV2: unknown }>)
|
|
55
|
+
.animateKeyframesGroupV2 === 'function' &&
|
|
56
|
+
typeof (module as Partial<{ cancelAnimationGroupV2: unknown }>)
|
|
57
|
+
.cancelAnimationGroupV2 === 'function' &&
|
|
58
|
+
typeof (module as Partial<{ onClipGroupAnimationComplete: unknown }>)
|
|
59
|
+
.onClipGroupAnimationComplete === 'function';
|
|
60
|
+
cached = {
|
|
61
|
+
presentationProtocolVersion: 2,
|
|
62
|
+
groups,
|
|
63
|
+
perCornerRadii: true,
|
|
64
|
+
continuousCurve: true,
|
|
65
|
+
contentScale: true,
|
|
66
|
+
autonomousComplexPathAnimation,
|
|
67
|
+
};
|
|
68
|
+
return cached;
|
|
69
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type SmoothClipCapabilities = Readonly<{
|
|
2
|
+
presentationProtocolVersion: 1 | 2;
|
|
3
|
+
groups: boolean;
|
|
4
|
+
perCornerRadii: boolean;
|
|
5
|
+
continuousCurve: boolean;
|
|
6
|
+
contentScale: boolean;
|
|
7
|
+
autonomousComplexPathAnimation: boolean;
|
|
8
|
+
}>;
|
|
9
|
+
|
|
10
|
+
export const SMOOTH_CLIP_V1_CAPABILITIES: SmoothClipCapabilities = {
|
|
11
|
+
presentationProtocolVersion: 1,
|
|
12
|
+
groups: false,
|
|
13
|
+
perCornerRadii: false,
|
|
14
|
+
continuousCurve: false,
|
|
15
|
+
contentScale: false,
|
|
16
|
+
autonomousComplexPathAnimation: false,
|
|
17
|
+
};
|
package/src/driverState.ts
CHANGED
|
@@ -8,12 +8,10 @@ export type DriverState = {
|
|
|
8
8
|
source: SharedValue<SmoothClipPresentation>;
|
|
9
9
|
activeAnimationId?: SharedValue<number>;
|
|
10
10
|
ownership?: SharedValue<number>;
|
|
11
|
+
ready?: SharedValue<number>;
|
|
11
12
|
onAnimationComplete: {
|
|
12
13
|
current: ((result: ClipAnimationResult) => void) | undefined;
|
|
13
14
|
};
|
|
14
|
-
mountedViews: Set<object>;
|
|
15
|
-
animationParticipants: Map<number, Set<object>>;
|
|
16
|
-
failedAnimations: Set<number>;
|
|
17
15
|
completionDeferrals: number;
|
|
18
16
|
deferredCompletions: ClipAnimationResult[];
|
|
19
17
|
};
|
|
@@ -73,49 +71,11 @@ export function createDriverState(
|
|
|
73
71
|
activeAnimationId,
|
|
74
72
|
ownership,
|
|
75
73
|
onAnimationComplete,
|
|
76
|
-
mountedViews: new Set(),
|
|
77
|
-
animationParticipants: new Map(),
|
|
78
|
-
failedAnimations: new Set(),
|
|
79
74
|
completionDeferrals: 0,
|
|
80
75
|
deferredCompletions: [],
|
|
81
76
|
};
|
|
82
77
|
}
|
|
83
78
|
|
|
84
|
-
export function registerDriverView(driver: SmoothClipDriver): () => void {
|
|
85
|
-
const state = getDriverState(driver);
|
|
86
|
-
const token = {};
|
|
87
|
-
state.mountedViews.add(token);
|
|
88
|
-
return () => {
|
|
89
|
-
state.mountedViews.delete(token);
|
|
90
|
-
for (const [animationId, participants] of state.animationParticipants) {
|
|
91
|
-
if (participants.has(token)) state.failedAnimations.add(animationId);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function snapshotDriverViews(
|
|
97
|
-
driverId: number,
|
|
98
|
-
animationId: number
|
|
99
|
-
): void {
|
|
100
|
-
const state = statesById.get(driverId);
|
|
101
|
-
if (state) {
|
|
102
|
-
state.animationParticipants.set(animationId, new Set(state.mountedViews));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export function finishDriverAnimation(
|
|
107
|
-
driverId: number,
|
|
108
|
-
animationId: number,
|
|
109
|
-
finished: boolean
|
|
110
|
-
): boolean {
|
|
111
|
-
const state = statesById.get(driverId);
|
|
112
|
-
if (!state) return finished;
|
|
113
|
-
const result = finished && !state.failedAnimations.has(animationId);
|
|
114
|
-
state.animationParticipants.delete(animationId);
|
|
115
|
-
state.failedAnimations.delete(animationId);
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
79
|
export function deliverDriverCompletion(
|
|
120
80
|
driverId: number,
|
|
121
81
|
animationId: number,
|