react-native-smooth-clip-view 0.2.9 → 0.4.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 +132 -349
- package/android/build.gradle +8 -4
- package/android/proguard-rules.pro +3 -3
- package/android/src/main/cpp/SmoothClipAndroid.h +13 -6
- package/android/src/main/cpp/SmoothClipBindings.cpp +605 -123
- package/android/src/main/cpp/SmoothClipRegistry.cpp +975 -209
- package/android/src/main/java/com/smoothclipview/ClipGeometryNormalizer.kt +192 -118
- package/android/src/main/java/com/smoothclipview/SmoothClipBindings.kt +22 -4
- package/android/src/main/java/com/smoothclipview/SmoothClipModule.kt +81 -56
- package/android/src/main/java/com/smoothclipview/SmoothClipView.kt +449 -240
- package/android/src/main/java/com/smoothclipview/SmoothClipViewManager.kt +150 -38
- package/cpp/SmoothClipAnimationCurve.h +317 -397
- package/cpp/SmoothClipRegistry.h +84 -20
- package/cpp/SmoothClipSharedGeometry.h +131 -22
- package/cpp/SmoothClipVelocityTracker.h +16 -12
- package/ios/SmoothClipGeometry.h +188 -21
- package/ios/SmoothClipRegistry.mm +869 -368
- package/ios/SmoothClipRegistrySnapshot.h +13 -0
- package/ios/SmoothClipTurboModule.cpp +513 -156
- package/ios/SmoothClipTurboModule.h +123 -56
- package/ios/SmoothClipView.mm +1074 -449
- package/ios/SmoothClipViewRegistry.h +3 -7
- 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 +94 -11
- 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 +32 -12
- package/lib/module/capabilities.js +4 -0
- package/lib/module/capabilities.js.map +1 -0
- package/lib/module/capabilities.native.js +18 -0
- package/lib/module/capabilities.native.js.map +1 -0
- package/lib/module/capabilityTypes.js +2 -0
- package/lib/module/capabilityTypes.js.map +1 -0
- package/lib/module/controllerInternals.js +28 -0
- package/lib/module/controllerInternals.js.map +1 -0
- package/lib/module/controllerLifecycle.js +9 -0
- package/lib/module/controllerLifecycle.js.map +1 -0
- package/lib/module/controllerTypes.js +4 -0
- package/lib/module/controllerTypes.js.map +1 -0
- package/lib/module/controllers.android.js +4 -0
- package/lib/module/controllers.android.js.map +1 -0
- package/lib/module/controllers.ios.js +4 -0
- package/lib/module/controllers.ios.js.map +1 -0
- package/lib/module/controllers.js +4 -0
- package/lib/module/controllers.js.map +1 -0
- package/lib/module/controllers.native.js +89 -0
- package/lib/module/controllers.native.js.map +1 -0
- package/lib/module/geometry.js +180 -30
- package/lib/module/geometry.js.map +1 -1
- package/lib/module/groupTypes.js +4 -0
- package/lib/module/groupTypes.js.map +1 -0
- package/lib/module/groups.android.js +4 -0
- package/lib/module/groups.android.js.map +1 -0
- package/lib/module/groups.ios.js +4 -0
- package/lib/module/groups.ios.js.map +1 -0
- package/lib/module/groups.js +4 -0
- package/lib/module/groups.js.map +1 -0
- package/lib/module/groups.native.js +399 -0
- package/lib/module/groups.native.js.map +1 -0
- package/lib/module/ids.js +8 -0
- package/lib/module/ids.js.map +1 -0
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeCompletion.js +37 -16
- package/lib/module/nativeCompletion.js.map +1 -1
- package/lib/module/presentationCodec.js +81 -0
- package/lib/module/presentationCodec.js.map +1 -0
- package/lib/typescript/src/NativeSmoothClipModule.d.ts +20 -4
- 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 +139 -4
- package/lib/typescript/src/SmoothClipView.ios.d.ts.map +1 -1
- package/lib/typescript/src/SmoothClipViewNativeComponent.d.ts +16 -3
- 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 +4 -0
- package/lib/typescript/src/capabilityTypes.d.ts.map +1 -0
- package/lib/typescript/src/controllerInternals.d.ts +14 -0
- package/lib/typescript/src/controllerInternals.d.ts.map +1 -0
- package/lib/typescript/src/controllerLifecycle.d.ts +3 -0
- package/lib/typescript/src/controllerLifecycle.d.ts.map +1 -0
- package/lib/typescript/src/controllerTypes.d.ts +62 -0
- package/lib/typescript/src/controllerTypes.d.ts.map +1 -0
- package/lib/typescript/src/controllers.android.d.ts +2 -0
- package/lib/typescript/src/controllers.android.d.ts.map +1 -0
- package/lib/typescript/src/controllers.d.ts +2 -0
- package/lib/typescript/src/controllers.d.ts.map +1 -0
- package/lib/typescript/src/controllers.ios.d.ts +2 -0
- package/lib/typescript/src/controllers.ios.d.ts.map +1 -0
- package/lib/typescript/src/controllers.native.d.ts +3 -0
- package/lib/typescript/src/controllers.native.d.ts.map +1 -0
- package/lib/typescript/src/geometry.d.ts +49 -5
- package/lib/typescript/src/geometry.d.ts.map +1 -1
- package/lib/typescript/src/groupTypes.d.ts +31 -0
- package/lib/typescript/src/groupTypes.d.ts.map +1 -0
- package/lib/typescript/src/groups.android.d.ts +2 -0
- package/lib/typescript/src/groups.android.d.ts.map +1 -0
- package/lib/typescript/src/groups.d.ts +2 -0
- package/lib/typescript/src/groups.d.ts.map +1 -0
- package/lib/typescript/src/groups.ios.d.ts +2 -0
- package/lib/typescript/src/groups.ios.d.ts.map +1 -0
- package/lib/typescript/src/groups.native.d.ts +3 -0
- package/lib/typescript/src/groups.native.d.ts.map +1 -0
- package/lib/typescript/src/ids.d.ts +2 -0
- package/lib/typescript/src/ids.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -5
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/nativeCompletion.d.ts +16 -6
- package/lib/typescript/src/nativeCompletion.d.ts.map +1 -1
- package/lib/typescript/src/presentationCodec.d.ts +10 -0
- package/lib/typescript/src/presentationCodec.d.ts.map +1 -0
- package/package.json +17 -13
- package/src/NativeSmoothClipModule.ts +80 -56
- package/src/SmoothClipView.ios.tsx +142 -16
- package/src/SmoothClipView.tsx +6 -76
- package/src/SmoothClipViewNativeComponent.ts +32 -12
- package/src/capabilities.native.ts +19 -0
- package/src/capabilities.ts +2 -0
- package/src/capabilityTypes.ts +3 -0
- package/src/controllerInternals.ts +52 -0
- package/src/controllerLifecycle.ts +6 -0
- package/src/controllerTypes.ts +87 -0
- package/src/controllers.android.ts +1 -0
- package/src/controllers.ios.ts +1 -0
- package/src/controllers.native.ts +104 -0
- package/src/controllers.ts +1 -0
- package/src/geometry.ts +293 -45
- package/src/groupTypes.ts +53 -0
- package/src/groups.android.ts +1 -0
- package/src/groups.ios.ts +1 -0
- package/src/groups.native.ts +604 -0
- package/src/groups.ts +1 -0
- package/src/ids.ts +6 -0
- package/src/index.ts +32 -12
- package/src/nativeCompletion.ts +67 -32
- package/src/presentationCodec.ts +134 -0
- package/lib/module/SmoothClipView.web.js +0 -54
- package/lib/module/SmoothClipView.web.js.map +0 -1
- package/lib/module/driverState.js +0 -110
- package/lib/module/driverState.js.map +0 -1
- package/lib/module/driverTypes.js +0 -4
- package/lib/module/driverTypes.js.map +0 -1
- package/lib/module/drivers.android.js +0 -6
- package/lib/module/drivers.android.js.map +0 -1
- package/lib/module/drivers.ios.js +0 -6
- package/lib/module/drivers.ios.js.map +0 -1
- package/lib/module/drivers.js +0 -284
- package/lib/module/drivers.js.map +0 -1
- package/lib/module/drivers.native.js +0 -556
- package/lib/module/drivers.native.js.map +0 -1
- package/lib/module/index.web.js +0 -8
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/reactRequests.js +0 -56
- package/lib/module/reactRequests.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/driverState.d.ts +0 -31
- package/lib/typescript/src/driverState.d.ts.map +0 -1
- package/lib/typescript/src/driverTypes.d.ts +0 -107
- package/lib/typescript/src/driverTypes.d.ts.map +0 -1
- package/lib/typescript/src/drivers.android.d.ts +0 -3
- package/lib/typescript/src/drivers.android.d.ts.map +0 -1
- package/lib/typescript/src/drivers.d.ts +0 -5
- package/lib/typescript/src/drivers.d.ts.map +0 -1
- package/lib/typescript/src/drivers.ios.d.ts +0 -3
- package/lib/typescript/src/drivers.ios.d.ts.map +0 -1
- package/lib/typescript/src/drivers.native.d.ts +0 -5
- package/lib/typescript/src/drivers.native.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/reactRequests.d.ts +0 -9
- package/lib/typescript/src/reactRequests.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/driverState.ts +0 -158
- package/src/driverTypes.ts +0 -140
- package/src/drivers.android.ts +0 -8
- package/src/drivers.ios.ts +0 -8
- package/src/drivers.native.ts +0 -899
- package/src/drivers.ts +0 -427
- package/src/index.web.ts +0 -23
- package/src/reactRequests.ts +0 -76
- package/src/webClipPath.ts +0 -30
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SmoothClipAnimation, SmoothClipCompletion, SmoothClipReactRun, SmoothClipRef, SmoothClipRunHandle } from './controllerTypes.js';
|
|
2
|
+
import type { CanonicalSmoothClipPresentation, SmoothClipPresentation } from './geometry.js';
|
|
3
|
+
export type SmoothClipGroupFrame = Readonly<{
|
|
4
|
+
clip: SmoothClipRef;
|
|
5
|
+
frame: SmoothClipPresentation;
|
|
6
|
+
}>;
|
|
7
|
+
export type SmoothClipGroupTarget = Readonly<{
|
|
8
|
+
clip: SmoothClipRef;
|
|
9
|
+
target: SmoothClipPresentation;
|
|
10
|
+
}>;
|
|
11
|
+
export type SmoothClipGroupSnapshot = Readonly<{
|
|
12
|
+
clip: SmoothClipRef;
|
|
13
|
+
frame: CanonicalSmoothClipPresentation;
|
|
14
|
+
ready: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export type SmoothClipGroupOptions = Readonly<{
|
|
17
|
+
/** Stable React-runtime callback for UI- and React-runtime transactions. */
|
|
18
|
+
onAnimationComplete?: (result: SmoothClipCompletion) => void;
|
|
19
|
+
}>;
|
|
20
|
+
export type SmoothClipGroup = Readonly<{
|
|
21
|
+
ui: Readonly<{
|
|
22
|
+
setFrames(entries: readonly SmoothClipGroupFrame[]): void;
|
|
23
|
+
beginInteraction(clips: readonly SmoothClipRef[]): readonly SmoothClipGroupSnapshot[];
|
|
24
|
+
animateTo(entries: readonly SmoothClipGroupTarget[], animation: SmoothClipAnimation, completionTag?: number): SmoothClipRunHandle | null;
|
|
25
|
+
cancel(run: SmoothClipRunHandle): readonly SmoothClipGroupSnapshot[];
|
|
26
|
+
}>;
|
|
27
|
+
react: Readonly<{
|
|
28
|
+
animateTo(entries: readonly SmoothClipGroupTarget[], animation: SmoothClipAnimation): SmoothClipReactRun;
|
|
29
|
+
}>;
|
|
30
|
+
}>;
|
|
31
|
+
//# sourceMappingURL=groupTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groupTypes.d.ts","sourceRoot":"","sources":["../../../src/groupTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACpB,MAAM,sBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,+BAA+B,EAC/B,sBAAsB,EACvB,MAAM,eAAY,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,sBAAsB,CAAC;CAC/B,CAAC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IAC3C,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,sBAAsB,CAAC;CAChC,CAAC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,+BAA+B,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC9D,CAAC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,EAAE,EAAE,QAAQ,CAAC;QACX,SAAS,CAAC,OAAO,EAAE,SAAS,oBAAoB,EAAE,GAAG,IAAI,CAAC;QAC1D,gBAAgB,CACd,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,SAAS,uBAAuB,EAAE,CAAC;QACtC,SAAS,CACP,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,SAAS,EAAE,mBAAmB,EAC9B,aAAa,CAAC,EAAE,MAAM,GACrB,mBAAmB,GAAG,IAAI,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,mBAAmB,GAAG,SAAS,uBAAuB,EAAE,CAAC;KACtE,CAAC,CAAC;IACH,KAAK,EAAE,QAAQ,CAAC;QACd,SAAS,CACP,OAAO,EAAE,SAAS,qBAAqB,EAAE,EACzC,SAAS,EAAE,mBAAmB,GAC7B,kBAAkB,CAAC;KACvB,CAAC,CAAC;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.android.d.ts","sourceRoot":"","sources":["../../../src/groups.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.d.ts","sourceRoot":"","sources":["../../../src/groups.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.ios.d.ts","sourceRoot":"","sources":["../../../src/groups.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groups.native.d.ts","sourceRoot":"","sources":["../../../src/groups.native.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EAGvB,MAAM,iBAAc,CAAC;AAibtB,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,sBAA2B,GACnC,eAAe,CAiJjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ids.d.ts","sourceRoot":"","sources":["../../../src/ids.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export { SmoothClipView } from './SmoothClipView';
|
|
2
2
|
export type { SmoothClipViewProps } from './SmoothClipView';
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
3
|
+
export { useSmoothClipController } from './controllers';
|
|
4
|
+
export { useSmoothClipGroup } from './groups';
|
|
5
|
+
export { getSmoothClipCapabilities } from './capabilities';
|
|
6
|
+
export type { SmoothClipCapabilities } from './capabilityTypes.js';
|
|
7
|
+
export type { ClipReduceMotion, SpringClipAnimation, TimingClipAnimation, SmoothClipAnimation, SmoothClipCompletion, SmoothClipController, SmoothClipControllerOptions, SmoothClipControllerReact, SmoothClipControllerUI, SmoothClipInitialFrame, SmoothClipReactRun, SmoothClipRef, SmoothClipRunHandle, } from './controllerTypes.js';
|
|
8
|
+
export type { SmoothClipGroup, SmoothClipGroupFrame, SmoothClipGroupOptions, SmoothClipGroupSnapshot, SmoothClipGroupTarget, } from './groupTypes.js';
|
|
5
9
|
export { ClipEasings } from './easings.js';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export type { ClipBounds, ClipGeometry, SmoothClipPresentation, } from './geometry.js';
|
|
10
|
+
export { canonicalizeClipGeometry, canonicalizeClipPresentation, createClipPresentation, } from './geometry.js';
|
|
11
|
+
export type { CanonicalClipGeometry, CanonicalClipBoxShadow, CanonicalSmoothClipPresentation, ClipCurve, ClipGeometry, ClipBoxShadow, SmoothClipPresentation, } from './geometry.js';
|
|
9
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAmB,CAAC;AAChE,YAAY,EACV,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,sBAAmB,CAAC;AAC3B,YAAY,EACV,eAAe,EACf,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,iBAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAW,CAAC;AACxC,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,eAAY,CAAC;AACpB,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,+BAA+B,EAC/B,SAAS,EACT,YAAY,EACZ,aAAa,EACb,sBAAsB,GACvB,MAAM,eAAY,CAAC"}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
type DriverCompletion = Readonly<{
|
|
2
|
+
driverId: number;
|
|
3
|
+
animationId: number;
|
|
4
|
+
completionTag: number;
|
|
5
|
+
finished: boolean;
|
|
6
|
+
}>;
|
|
7
|
+
type GroupCompletion = Readonly<{
|
|
8
|
+
controllerId: number;
|
|
9
|
+
groupId: number;
|
|
10
|
+
completionTag: number;
|
|
11
|
+
finished: boolean;
|
|
12
|
+
snapshots: readonly number[];
|
|
13
|
+
}>;
|
|
14
|
+
export declare function subscribeDriverCompletion(driverId: number, listener: (event: DriverCompletion) => void): () => void;
|
|
15
|
+
export declare function subscribeGroupCompletion(controllerId: number, listener: (event: GroupCompletion) => void): () => void;
|
|
16
|
+
export {};
|
|
7
17
|
//# sourceMappingURL=nativeCompletion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeCompletion.d.ts","sourceRoot":"","sources":["../../../src/nativeCompletion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nativeCompletion.d.ts","sourceRoot":"","sources":["../../../src/nativeCompletion.ts"],"names":[],"mappings":"AAEA,KAAK,gBAAgB,GAAG,QAAQ,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,eAAe,GAAG,QAAQ,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAC;AA8BH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAC1C,MAAM,IAAI,CASZ;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GACzC,MAAM,IAAI,CASZ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CanonicalSmoothClipPresentation } from './geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Versionless native packet layout. Keep this as the single JS codec used by
|
|
4
|
+
* drivers, groups, snapshots, and cancellation.
|
|
5
|
+
*/
|
|
6
|
+
export declare const PRESENTATION_STRIDE = 21;
|
|
7
|
+
export declare function appendPresentationPacket(values: number[], presentation: CanonicalSmoothClipPresentation): void;
|
|
8
|
+
export declare function presentationPacket(presentation: CanonicalSmoothClipPresentation): number[];
|
|
9
|
+
export declare function presentationFromPacket(values: readonly number[], offset?: number): CanonicalSmoothClipPresentation | null;
|
|
10
|
+
//# sourceMappingURL=presentationCodec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presentationCodec.d.ts","sourceRoot":"","sources":["../../../src/presentationCodec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAY,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EAAE,EAChB,YAAY,EAAE,+BAA+B,GAC5C,IAAI,CAiCN;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,+BAA+B,GAC5C,MAAM,EAAE,CAKV;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,MAAM,SAAI,GACT,+BAA+B,GAAG,IAAI,CA0ExC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-smooth-clip-view",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"example": "npm run --workspace react-native-smooth-clip-view-example",
|
|
38
38
|
"clean": "del-cli lib",
|
|
39
|
+
"patch:legend-list": "patch-package",
|
|
39
40
|
"prepare": "bob build",
|
|
40
41
|
"typecheck": "tsc",
|
|
41
42
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
@@ -51,8 +52,7 @@
|
|
|
51
52
|
"clipping",
|
|
52
53
|
"fabric",
|
|
53
54
|
"ios",
|
|
54
|
-
"android"
|
|
55
|
-
"web"
|
|
55
|
+
"android"
|
|
56
56
|
],
|
|
57
57
|
"repository": {
|
|
58
58
|
"type": "git",
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
"@eslint/eslintrc": "^3.3.5",
|
|
76
76
|
"@eslint/js": "^9.39.4",
|
|
77
77
|
"@jest/globals": "^29.7.0",
|
|
78
|
-
"@react-native/babel-preset": "0.86.
|
|
79
|
-
"@react-native/eslint-config": "0.86.
|
|
80
|
-
"@react-native/jest-preset": "0.86.
|
|
81
|
-
"@react-native/metro-config": "0.86.
|
|
78
|
+
"@react-native/babel-preset": "0.86.2",
|
|
79
|
+
"@react-native/eslint-config": "0.86.2",
|
|
80
|
+
"@react-native/jest-preset": "0.86.2",
|
|
81
|
+
"@react-native/metro-config": "0.86.2",
|
|
82
82
|
"@release-it/conventional-changelog": "^11.0.1",
|
|
83
83
|
"@types/react": "^19.2.0",
|
|
84
84
|
"commitlint": "^21.0.2",
|
|
@@ -90,21 +90,22 @@
|
|
|
90
90
|
"hermes-eslint": "^0.37.0",
|
|
91
91
|
"jest": "^29.7.0",
|
|
92
92
|
"lefthook": "^2.1.9",
|
|
93
|
+
"patch-package": "^8.0.1",
|
|
93
94
|
"prettier": "^3.8.3",
|
|
94
95
|
"react": "19.2.3",
|
|
95
|
-
"react-native": "0.86.
|
|
96
|
+
"react-native": "0.86.2",
|
|
96
97
|
"react-native-builder-bob": "^0.43.0",
|
|
97
|
-
"react-native-reanimated": "4.5.
|
|
98
|
-
"react-native-worklets": "0.10.
|
|
98
|
+
"react-native-reanimated": "4.5.1",
|
|
99
|
+
"react-native-worklets": "0.10.4",
|
|
99
100
|
"release-it": "^20.2.0",
|
|
100
101
|
"turbo": "^2.9.16",
|
|
101
102
|
"typescript": "^6.0.3"
|
|
102
103
|
},
|
|
103
104
|
"peerDependencies": {
|
|
104
|
-
"react": "
|
|
105
|
+
"react": ">=19.2.0",
|
|
105
106
|
"react-native": ">=0.86.0",
|
|
106
107
|
"react-native-reanimated": ">=4.5.0",
|
|
107
|
-
"react-native-worklets": ">=0.10.
|
|
108
|
+
"react-native-worklets": ">=0.10.1"
|
|
108
109
|
},
|
|
109
110
|
"workspaces": [
|
|
110
111
|
"example"
|
|
@@ -166,7 +167,10 @@
|
|
|
166
167
|
"modulePathIgnorePatterns": [
|
|
167
168
|
"<rootDir>/example/node_modules",
|
|
168
169
|
"<rootDir>/lib/"
|
|
169
|
-
]
|
|
170
|
+
],
|
|
171
|
+
"moduleNameMapper": {
|
|
172
|
+
"^react-native-reanimated$": "<rootDir>/src/__mocks__/react-native-reanimated.ts"
|
|
173
|
+
}
|
|
170
174
|
},
|
|
171
175
|
"commitlint": {
|
|
172
176
|
"extends": [
|
|
@@ -6,92 +6,116 @@ export interface Spec extends TurboModule {
|
|
|
6
6
|
Readonly<{
|
|
7
7
|
driverId: CodegenTypes.Double;
|
|
8
8
|
animationId: CodegenTypes.Int32;
|
|
9
|
+
completionTag: CodegenTypes.Int32;
|
|
9
10
|
finished: boolean;
|
|
10
11
|
}>
|
|
11
12
|
>;
|
|
13
|
+
readonly onClipGroupAnimationComplete: CodegenTypes.EventEmitter<
|
|
14
|
+
Readonly<{
|
|
15
|
+
controllerId: CodegenTypes.Double;
|
|
16
|
+
groupId: CodegenTypes.Int32;
|
|
17
|
+
completionTag: CodegenTypes.Int32;
|
|
18
|
+
finished: boolean;
|
|
19
|
+
snapshots: ReadonlyArray<CodegenTypes.Double>;
|
|
20
|
+
}>
|
|
21
|
+
>;
|
|
22
|
+
supportsAutonomousComplexPathAnimation(): boolean;
|
|
23
|
+
beginGroupInteraction(
|
|
24
|
+
driverIds: ReadonlyArray<CodegenTypes.Double>
|
|
25
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
26
|
+
snapshotGroup(
|
|
27
|
+
driverIds: ReadonlyArray<CodegenTypes.Double>
|
|
28
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
29
|
+
setClipPresentationBatch(
|
|
30
|
+
entries: ReadonlyArray<CodegenTypes.Double>
|
|
31
|
+
): boolean;
|
|
32
|
+
animateTimingGroup(
|
|
33
|
+
controllerId: CodegenTypes.Double,
|
|
34
|
+
entries: ReadonlyArray<CodegenTypes.Double>,
|
|
35
|
+
durationMs: CodegenTypes.Double,
|
|
36
|
+
controlPoint1X: CodegenTypes.Double,
|
|
37
|
+
controlPoint1Y: CodegenTypes.Double,
|
|
38
|
+
controlPoint2X: CodegenTypes.Double,
|
|
39
|
+
controlPoint2Y: CodegenTypes.Double,
|
|
40
|
+
reduceMotion: CodegenTypes.Int32,
|
|
41
|
+
completionTag: CodegenTypes.Int32,
|
|
42
|
+
startTimestamp: CodegenTypes.Double
|
|
43
|
+
): CodegenTypes.Int32;
|
|
44
|
+
animateSpringGroup(
|
|
45
|
+
controllerId: CodegenTypes.Double,
|
|
46
|
+
entries: ReadonlyArray<CodegenTypes.Double>,
|
|
47
|
+
mass: CodegenTypes.Double,
|
|
48
|
+
stiffness: CodegenTypes.Double,
|
|
49
|
+
damping: CodegenTypes.Double,
|
|
50
|
+
velocity: CodegenTypes.Double,
|
|
51
|
+
energyThreshold: CodegenTypes.Double,
|
|
52
|
+
reduceMotion: CodegenTypes.Int32,
|
|
53
|
+
completionTag: CodegenTypes.Int32,
|
|
54
|
+
startTimestamp: CodegenTypes.Double
|
|
55
|
+
): CodegenTypes.Int32;
|
|
56
|
+
cancelAnimationGroup(
|
|
57
|
+
groupId: CodegenTypes.Int32,
|
|
58
|
+
behavior: CodegenTypes.Int32
|
|
59
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
12
60
|
setClipPresentation(
|
|
61
|
+
driverId: CodegenTypes.Double,
|
|
62
|
+
presentation: ReadonlyArray<CodegenTypes.Double>,
|
|
63
|
+
takeOwnership: boolean,
|
|
64
|
+
overridePendingAnimation: boolean
|
|
65
|
+
): void;
|
|
66
|
+
setClipFrameScalars(
|
|
13
67
|
driverId: CodegenTypes.Double,
|
|
14
68
|
x: CodegenTypes.Double,
|
|
15
69
|
y: CodegenTypes.Double,
|
|
16
70
|
width: CodegenTypes.Double,
|
|
17
71
|
height: CodegenTypes.Double,
|
|
18
|
-
|
|
72
|
+
topLeftRadius: CodegenTypes.Double,
|
|
73
|
+
topRightRadius: CodegenTypes.Double,
|
|
74
|
+
bottomRightRadius: CodegenTypes.Double,
|
|
75
|
+
bottomLeftRadius: CodegenTypes.Double,
|
|
76
|
+
curveCode: CodegenTypes.Int32,
|
|
19
77
|
contentTranslateX: CodegenTypes.Double,
|
|
20
78
|
contentTranslateY: CodegenTypes.Double,
|
|
21
|
-
|
|
22
|
-
|
|
79
|
+
contentScale: CodegenTypes.Double,
|
|
80
|
+
shadowEnabled: boolean,
|
|
81
|
+
shadowRed: CodegenTypes.Double,
|
|
82
|
+
shadowGreen: CodegenTypes.Double,
|
|
83
|
+
shadowBlue: CodegenTypes.Double,
|
|
84
|
+
shadowAlpha: CodegenTypes.Double,
|
|
85
|
+
shadowOffsetX: CodegenTypes.Double,
|
|
86
|
+
shadowOffsetY: CodegenTypes.Double,
|
|
87
|
+
shadowBlurRadius: CodegenTypes.Double,
|
|
88
|
+
shadowSpreadDistance: CodegenTypes.Double
|
|
23
89
|
): void;
|
|
24
90
|
beginInteraction(
|
|
25
91
|
driverId: CodegenTypes.Double
|
|
26
92
|
): ReadonlyArray<CodegenTypes.Double>;
|
|
93
|
+
snapshotCurrent(
|
|
94
|
+
driverId: CodegenTypes.Double
|
|
95
|
+
): ReadonlyArray<CodegenTypes.Double>;
|
|
27
96
|
animateTiming(
|
|
28
97
|
driverId: CodegenTypes.Double,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
startY: CodegenTypes.Double,
|
|
32
|
-
startWidth: CodegenTypes.Double,
|
|
33
|
-
startHeight: CodegenTypes.Double,
|
|
34
|
-
startRadius: CodegenTypes.Double,
|
|
35
|
-
startContentTranslateX: CodegenTypes.Double,
|
|
36
|
-
startContentTranslateY: CodegenTypes.Double,
|
|
37
|
-
x: CodegenTypes.Double,
|
|
38
|
-
y: CodegenTypes.Double,
|
|
39
|
-
width: CodegenTypes.Double,
|
|
40
|
-
height: CodegenTypes.Double,
|
|
41
|
-
radius: CodegenTypes.Double,
|
|
42
|
-
contentTranslateX: CodegenTypes.Double,
|
|
43
|
-
contentTranslateY: CodegenTypes.Double,
|
|
98
|
+
start: ReadonlyArray<CodegenTypes.Double>,
|
|
99
|
+
target: ReadonlyArray<CodegenTypes.Double>,
|
|
44
100
|
durationMs: CodegenTypes.Double,
|
|
45
101
|
controlPoint1X: CodegenTypes.Double,
|
|
46
102
|
controlPoint1Y: CodegenTypes.Double,
|
|
47
103
|
controlPoint2X: CodegenTypes.Double,
|
|
48
104
|
controlPoint2Y: CodegenTypes.Double,
|
|
49
|
-
reduceMotion: CodegenTypes.Int32
|
|
105
|
+
reduceMotion: CodegenTypes.Int32,
|
|
106
|
+
completionTag: CodegenTypes.Int32
|
|
50
107
|
): CodegenTypes.Int32;
|
|
51
108
|
animateSpring(
|
|
52
109
|
driverId: CodegenTypes.Double,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
startY: CodegenTypes.Double,
|
|
56
|
-
startWidth: CodegenTypes.Double,
|
|
57
|
-
startHeight: CodegenTypes.Double,
|
|
58
|
-
startRadius: CodegenTypes.Double,
|
|
59
|
-
startContentTranslateX: CodegenTypes.Double,
|
|
60
|
-
startContentTranslateY: CodegenTypes.Double,
|
|
61
|
-
x: CodegenTypes.Double,
|
|
62
|
-
y: CodegenTypes.Double,
|
|
63
|
-
width: CodegenTypes.Double,
|
|
64
|
-
height: CodegenTypes.Double,
|
|
65
|
-
radius: CodegenTypes.Double,
|
|
66
|
-
contentTranslateX: CodegenTypes.Double,
|
|
67
|
-
contentTranslateY: CodegenTypes.Double,
|
|
110
|
+
start: ReadonlyArray<CodegenTypes.Double>,
|
|
111
|
+
target: ReadonlyArray<CodegenTypes.Double>,
|
|
68
112
|
mass: CodegenTypes.Double,
|
|
69
113
|
stiffness: CodegenTypes.Double,
|
|
70
114
|
damping: CodegenTypes.Double,
|
|
71
115
|
initialVelocity: CodegenTypes.Double,
|
|
72
116
|
inheritVelocity: boolean,
|
|
73
|
-
reduceMotion: CodegenTypes.Int32
|
|
74
|
-
|
|
75
|
-
animateKeyframes(
|
|
76
|
-
driverId: CodegenTypes.Double,
|
|
77
|
-
hasInteractiveStart: boolean,
|
|
78
|
-
startX: CodegenTypes.Double,
|
|
79
|
-
startY: CodegenTypes.Double,
|
|
80
|
-
startWidth: CodegenTypes.Double,
|
|
81
|
-
startHeight: CodegenTypes.Double,
|
|
82
|
-
startRadius: CodegenTypes.Double,
|
|
83
|
-
startContentTranslateX: CodegenTypes.Double,
|
|
84
|
-
startContentTranslateY: CodegenTypes.Double,
|
|
85
|
-
x: CodegenTypes.Double,
|
|
86
|
-
y: CodegenTypes.Double,
|
|
87
|
-
width: CodegenTypes.Double,
|
|
88
|
-
height: CodegenTypes.Double,
|
|
89
|
-
radius: CodegenTypes.Double,
|
|
90
|
-
contentTranslateX: CodegenTypes.Double,
|
|
91
|
-
contentTranslateY: CodegenTypes.Double,
|
|
92
|
-
durationMs: CodegenTypes.Double,
|
|
93
|
-
frames: ReadonlyArray<CodegenTypes.Double>,
|
|
94
|
-
reduceMotion: CodegenTypes.Int32
|
|
117
|
+
reduceMotion: CodegenTypes.Int32,
|
|
118
|
+
completionTag: CodegenTypes.Int32
|
|
95
119
|
): CodegenTypes.Int32;
|
|
96
120
|
rejectAnimation(driverId: CodegenTypes.Double): CodegenTypes.Int32;
|
|
97
121
|
cancelAnimation(
|
|
@@ -1,36 +1,162 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* eslint-disable no-bitwise -- color channels use packed RRGGBBAA integers */
|
|
2
|
+
import {
|
|
3
|
+
forwardRef,
|
|
4
|
+
useEffect,
|
|
5
|
+
type ComponentRef,
|
|
6
|
+
type ForwardedRef,
|
|
7
|
+
type ReactElement,
|
|
8
|
+
type ReactNode,
|
|
9
|
+
} from 'react';
|
|
10
|
+
import { StyleSheet, type ViewProps, type ViewStyle } from 'react-native';
|
|
11
|
+
import type { SmoothClipController } from './controllerTypes';
|
|
12
|
+
import { getControllerRef, unwrapSmoothClipRef } from './controllerInternals';
|
|
5
13
|
import NativeSmoothClipView, {
|
|
6
14
|
type NativeProps,
|
|
7
15
|
} from './SmoothClipViewNativeComponent';
|
|
8
16
|
|
|
9
17
|
export type SmoothClipViewProps = ViewProps & {
|
|
10
|
-
|
|
18
|
+
controller: SmoothClipController;
|
|
11
19
|
children?: ReactNode;
|
|
12
20
|
};
|
|
13
21
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
let reportedIndependentShadow = false;
|
|
23
|
+
const mountedControllers = new WeakMap<SmoothClipController, number>();
|
|
24
|
+
|
|
25
|
+
function useSingleControllerHost(controller: SmoothClipController): void {
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const mounted = mountedControllers.get(controller) ?? 0;
|
|
28
|
+
if (__DEV__ && mounted > 0) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
'[SmoothClipView] One controller cannot drive two mounted hosts. Create one controller per SmoothClipView.'
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
mountedControllers.set(controller, mounted + 1);
|
|
34
|
+
return () => {
|
|
35
|
+
const current = mountedControllers.get(controller) ?? 1;
|
|
36
|
+
if (current <= 1) mountedControllers.delete(controller);
|
|
37
|
+
else mountedControllers.set(controller, current - 1);
|
|
38
|
+
};
|
|
39
|
+
}, [controller]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function filterContainsDropShadow(filter: ViewStyle['filter']): boolean {
|
|
43
|
+
if (typeof filter === 'string') return /drop-shadow\s*\(/i.test(filter);
|
|
44
|
+
return (
|
|
45
|
+
Array.isArray(filter) &&
|
|
46
|
+
filter.some(
|
|
47
|
+
(entry) =>
|
|
48
|
+
typeof entry === 'object' && entry !== null && 'dropShadow' in entry
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function removeDropShadowFilter(
|
|
54
|
+
filter: ViewStyle['filter']
|
|
55
|
+
): ViewStyle['filter'] | undefined {
|
|
56
|
+
if (typeof filter === 'string') {
|
|
57
|
+
const remaining = filter
|
|
58
|
+
.replace(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi, '')
|
|
59
|
+
.trim();
|
|
60
|
+
return remaining === '' ? undefined : remaining;
|
|
61
|
+
}
|
|
62
|
+
if (Array.isArray(filter)) {
|
|
63
|
+
const remaining = filter.filter(
|
|
64
|
+
(entry) =>
|
|
65
|
+
!(typeof entry === 'object' && entry !== null && 'dropShadow' in entry)
|
|
66
|
+
);
|
|
67
|
+
return remaining.length === 0
|
|
68
|
+
? undefined
|
|
69
|
+
: (remaining as ViewStyle['filter']);
|
|
70
|
+
}
|
|
71
|
+
return filter;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Prevents React Native from installing a second, aperture-independent shadow. */
|
|
75
|
+
export function sanitizeSmoothClipStyle(
|
|
76
|
+
style: ViewProps['style']
|
|
77
|
+
): ViewProps['style'] {
|
|
78
|
+
const flat = StyleSheet.flatten(style);
|
|
79
|
+
if (flat == null) return style;
|
|
80
|
+
const hasIndependentShadow =
|
|
81
|
+
flat.boxShadow !== undefined ||
|
|
82
|
+
flat.shadowColor !== undefined ||
|
|
83
|
+
flat.shadowOffset !== undefined ||
|
|
84
|
+
flat.shadowOpacity !== undefined ||
|
|
85
|
+
flat.shadowRadius !== undefined ||
|
|
86
|
+
flat.elevation !== undefined ||
|
|
87
|
+
filterContainsDropShadow(flat.filter);
|
|
88
|
+
if (!hasIndependentShadow) return style;
|
|
89
|
+
if (__DEV__ && !reportedIndependentShadow) {
|
|
90
|
+
reportedIndependentShadow = true;
|
|
91
|
+
console.error(
|
|
92
|
+
'[SmoothClipView] Shadow style properties are not rendered on the host. ' +
|
|
93
|
+
'Put the shadow in SmoothClipPresentation.boxShadow so it follows the clip aperture.'
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
const sanitized: Record<string, unknown> = { ...flat };
|
|
97
|
+
delete sanitized.boxShadow;
|
|
98
|
+
delete sanitized.shadowColor;
|
|
99
|
+
delete sanitized.shadowOffset;
|
|
100
|
+
delete sanitized.shadowOpacity;
|
|
101
|
+
delete sanitized.shadowRadius;
|
|
102
|
+
delete sanitized.elevation;
|
|
103
|
+
if (filterContainsDropShadow(sanitized.filter as ViewStyle['filter'])) {
|
|
104
|
+
const filter = removeDropShadowFilter(
|
|
105
|
+
sanitized.filter as ViewStyle['filter']
|
|
106
|
+
);
|
|
107
|
+
if (filter === undefined) delete sanitized.filter;
|
|
108
|
+
else sanitized.filter = filter;
|
|
109
|
+
}
|
|
110
|
+
return sanitized as ViewStyle;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function renderSmoothClipView(
|
|
114
|
+
{ controller, children, style, ...viewProps }: SmoothClipViewProps,
|
|
115
|
+
forwardedRef: ForwardedRef<ComponentRef<typeof NativeSmoothClipView>>
|
|
116
|
+
): ReactElement {
|
|
117
|
+
const { ref, initialFrame: canonical } = getControllerRef(controller);
|
|
118
|
+
const driverId = unwrapSmoothClipRef(ref)?.id ?? 0;
|
|
119
|
+
const { clip } = canonical;
|
|
120
|
+
const shadow = canonical.boxShadow;
|
|
121
|
+
const color = (shadow?.color as unknown as number) ?? 0;
|
|
21
122
|
const nativeProps: NativeProps = {
|
|
22
123
|
...viewProps,
|
|
124
|
+
style: sanitizeSmoothClipStyle(style),
|
|
23
125
|
driverId,
|
|
24
126
|
initialClipX: clip.x,
|
|
25
127
|
initialClipY: clip.y,
|
|
26
128
|
initialClipWidth: clip.width,
|
|
27
129
|
initialClipHeight: clip.height,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
130
|
+
initialClipTopLeftRadius: clip.topLeftRadius,
|
|
131
|
+
initialClipTopRightRadius: clip.topRightRadius,
|
|
132
|
+
initialClipBottomRightRadius: clip.bottomRightRadius,
|
|
133
|
+
initialClipBottomLeftRadius: clip.bottomLeftRadius,
|
|
134
|
+
initialClipCurve: clip.curve === 'continuous' ? 1 : 0,
|
|
135
|
+
initialContentTranslateX: canonical.contentTranslateX,
|
|
136
|
+
initialContentTranslateY: canonical.contentTranslateY,
|
|
137
|
+
initialContentScale: canonical.contentScale,
|
|
138
|
+
initialClipBoxShadowEnabled: shadow !== undefined,
|
|
139
|
+
initialClipBoxShadowRed: ((color >>> 24) & 0xff) / 255,
|
|
140
|
+
initialClipBoxShadowGreen: ((color >>> 16) & 0xff) / 255,
|
|
141
|
+
initialClipBoxShadowBlue: ((color >>> 8) & 0xff) / 255,
|
|
142
|
+
initialClipBoxShadowAlpha: (color & 0xff) / 255,
|
|
143
|
+
initialClipBoxShadowOffsetX: shadow?.offsetX ?? 0,
|
|
144
|
+
initialClipBoxShadowOffsetY: shadow?.offsetY ?? 0,
|
|
145
|
+
initialClipBoxShadowBlurRadius: shadow?.blurRadius ?? 0,
|
|
146
|
+
initialClipBoxShadowSpreadDistance: shadow?.spreadDistance ?? 0,
|
|
31
147
|
};
|
|
32
148
|
|
|
33
149
|
return (
|
|
34
|
-
<NativeSmoothClipView {...nativeProps}>
|
|
150
|
+
<NativeSmoothClipView ref={forwardedRef} {...nativeProps}>
|
|
151
|
+
{children}
|
|
152
|
+
</NativeSmoothClipView>
|
|
35
153
|
);
|
|
36
154
|
}
|
|
155
|
+
|
|
156
|
+
export const SmoothClipView = forwardRef<
|
|
157
|
+
ComponentRef<typeof NativeSmoothClipView>,
|
|
158
|
+
SmoothClipViewProps
|
|
159
|
+
>(function SmoothClipViewComponent(props, forwardedRef) {
|
|
160
|
+
useSingleControllerHost(props.controller);
|
|
161
|
+
return renderSmoothClipView(props, forwardedRef);
|
|
162
|
+
});
|