rampkit-expo-dev 0.0.14 → 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 +69 -2
- 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();
|
|
@@ -651,7 +708,7 @@ function Overlay(props) {
|
|
|
651
708
|
return;
|
|
652
709
|
}
|
|
653
710
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:haptic") {
|
|
654
|
-
|
|
711
|
+
performRampkitHaptic(data);
|
|
655
712
|
return;
|
|
656
713
|
}
|
|
657
714
|
}
|
|
@@ -740,7 +797,17 @@ function Overlay(props) {
|
|
|
740
797
|
return;
|
|
741
798
|
}
|
|
742
799
|
if (raw.startsWith("haptic:")) {
|
|
743
|
-
|
|
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
|
+
});
|
|
744
811
|
return;
|
|
745
812
|
}
|
|
746
813
|
}
|
package/package.json
CHANGED