rampkit-expo-dev 0.0.13 → 0.0.15
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/build/RampkitOverlay.js +81 -17
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -127,6 +127,63 @@ exports.injectedNoSelect = `
|
|
|
127
127
|
true;
|
|
128
128
|
})();
|
|
129
129
|
`;
|
|
130
|
+
function performRampkitHaptic(event) {
|
|
131
|
+
if (!event || event.action !== "haptic") {
|
|
132
|
+
// Backwards compatible default
|
|
133
|
+
try {
|
|
134
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => { });
|
|
135
|
+
}
|
|
136
|
+
catch (_) { }
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const hapticType = event.hapticType;
|
|
140
|
+
try {
|
|
141
|
+
if (hapticType === "impact") {
|
|
142
|
+
const styleMap = {
|
|
143
|
+
Light: Haptics.ImpactFeedbackStyle.Light,
|
|
144
|
+
Medium: Haptics.ImpactFeedbackStyle.Medium,
|
|
145
|
+
Heavy: Haptics.ImpactFeedbackStyle.Heavy,
|
|
146
|
+
Rigid: Haptics.ImpactFeedbackStyle.Rigid,
|
|
147
|
+
Soft: Haptics.ImpactFeedbackStyle.Soft,
|
|
148
|
+
};
|
|
149
|
+
const impactStyle = event.impactStyle &&
|
|
150
|
+
styleMap[event.impactStyle]
|
|
151
|
+
? event.impactStyle
|
|
152
|
+
: "Medium";
|
|
153
|
+
const style = (impactStyle && styleMap[impactStyle]) ||
|
|
154
|
+
Haptics.ImpactFeedbackStyle.Medium;
|
|
155
|
+
Haptics.impactAsync(style).catch(() => { });
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
if (hapticType === "notification") {
|
|
159
|
+
const notificationMap = {
|
|
160
|
+
Success: Haptics.NotificationFeedbackType.Success,
|
|
161
|
+
Warning: Haptics.NotificationFeedbackType.Warning,
|
|
162
|
+
Error: Haptics.NotificationFeedbackType.Error,
|
|
163
|
+
};
|
|
164
|
+
const notificationType = event.notificationType &&
|
|
165
|
+
notificationMap[event.notificationType]
|
|
166
|
+
? event.notificationType
|
|
167
|
+
: "Success";
|
|
168
|
+
const style = (notificationType && notificationMap[notificationType]) ||
|
|
169
|
+
Haptics.NotificationFeedbackType.Success;
|
|
170
|
+
Haptics.notificationAsync(style).catch(() => { });
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (hapticType === "selection") {
|
|
174
|
+
Haptics.selectionAsync().catch(() => { });
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
// Fallback for unknown hapticType
|
|
178
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => { });
|
|
179
|
+
}
|
|
180
|
+
catch (_) {
|
|
181
|
+
try {
|
|
182
|
+
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium).catch(() => { });
|
|
183
|
+
}
|
|
184
|
+
catch (__) { }
|
|
185
|
+
}
|
|
186
|
+
}
|
|
130
187
|
let sibling = null;
|
|
131
188
|
let preloadSibling = null;
|
|
132
189
|
const preloadCache = new Map();
|
|
@@ -158,16 +215,10 @@ function hideRampkitOverlay() {
|
|
|
158
215
|
activeCloseHandler = null;
|
|
159
216
|
}
|
|
160
217
|
function closeRampkitOverlay() {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
activeCloseHandler();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
catch (_) {
|
|
168
|
-
// fall through to hard hide
|
|
218
|
+
if (activeCloseHandler) {
|
|
219
|
+
activeCloseHandler();
|
|
220
|
+
return;
|
|
169
221
|
}
|
|
170
|
-
// Always fall back to a hard hide so the overlay is guaranteed to disappear
|
|
171
222
|
hideRampkitOverlay();
|
|
172
223
|
}
|
|
173
224
|
function preloadRampkitOverlay(opts) {
|
|
@@ -279,12 +330,15 @@ function Overlay(props) {
|
|
|
279
330
|
if (isClosing)
|
|
280
331
|
return;
|
|
281
332
|
setIsClosing(true);
|
|
282
|
-
react_native_1.Animated.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
333
|
+
react_native_1.Animated.sequence([
|
|
334
|
+
react_native_1.Animated.delay(150),
|
|
335
|
+
react_native_1.Animated.timing(overlayOpacity, {
|
|
336
|
+
toValue: 0,
|
|
337
|
+
duration: 320,
|
|
338
|
+
easing: react_native_1.Easing.out(react_native_1.Easing.cubic),
|
|
339
|
+
useNativeDriver: true,
|
|
340
|
+
}),
|
|
341
|
+
]).start(() => {
|
|
288
342
|
props.onRequestClose();
|
|
289
343
|
});
|
|
290
344
|
}, [isClosing, overlayOpacity, props.onRequestClose]);
|
|
@@ -654,7 +708,7 @@ function Overlay(props) {
|
|
|
654
708
|
return;
|
|
655
709
|
}
|
|
656
710
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
657
|
-
|
|
711
|
+
performRampkitHaptic(data);
|
|
658
712
|
return;
|
|
659
713
|
}
|
|
660
714
|
}
|
|
@@ -743,7 +797,17 @@ function Overlay(props) {
|
|
|
743
797
|
return;
|
|
744
798
|
}
|
|
745
799
|
if (raw.startsWith("haptic:")) {
|
|
746
|
-
|
|
800
|
+
performRampkitHaptic({
|
|
801
|
+
type: "rampkit:haptic",
|
|
802
|
+
nodeId: null,
|
|
803
|
+
nodeType: null,
|
|
804
|
+
animation: "none",
|
|
805
|
+
action: "haptic",
|
|
806
|
+
hapticType: "impact",
|
|
807
|
+
impactStyle: "Medium",
|
|
808
|
+
notificationType: null,
|
|
809
|
+
timestamp: Date.now(),
|
|
810
|
+
});
|
|
747
811
|
return;
|
|
748
812
|
}
|
|
749
813
|
}
|
package/package.json
CHANGED