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
|
@@ -2,12 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
#include <SmoothClipViewSpecJSI.h>
|
|
4
4
|
|
|
5
|
+
#include <vector>
|
|
6
|
+
|
|
5
7
|
namespace facebook::react {
|
|
6
8
|
|
|
7
9
|
struct SmoothClipAnimationCompletion {
|
|
8
10
|
double driverId;
|
|
9
11
|
int32_t animationId;
|
|
12
|
+
int32_t completionTag;
|
|
13
|
+
bool finished;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
struct SmoothClipGroupAnimationCompletion {
|
|
17
|
+
double controllerId;
|
|
18
|
+
int32_t groupId;
|
|
19
|
+
int32_t completionTag;
|
|
10
20
|
bool finished;
|
|
21
|
+
std::vector<double> snapshots;
|
|
11
22
|
};
|
|
12
23
|
|
|
13
24
|
template <>
|
|
@@ -19,6 +30,8 @@ struct Bridging<SmoothClipAnimationCompletion> {
|
|
|
19
30
|
value.getProperty(runtime, "driverId").asNumber(),
|
|
20
31
|
static_cast<int32_t>(
|
|
21
32
|
value.getProperty(runtime, "animationId").asNumber()),
|
|
33
|
+
static_cast<int32_t>(
|
|
34
|
+
value.getProperty(runtime, "completionTag").asNumber()),
|
|
22
35
|
value.getProperty(runtime, "finished").getBool()};
|
|
23
36
|
}
|
|
24
37
|
|
|
@@ -28,7 +41,48 @@ struct Bridging<SmoothClipAnimationCompletion> {
|
|
|
28
41
|
jsi::Object result(runtime);
|
|
29
42
|
result.setProperty(runtime, "driverId", value.driverId);
|
|
30
43
|
result.setProperty(runtime, "animationId", value.animationId);
|
|
44
|
+
result.setProperty(runtime, "completionTag", value.completionTag);
|
|
45
|
+
result.setProperty(runtime, "finished", value.finished);
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
template <>
|
|
51
|
+
struct Bridging<SmoothClipGroupAnimationCompletion> {
|
|
52
|
+
static SmoothClipGroupAnimationCompletion fromJs(
|
|
53
|
+
jsi::Runtime &runtime,
|
|
54
|
+
const jsi::Object &value) {
|
|
55
|
+
const jsi::Array ids =
|
|
56
|
+
value.getProperty(runtime, "snapshots").asObject(runtime).asArray(runtime);
|
|
57
|
+
std::vector<double> snapshots;
|
|
58
|
+
snapshots.reserve(ids.size(runtime));
|
|
59
|
+
for (size_t index = 0; index < ids.size(runtime); index += 1) {
|
|
60
|
+
snapshots.push_back(ids.getValueAtIndex(runtime, index).asNumber());
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
value.getProperty(runtime, "controllerId").asNumber(),
|
|
64
|
+
static_cast<int32_t>(
|
|
65
|
+
value.getProperty(runtime, "groupId").asNumber()),
|
|
66
|
+
static_cast<int32_t>(
|
|
67
|
+
value.getProperty(runtime, "completionTag").asNumber()),
|
|
68
|
+
value.getProperty(runtime, "finished").getBool(),
|
|
69
|
+
std::move(snapshots),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static jsi::Object toJs(
|
|
74
|
+
jsi::Runtime &runtime,
|
|
75
|
+
const SmoothClipGroupAnimationCompletion &value) {
|
|
76
|
+
jsi::Object result(runtime);
|
|
77
|
+
result.setProperty(runtime, "controllerId", value.controllerId);
|
|
78
|
+
result.setProperty(runtime, "groupId", value.groupId);
|
|
79
|
+
result.setProperty(runtime, "completionTag", value.completionTag);
|
|
31
80
|
result.setProperty(runtime, "finished", value.finished);
|
|
81
|
+
jsi::Array snapshots(runtime, value.snapshots.size());
|
|
82
|
+
for (size_t index = 0; index < value.snapshots.size(); index += 1) {
|
|
83
|
+
snapshots.setValueAtIndex(runtime, index, value.snapshots[index]);
|
|
84
|
+
}
|
|
85
|
+
result.setProperty(runtime, "snapshots", std::move(snapshots));
|
|
32
86
|
return result;
|
|
33
87
|
}
|
|
34
88
|
};
|
|
@@ -39,88 +93,101 @@ class SmoothClipTurboModule final
|
|
|
39
93
|
explicit SmoothClipTurboModule(std::shared_ptr<CallInvoker> jsInvoker);
|
|
40
94
|
~SmoothClipTurboModule() override;
|
|
41
95
|
|
|
96
|
+
bool supportsAutonomousComplexPathAnimation(jsi::Runtime &runtime);
|
|
97
|
+
jsi::Array beginGroupInteraction(
|
|
98
|
+
jsi::Runtime &runtime,
|
|
99
|
+
jsi::Array driverIds);
|
|
100
|
+
jsi::Array snapshotGroup(
|
|
101
|
+
jsi::Runtime &runtime,
|
|
102
|
+
jsi::Array driverIds);
|
|
103
|
+
bool setClipPresentationBatch(
|
|
104
|
+
jsi::Runtime &runtime,
|
|
105
|
+
jsi::Array entries);
|
|
106
|
+
int32_t animateTimingGroup(
|
|
107
|
+
jsi::Runtime &runtime,
|
|
108
|
+
double controllerId,
|
|
109
|
+
jsi::Array entries,
|
|
110
|
+
double durationMs,
|
|
111
|
+
double controlPoint1X,
|
|
112
|
+
double controlPoint1Y,
|
|
113
|
+
double controlPoint2X,
|
|
114
|
+
double controlPoint2Y,
|
|
115
|
+
int32_t reduceMotion,
|
|
116
|
+
int32_t completionTag,
|
|
117
|
+
double startTimestamp);
|
|
118
|
+
int32_t animateSpringGroup(
|
|
119
|
+
jsi::Runtime &runtime,
|
|
120
|
+
double controllerId,
|
|
121
|
+
jsi::Array entries,
|
|
122
|
+
double mass,
|
|
123
|
+
double stiffness,
|
|
124
|
+
double damping,
|
|
125
|
+
double velocity,
|
|
126
|
+
double energyThreshold,
|
|
127
|
+
int32_t reduceMotion,
|
|
128
|
+
int32_t completionTag,
|
|
129
|
+
double startTimestamp);
|
|
130
|
+
jsi::Array cancelAnimationGroup(
|
|
131
|
+
jsi::Runtime &runtime,
|
|
132
|
+
int32_t groupId,
|
|
133
|
+
int32_t behavior);
|
|
42
134
|
void setClipPresentation(
|
|
43
135
|
jsi::Runtime &runtime,
|
|
44
136
|
double driverId,
|
|
45
|
-
|
|
46
|
-
double y,
|
|
47
|
-
double width,
|
|
48
|
-
double height,
|
|
49
|
-
double radius,
|
|
50
|
-
double contentTranslateX,
|
|
51
|
-
double contentTranslateY,
|
|
137
|
+
jsi::Array presentation,
|
|
52
138
|
bool takeOwnership,
|
|
53
139
|
bool overridePendingAnimation);
|
|
54
|
-
|
|
55
|
-
int32_t animateTiming(
|
|
140
|
+
void setClipFrameScalars(
|
|
56
141
|
jsi::Runtime &runtime,
|
|
57
142
|
double driverId,
|
|
58
|
-
bool hasInteractiveStart,
|
|
59
|
-
double startX,
|
|
60
|
-
double startY,
|
|
61
|
-
double startWidth,
|
|
62
|
-
double startHeight,
|
|
63
|
-
double startRadius,
|
|
64
|
-
double startContentTranslateX,
|
|
65
|
-
double startContentTranslateY,
|
|
66
143
|
double x,
|
|
67
144
|
double y,
|
|
68
145
|
double width,
|
|
69
146
|
double height,
|
|
70
|
-
double
|
|
147
|
+
double topLeftRadius,
|
|
148
|
+
double topRightRadius,
|
|
149
|
+
double bottomRightRadius,
|
|
150
|
+
double bottomLeftRadius,
|
|
151
|
+
int32_t curveCode,
|
|
71
152
|
double contentTranslateX,
|
|
72
153
|
double contentTranslateY,
|
|
154
|
+
double contentScale,
|
|
155
|
+
bool shadowEnabled,
|
|
156
|
+
double shadowRed,
|
|
157
|
+
double shadowGreen,
|
|
158
|
+
double shadowBlue,
|
|
159
|
+
double shadowAlpha,
|
|
160
|
+
double shadowOffsetX,
|
|
161
|
+
double shadowOffsetY,
|
|
162
|
+
double shadowBlurRadius,
|
|
163
|
+
double shadowSpreadDistance);
|
|
164
|
+
jsi::Array beginInteraction(jsi::Runtime &runtime, double driverId);
|
|
165
|
+
jsi::Array snapshotCurrent(jsi::Runtime &runtime, double driverId);
|
|
166
|
+
|
|
167
|
+
int32_t animateTiming(
|
|
168
|
+
jsi::Runtime &runtime,
|
|
169
|
+
double driverId,
|
|
170
|
+
jsi::Array start,
|
|
171
|
+
jsi::Array target,
|
|
73
172
|
double durationMs,
|
|
74
173
|
double controlPoint1X,
|
|
75
174
|
double controlPoint1Y,
|
|
76
175
|
double controlPoint2X,
|
|
77
176
|
double controlPoint2Y,
|
|
78
|
-
int32_t reduceMotion
|
|
177
|
+
int32_t reduceMotion,
|
|
178
|
+
int32_t completionTag);
|
|
79
179
|
int32_t animateSpring(
|
|
80
180
|
jsi::Runtime &runtime,
|
|
81
181
|
double driverId,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
double startY,
|
|
85
|
-
double startWidth,
|
|
86
|
-
double startHeight,
|
|
87
|
-
double startRadius,
|
|
88
|
-
double startContentTranslateX,
|
|
89
|
-
double startContentTranslateY,
|
|
90
|
-
double x,
|
|
91
|
-
double y,
|
|
92
|
-
double width,
|
|
93
|
-
double height,
|
|
94
|
-
double radius,
|
|
95
|
-
double contentTranslateX,
|
|
96
|
-
double contentTranslateY,
|
|
182
|
+
jsi::Array start,
|
|
183
|
+
jsi::Array target,
|
|
97
184
|
double mass,
|
|
98
185
|
double stiffness,
|
|
99
186
|
double damping,
|
|
100
187
|
double initialVelocity,
|
|
101
188
|
bool inheritVelocity,
|
|
102
|
-
int32_t reduceMotion
|
|
103
|
-
|
|
104
|
-
jsi::Runtime &runtime,
|
|
105
|
-
double driverId,
|
|
106
|
-
bool hasInteractiveStart,
|
|
107
|
-
double startX,
|
|
108
|
-
double startY,
|
|
109
|
-
double startWidth,
|
|
110
|
-
double startHeight,
|
|
111
|
-
double startRadius,
|
|
112
|
-
double startContentTranslateX,
|
|
113
|
-
double startContentTranslateY,
|
|
114
|
-
double x,
|
|
115
|
-
double y,
|
|
116
|
-
double width,
|
|
117
|
-
double height,
|
|
118
|
-
double radius,
|
|
119
|
-
double contentTranslateX,
|
|
120
|
-
double contentTranslateY,
|
|
121
|
-
double durationMs,
|
|
122
|
-
jsi::Array frames,
|
|
123
|
-
int32_t reduceMotion);
|
|
189
|
+
int32_t reduceMotion,
|
|
190
|
+
int32_t completionTag);
|
|
124
191
|
int32_t rejectAnimation(jsi::Runtime &runtime, double driverId);
|
|
125
192
|
jsi::Array cancelAnimation(
|
|
126
193
|
jsi::Runtime &runtime,
|