@hoddy-ui/core 2.5.40 → 2.5.45
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/index.ts +1 -2
- package/next/dist/index.d.mts +165 -6
- package/next/dist/index.d.ts +165 -6
- package/next/dist/index.js +628 -83
- package/next/dist/index.js.map +1 -1
- package/next/dist/index.mjs +679 -97
- package/next/dist/index.mjs.map +1 -1
- package/next/index.ts +3 -0
- package/next/package.json +1 -1
- package/package.json +1 -1
- package/src/Components/Animators/hooks/useFloatAnimation.ts +16 -13
- package/src/Components/FormWrapper.tsx +51 -44
- package/src/Components/SafeAreaView.tsx +18 -15
- package/src/Components/Typography.tsx +25 -15
- package/src/config/KeyManager.ts +14 -0
- package/src/config/index.ts +21 -0
- package/src/types.ts +3 -2
package/next/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ var next_exports = {};
|
|
|
32
32
|
__export(next_exports, {
|
|
33
33
|
AdaptiveStatusBar: () => AdaptiveStatusBarNext_default,
|
|
34
34
|
AlertX: () => AlertX_default,
|
|
35
|
+
Animator: () => Animator,
|
|
35
36
|
Avatar: () => Avatar_default,
|
|
36
37
|
Button: () => Button_default,
|
|
37
38
|
CheckBox: () => CheckBox,
|
|
@@ -59,10 +60,18 @@ __export(next_exports, {
|
|
|
59
60
|
getPredictionsFromCoords: () => getPredictionsFromCoords,
|
|
60
61
|
getPredictionsFromQuery: () => getPredictionsFromQuery,
|
|
61
62
|
showFlashMessage: () => showFlashMessage,
|
|
63
|
+
useAppState: () => useAppState_default,
|
|
64
|
+
useBlinkAnimation: () => useBlinkAnimation,
|
|
62
65
|
useColors: () => useColors,
|
|
66
|
+
useFadeAnimation: () => useFadeAnimation,
|
|
67
|
+
useFloatAnimation: () => useFloatAnimation,
|
|
68
|
+
useGrowAnimation: () => useGrowAnimation,
|
|
63
69
|
useNavScreenOptions: () => useNavScreenOptions,
|
|
70
|
+
useRollAnimation: () => useRollAnimation,
|
|
71
|
+
useSlideAnimation: () => useSlideAnimation,
|
|
64
72
|
useTheme: () => useTheme,
|
|
65
|
-
useThemeContext: () => useThemeContext
|
|
73
|
+
useThemeContext: () => useThemeContext,
|
|
74
|
+
useThrownUpAnimation: () => useThrownUpAnimation
|
|
66
75
|
});
|
|
67
76
|
module.exports = __toCommonJS(next_exports);
|
|
68
77
|
|
|
@@ -274,6 +283,17 @@ var getFontFamily = (fontWeight) => {
|
|
|
274
283
|
};
|
|
275
284
|
|
|
276
285
|
// ../src/Components/Typography.tsx
|
|
286
|
+
var DEFAULT_FONT_SIZES = {
|
|
287
|
+
h1: (0, import_react_native_size_matters.ms)(42),
|
|
288
|
+
h2: (0, import_react_native_size_matters.ms)(37),
|
|
289
|
+
h3: (0, import_react_native_size_matters.ms)(32),
|
|
290
|
+
h4: (0, import_react_native_size_matters.ms)(27),
|
|
291
|
+
h5: (0, import_react_native_size_matters.ms)(22),
|
|
292
|
+
h6: (0, import_react_native_size_matters.ms)(17),
|
|
293
|
+
body1: (0, import_react_native_size_matters.ms)(15),
|
|
294
|
+
body2: (0, import_react_native_size_matters.ms)(12),
|
|
295
|
+
caption: (0, import_react_native_size_matters.ms)(10)
|
|
296
|
+
};
|
|
277
297
|
var Typography = (0, import_react.forwardRef)(
|
|
278
298
|
({
|
|
279
299
|
children,
|
|
@@ -288,24 +308,18 @@ var Typography = (0, import_react.forwardRef)(
|
|
|
288
308
|
fontFamily,
|
|
289
309
|
// NEW PROP ADDED
|
|
290
310
|
fontSize,
|
|
311
|
+
lineHeight,
|
|
291
312
|
...props
|
|
292
313
|
}, ref) => {
|
|
293
314
|
const colors2 = useColors();
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
h5: (0, import_react_native_size_matters.ms)(22),
|
|
300
|
-
h6: (0, import_react_native_size_matters.ms)(17),
|
|
301
|
-
body1: (0, import_react_native_size_matters.ms)(15),
|
|
302
|
-
body2: (0, import_react_native_size_matters.ms)(12),
|
|
303
|
-
caption: (0, import_react_native_size_matters.ms)(10)
|
|
304
|
-
};
|
|
305
|
-
const f = fontSize || _fontSize[variant];
|
|
315
|
+
const config2 = getConfig();
|
|
316
|
+
const customFontSizes = config2.TYPOGRAPHY?.fontSizes;
|
|
317
|
+
const baseFontSize = customFontSizes?.[variant] ?? DEFAULT_FONT_SIZES[variant];
|
|
318
|
+
const f = fontSize || baseFontSize;
|
|
319
|
+
const lh = lineHeight || f * 1.2;
|
|
306
320
|
const styles = import_react_native.StyleSheet.create({
|
|
307
321
|
text: {
|
|
308
|
-
lineHeight:
|
|
322
|
+
lineHeight: lh,
|
|
309
323
|
fontSize: f,
|
|
310
324
|
marginBottom: (0, import_react_native_size_matters.ms)(gutterBottom) || 0,
|
|
311
325
|
color: colors2[color]?.main || color,
|
|
@@ -913,56 +927,59 @@ var CheckBox = ({
|
|
|
913
927
|
// ../src/Components/FormWrapper.tsx
|
|
914
928
|
var import_react10 = __toESM(require("react"));
|
|
915
929
|
var import_react_native10 = require("react-native");
|
|
916
|
-
var import_react_native_size_matters7 = require("react-native-size-matters");
|
|
917
930
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
918
|
-
var
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
{
|
|
939
|
-
|
|
940
|
-
behavior,
|
|
941
|
-
contentContainerStyle: styles.root,
|
|
942
|
-
keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
|
|
943
|
-
},
|
|
944
|
-
children
|
|
945
|
-
)) : /* @__PURE__ */ import_react10.default.createElement(
|
|
946
|
-
import_react_native10.KeyboardAvoidingView,
|
|
947
|
-
{
|
|
948
|
-
behavior,
|
|
949
|
-
style: styles.root,
|
|
950
|
-
keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
|
|
951
|
-
},
|
|
952
|
-
/* @__PURE__ */ import_react10.default.createElement(
|
|
953
|
-
import_react_native10.ScrollView,
|
|
931
|
+
var import_react_native_size_matters7 = require("react-native-size-matters");
|
|
932
|
+
var FormWrapper = (0, import_react10.forwardRef)(
|
|
933
|
+
({
|
|
934
|
+
children,
|
|
935
|
+
behavior = import_react_native10.Platform.OS === "ios" ? "padding" : "height",
|
|
936
|
+
contentContainerStyle,
|
|
937
|
+
mode = "scroll",
|
|
938
|
+
keyboardVerticalOffset = 10,
|
|
939
|
+
style = {},
|
|
940
|
+
onScroll
|
|
941
|
+
}, ref) => {
|
|
942
|
+
const { bottom } = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
943
|
+
const defaultOffset = import_react_native10.Platform.OS === "ios" ? -bottom : -bottom * 2;
|
|
944
|
+
const styles = import_react_native_size_matters7.ScaledSheet.create({
|
|
945
|
+
root: {
|
|
946
|
+
width: "100%",
|
|
947
|
+
flex: 1,
|
|
948
|
+
...style
|
|
949
|
+
}
|
|
950
|
+
});
|
|
951
|
+
return mode === "static" ? /* @__PURE__ */ import_react10.default.createElement(import_react_native10.TouchableWithoutFeedback, { onPress: import_react_native10.Keyboard.dismiss, accessible: false }, /* @__PURE__ */ import_react10.default.createElement(
|
|
952
|
+
import_react_native10.KeyboardAvoidingView,
|
|
954
953
|
{
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
contentContainerStyle,
|
|
960
|
-
keyboardShouldPersistTaps: "handled"
|
|
954
|
+
style: styles.root,
|
|
955
|
+
behavior,
|
|
956
|
+
contentContainerStyle: styles.root,
|
|
957
|
+
keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
|
|
961
958
|
},
|
|
962
959
|
children
|
|
963
|
-
)
|
|
964
|
-
|
|
965
|
-
|
|
960
|
+
)) : /* @__PURE__ */ import_react10.default.createElement(
|
|
961
|
+
import_react_native10.KeyboardAvoidingView,
|
|
962
|
+
{
|
|
963
|
+
behavior,
|
|
964
|
+
style: styles.root,
|
|
965
|
+
keyboardVerticalOffset: keyboardVerticalOffset || defaultOffset
|
|
966
|
+
},
|
|
967
|
+
/* @__PURE__ */ import_react10.default.createElement(
|
|
968
|
+
import_react_native10.ScrollView,
|
|
969
|
+
{
|
|
970
|
+
ref,
|
|
971
|
+
onScroll,
|
|
972
|
+
showsVerticalScrollIndicator: false,
|
|
973
|
+
scrollEventThrottle: 40,
|
|
974
|
+
keyboardDismissMode: "interactive",
|
|
975
|
+
contentContainerStyle,
|
|
976
|
+
keyboardShouldPersistTaps: "handled"
|
|
977
|
+
},
|
|
978
|
+
children
|
|
979
|
+
)
|
|
980
|
+
);
|
|
981
|
+
}
|
|
982
|
+
);
|
|
966
983
|
|
|
967
984
|
// ../src/Components/StarRating.tsx
|
|
968
985
|
var import_vector_icons5 = require("@expo/vector-icons");
|
|
@@ -1541,9 +1558,9 @@ var TextField = ({
|
|
|
1541
1558
|
}) => {
|
|
1542
1559
|
const colors2 = useColors();
|
|
1543
1560
|
const [focused, setFocused] = (0, import_react16.useState)(false);
|
|
1544
|
-
const
|
|
1561
|
+
const height2 = (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 50 : 45) * (size === "large" ? 1.2 : size === "small" ? 0.8 : 1);
|
|
1545
1562
|
const labelAnim = (0, import_react16.useRef)(
|
|
1546
|
-
new import_react_native16.Animated.Value(
|
|
1563
|
+
new import_react_native16.Animated.Value(height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2))
|
|
1547
1564
|
).current;
|
|
1548
1565
|
import_react16.default.useEffect(() => {
|
|
1549
1566
|
if (focused || value) {
|
|
@@ -1554,7 +1571,7 @@ var TextField = ({
|
|
|
1554
1571
|
}).start();
|
|
1555
1572
|
} else {
|
|
1556
1573
|
import_react_native16.Animated.timing(labelAnim, {
|
|
1557
|
-
toValue:
|
|
1574
|
+
toValue: height2 / (0, import_react_native_size_matters13.moderateScale)(variant === "text" ? 2.5 : 3.2),
|
|
1558
1575
|
duration: 300,
|
|
1559
1576
|
useNativeDriver: false
|
|
1560
1577
|
}).start();
|
|
@@ -1567,7 +1584,7 @@ var TextField = ({
|
|
|
1567
1584
|
...style
|
|
1568
1585
|
},
|
|
1569
1586
|
container: {
|
|
1570
|
-
height,
|
|
1587
|
+
height: height2,
|
|
1571
1588
|
overflow: "hidden",
|
|
1572
1589
|
backgroundColor: variant === "outlined" || variant === "text" ? "#fff0" : focused ? colors2.white[3] : colors2.white[4],
|
|
1573
1590
|
flexDirection: "row",
|
|
@@ -1771,7 +1788,7 @@ var TextField2 = import_react16.default.forwardRef(
|
|
|
1771
1788
|
const colors2 = useColors();
|
|
1772
1789
|
const [focused, _setFocused] = (0, import_react16.useState)(false);
|
|
1773
1790
|
const [showPassword, setShowPassword] = (0, import_react16.useState)(false);
|
|
1774
|
-
const
|
|
1791
|
+
const height2 = (0, import_react_native_size_matters13.moderateScale)(
|
|
1775
1792
|
multiline ? 50 + (props.numberOfLines || 1) * 18 : 50
|
|
1776
1793
|
);
|
|
1777
1794
|
const setFocused = (value2) => {
|
|
@@ -1790,7 +1807,7 @@ var TextField2 = import_react16.default.forwardRef(
|
|
|
1790
1807
|
...style
|
|
1791
1808
|
},
|
|
1792
1809
|
container: {
|
|
1793
|
-
height,
|
|
1810
|
+
height: height2,
|
|
1794
1811
|
overflow: "hidden",
|
|
1795
1812
|
flexDirection: "row",
|
|
1796
1813
|
borderColor: error ? colors2.error.main : focused ? colors2[color].main : colors2.white[4],
|
|
@@ -2163,27 +2180,26 @@ var Locator = ({
|
|
|
2163
2180
|
var import_react18 = __toESM(require("react"));
|
|
2164
2181
|
var import_react_native_safe_area_context6 = require("react-native-safe-area-context");
|
|
2165
2182
|
var import_react_native18 = require("react-native");
|
|
2166
|
-
var SafeAreaView = (
|
|
2167
|
-
children,
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
}
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
};
|
|
2183
|
+
var SafeAreaView = (0, import_react18.forwardRef)(
|
|
2184
|
+
({ children, style, ...rest }, ref) => {
|
|
2185
|
+
const { top, bottom } = (0, import_react_native_safe_area_context6.useSafeAreaInsets)();
|
|
2186
|
+
const styles = import_react_native18.StyleSheet.create({
|
|
2187
|
+
root: {
|
|
2188
|
+
paddingTop: top,
|
|
2189
|
+
paddingBottom: bottom,
|
|
2190
|
+
flex: 1
|
|
2191
|
+
}
|
|
2192
|
+
});
|
|
2193
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_native18.View, { ref, style: [styles.root, style], ...rest }, children);
|
|
2194
|
+
}
|
|
2195
|
+
);
|
|
2180
2196
|
|
|
2181
2197
|
// ../src/Components/Divider.tsx
|
|
2182
2198
|
var import_react19 = __toESM(require("react"));
|
|
2183
2199
|
var import_react_native19 = require("react-native");
|
|
2184
2200
|
var import_react_native_size_matters15 = require("react-native-size-matters");
|
|
2185
2201
|
var Divider = ({
|
|
2186
|
-
height = 1,
|
|
2202
|
+
height: height2 = 1,
|
|
2187
2203
|
color = "textSecondary",
|
|
2188
2204
|
gutterBottom = 0,
|
|
2189
2205
|
style
|
|
@@ -2191,7 +2207,7 @@ var Divider = ({
|
|
|
2191
2207
|
const colors2 = useColors();
|
|
2192
2208
|
const styles = import_react_native_size_matters15.ScaledSheet.create({
|
|
2193
2209
|
root: {
|
|
2194
|
-
height,
|
|
2210
|
+
height: height2,
|
|
2195
2211
|
backgroundColor: colors2[color].main,
|
|
2196
2212
|
marginBottom: (0, import_react_native_size_matters15.ms)(gutterBottom),
|
|
2197
2213
|
...style
|
|
@@ -2319,6 +2335,526 @@ var OTPInput = ({
|
|
|
2319
2335
|
))));
|
|
2320
2336
|
};
|
|
2321
2337
|
|
|
2338
|
+
// ../src/Components/Animators/hooks/useAppState.ts
|
|
2339
|
+
var import_react22 = require("react");
|
|
2340
|
+
var import_react_native22 = require("react-native");
|
|
2341
|
+
var useAppState = () => {
|
|
2342
|
+
const [isActive, setIsActive] = (0, import_react22.useState)(import_react_native22.AppState.currentState === "active");
|
|
2343
|
+
(0, import_react22.useEffect)(() => {
|
|
2344
|
+
const handleAppStateChange = (nextAppState) => {
|
|
2345
|
+
setIsActive(nextAppState === "active");
|
|
2346
|
+
};
|
|
2347
|
+
let subscription;
|
|
2348
|
+
if (import_react_native22.Platform.OS === "android") {
|
|
2349
|
+
subscription = import_react_native22.AppState.addEventListener("change", handleAppStateChange);
|
|
2350
|
+
} else {
|
|
2351
|
+
subscription = import_react_native22.AppState.addEventListener("change", handleAppStateChange);
|
|
2352
|
+
}
|
|
2353
|
+
return () => {
|
|
2354
|
+
subscription?.remove();
|
|
2355
|
+
};
|
|
2356
|
+
}, []);
|
|
2357
|
+
return { isActive };
|
|
2358
|
+
};
|
|
2359
|
+
var useAppState_default = useAppState;
|
|
2360
|
+
|
|
2361
|
+
// ../src/Components/Animators/hooks/useBlinkAnimation.ts
|
|
2362
|
+
var import_react23 = require("react");
|
|
2363
|
+
var import_react_native23 = require("react-native");
|
|
2364
|
+
var import_react_native_reanimated3 = require("react-native-reanimated");
|
|
2365
|
+
var useBlinkAnimation = ({
|
|
2366
|
+
delay = 0,
|
|
2367
|
+
blinkDuration = 2e3,
|
|
2368
|
+
minOpacity = 0.5,
|
|
2369
|
+
maxOpacity = 1
|
|
2370
|
+
} = {}) => {
|
|
2371
|
+
const opacity = (0, import_react_native_reanimated3.useSharedValue)(maxOpacity);
|
|
2372
|
+
const { isActive } = useAppState_default();
|
|
2373
|
+
const animatedStyle = (0, import_react_native_reanimated3.useAnimatedStyle)(() => {
|
|
2374
|
+
return {
|
|
2375
|
+
opacity: opacity.value
|
|
2376
|
+
};
|
|
2377
|
+
});
|
|
2378
|
+
const startBlinking = () => {
|
|
2379
|
+
opacity.value = (0, import_react_native_reanimated3.withRepeat)(
|
|
2380
|
+
(0, import_react_native_reanimated3.withSequence)(
|
|
2381
|
+
(0, import_react_native_reanimated3.withTiming)(minOpacity, {
|
|
2382
|
+
duration: blinkDuration / 2,
|
|
2383
|
+
easing: import_react_native_reanimated3.Easing.inOut(import_react_native_reanimated3.Easing.quad)
|
|
2384
|
+
}),
|
|
2385
|
+
(0, import_react_native_reanimated3.withTiming)(maxOpacity, {
|
|
2386
|
+
duration: blinkDuration / 2,
|
|
2387
|
+
easing: import_react_native_reanimated3.Easing.inOut(import_react_native_reanimated3.Easing.quad)
|
|
2388
|
+
})
|
|
2389
|
+
),
|
|
2390
|
+
-1,
|
|
2391
|
+
false
|
|
2392
|
+
);
|
|
2393
|
+
};
|
|
2394
|
+
(0, import_react23.useEffect)(() => {
|
|
2395
|
+
if (!isActive && import_react_native23.Platform.OS === "ios") {
|
|
2396
|
+
opacity.value = maxOpacity;
|
|
2397
|
+
return;
|
|
2398
|
+
}
|
|
2399
|
+
if (delay > 0) {
|
|
2400
|
+
const timer = setTimeout(() => {
|
|
2401
|
+
startBlinking();
|
|
2402
|
+
}, delay);
|
|
2403
|
+
return () => {
|
|
2404
|
+
clearTimeout(timer);
|
|
2405
|
+
opacity.value = maxOpacity;
|
|
2406
|
+
};
|
|
2407
|
+
} else {
|
|
2408
|
+
startBlinking();
|
|
2409
|
+
}
|
|
2410
|
+
return () => {
|
|
2411
|
+
opacity.value = maxOpacity;
|
|
2412
|
+
};
|
|
2413
|
+
}, [delay, blinkDuration, minOpacity, maxOpacity, isActive]);
|
|
2414
|
+
return {
|
|
2415
|
+
animatedStyle
|
|
2416
|
+
};
|
|
2417
|
+
};
|
|
2418
|
+
|
|
2419
|
+
// ../src/Components/Animators/hooks/useFadeAnimation.ts
|
|
2420
|
+
var import_react24 = require("react");
|
|
2421
|
+
var import_react_native24 = require("react-native");
|
|
2422
|
+
var import_react_native_reanimated4 = require("react-native-reanimated");
|
|
2423
|
+
var useFadeAnimation = ({
|
|
2424
|
+
duration = 1e3,
|
|
2425
|
+
delay = 0,
|
|
2426
|
+
closeAfter = null
|
|
2427
|
+
} = {}) => {
|
|
2428
|
+
const opacity = (0, import_react_native_reanimated4.useSharedValue)(0);
|
|
2429
|
+
const { isActive } = useAppState_default();
|
|
2430
|
+
const animatedStyle = (0, import_react_native_reanimated4.useAnimatedStyle)(() => {
|
|
2431
|
+
return {
|
|
2432
|
+
opacity: opacity.value
|
|
2433
|
+
};
|
|
2434
|
+
});
|
|
2435
|
+
(0, import_react24.useEffect)(() => {
|
|
2436
|
+
if (!isActive && import_react_native24.Platform.OS === "ios") {
|
|
2437
|
+
opacity.value = 0;
|
|
2438
|
+
return;
|
|
2439
|
+
}
|
|
2440
|
+
opacity.value = (0, import_react_native_reanimated4.withDelay)(
|
|
2441
|
+
delay,
|
|
2442
|
+
(0, import_react_native_reanimated4.withTiming)(1, { duration }, () => {
|
|
2443
|
+
if (closeAfter) {
|
|
2444
|
+
opacity.value = (0, import_react_native_reanimated4.withDelay)(closeAfter, (0, import_react_native_reanimated4.withTiming)(0, { duration }));
|
|
2445
|
+
}
|
|
2446
|
+
})
|
|
2447
|
+
);
|
|
2448
|
+
}, [opacity, duration, delay, closeAfter, isActive]);
|
|
2449
|
+
return {
|
|
2450
|
+
animatedStyle
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
|
|
2454
|
+
// ../src/Components/Animators/hooks/useFloatAnimation.ts
|
|
2455
|
+
var import_react25 = require("react");
|
|
2456
|
+
var import_react_native25 = require("react-native");
|
|
2457
|
+
var import_react_native_reanimated5 = require("react-native-reanimated");
|
|
2458
|
+
var useFloatAnimation = ({
|
|
2459
|
+
duration = 800,
|
|
2460
|
+
delay = 0,
|
|
2461
|
+
closeAfter = null,
|
|
2462
|
+
closeDuration = 600,
|
|
2463
|
+
floatDistance = 10,
|
|
2464
|
+
floatDuration = 1200
|
|
2465
|
+
} = {}) => {
|
|
2466
|
+
const opacity = (0, import_react_native_reanimated5.useSharedValue)(0);
|
|
2467
|
+
const translateY = (0, import_react_native_reanimated5.useSharedValue)(0);
|
|
2468
|
+
const { isActive } = useAppState_default();
|
|
2469
|
+
const isFloating = (0, import_react25.useRef)(false);
|
|
2470
|
+
const animatedStyle = (0, import_react_native_reanimated5.useAnimatedStyle)(() => {
|
|
2471
|
+
return {
|
|
2472
|
+
opacity: opacity.value,
|
|
2473
|
+
transform: [{ translateY: translateY.value }]
|
|
2474
|
+
};
|
|
2475
|
+
});
|
|
2476
|
+
const startFloating = () => {
|
|
2477
|
+
if (!isFloating.current) {
|
|
2478
|
+
isFloating.current = true;
|
|
2479
|
+
translateY.value = (0, import_react_native_reanimated5.withRepeat)(
|
|
2480
|
+
(0, import_react_native_reanimated5.withSequence)(
|
|
2481
|
+
(0, import_react_native_reanimated5.withTiming)(-floatDistance, {
|
|
2482
|
+
duration: floatDuration / 2,
|
|
2483
|
+
easing: import_react_native_reanimated5.Easing.inOut(import_react_native_reanimated5.Easing.quad)
|
|
2484
|
+
}),
|
|
2485
|
+
(0, import_react_native_reanimated5.withTiming)(floatDistance, {
|
|
2486
|
+
duration: floatDuration,
|
|
2487
|
+
easing: import_react_native_reanimated5.Easing.inOut(import_react_native_reanimated5.Easing.quad)
|
|
2488
|
+
}),
|
|
2489
|
+
(0, import_react_native_reanimated5.withTiming)(0, {
|
|
2490
|
+
duration: floatDuration / 2,
|
|
2491
|
+
easing: import_react_native_reanimated5.Easing.inOut(import_react_native_reanimated5.Easing.quad)
|
|
2492
|
+
})
|
|
2493
|
+
),
|
|
2494
|
+
-1,
|
|
2495
|
+
false
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
(0, import_react25.useEffect)(() => {
|
|
2500
|
+
if (!isActive && import_react_native25.Platform.OS === "ios") {
|
|
2501
|
+
opacity.value = 0;
|
|
2502
|
+
translateY.value = 0;
|
|
2503
|
+
isFloating.current = false;
|
|
2504
|
+
return;
|
|
2505
|
+
}
|
|
2506
|
+
opacity.value = (0, import_react_native_reanimated5.withDelay)(
|
|
2507
|
+
delay,
|
|
2508
|
+
(0, import_react_native_reanimated5.withTiming)(1, { duration }, () => {
|
|
2509
|
+
"worklet";
|
|
2510
|
+
(0, import_react_native_reanimated5.runOnJS)(startFloating)();
|
|
2511
|
+
})
|
|
2512
|
+
);
|
|
2513
|
+
if (closeAfter) {
|
|
2514
|
+
const totalDelay = delay + duration + closeAfter;
|
|
2515
|
+
opacity.value = (0, import_react_native_reanimated5.withDelay)(
|
|
2516
|
+
totalDelay,
|
|
2517
|
+
(0, import_react_native_reanimated5.withTiming)(0, { duration: closeDuration })
|
|
2518
|
+
);
|
|
2519
|
+
translateY.value = (0, import_react_native_reanimated5.withDelay)(
|
|
2520
|
+
totalDelay,
|
|
2521
|
+
(0, import_react_native_reanimated5.withTiming)(0, { duration: closeDuration })
|
|
2522
|
+
);
|
|
2523
|
+
}
|
|
2524
|
+
return () => {
|
|
2525
|
+
opacity.value = 0;
|
|
2526
|
+
translateY.value = 0;
|
|
2527
|
+
isFloating.current = false;
|
|
2528
|
+
};
|
|
2529
|
+
}, [
|
|
2530
|
+
duration,
|
|
2531
|
+
delay,
|
|
2532
|
+
closeAfter,
|
|
2533
|
+
closeDuration,
|
|
2534
|
+
floatDistance,
|
|
2535
|
+
floatDuration,
|
|
2536
|
+
isActive
|
|
2537
|
+
]);
|
|
2538
|
+
return {
|
|
2539
|
+
animatedStyle
|
|
2540
|
+
};
|
|
2541
|
+
};
|
|
2542
|
+
|
|
2543
|
+
// ../src/Components/Animators/hooks/useGrowAnimation.ts
|
|
2544
|
+
var import_react26 = require("react");
|
|
2545
|
+
var import_react_native26 = require("react-native");
|
|
2546
|
+
var import_react_native_reanimated6 = require("react-native-reanimated");
|
|
2547
|
+
var useGrowAnimation = ({
|
|
2548
|
+
duration = 500,
|
|
2549
|
+
delay = 0,
|
|
2550
|
+
closeAfter = null,
|
|
2551
|
+
initialScale = 0
|
|
2552
|
+
} = {}) => {
|
|
2553
|
+
const scale = (0, import_react_native_reanimated6.useSharedValue)(initialScale);
|
|
2554
|
+
const { isActive } = useAppState_default();
|
|
2555
|
+
const animatedStyle = (0, import_react_native_reanimated6.useAnimatedStyle)(() => {
|
|
2556
|
+
return {
|
|
2557
|
+
transform: [{ scale: scale.value }]
|
|
2558
|
+
};
|
|
2559
|
+
});
|
|
2560
|
+
(0, import_react26.useEffect)(() => {
|
|
2561
|
+
if (!isActive && import_react_native26.Platform.OS === "ios") {
|
|
2562
|
+
scale.value = initialScale;
|
|
2563
|
+
return;
|
|
2564
|
+
}
|
|
2565
|
+
scale.value = (0, import_react_native_reanimated6.withDelay)(
|
|
2566
|
+
delay,
|
|
2567
|
+
(0, import_react_native_reanimated6.withTiming)(
|
|
2568
|
+
1,
|
|
2569
|
+
{
|
|
2570
|
+
duration,
|
|
2571
|
+
easing: import_react_native_reanimated6.Easing.out(import_react_native_reanimated6.Easing.ease)
|
|
2572
|
+
},
|
|
2573
|
+
() => {
|
|
2574
|
+
if (closeAfter) {
|
|
2575
|
+
scale.value = (0, import_react_native_reanimated6.withDelay)(
|
|
2576
|
+
closeAfter,
|
|
2577
|
+
(0, import_react_native_reanimated6.withTiming)(initialScale, {
|
|
2578
|
+
duration,
|
|
2579
|
+
easing: import_react_native_reanimated6.Easing.out(import_react_native_reanimated6.Easing.ease)
|
|
2580
|
+
})
|
|
2581
|
+
);
|
|
2582
|
+
}
|
|
2583
|
+
}
|
|
2584
|
+
)
|
|
2585
|
+
);
|
|
2586
|
+
}, [scale, duration, delay, closeAfter, initialScale, isActive]);
|
|
2587
|
+
return {
|
|
2588
|
+
animatedStyle
|
|
2589
|
+
};
|
|
2590
|
+
};
|
|
2591
|
+
|
|
2592
|
+
// ../src/Components/Animators/hooks/useRollAnimation.ts
|
|
2593
|
+
var import_react27 = require("react");
|
|
2594
|
+
var import_react_native27 = require("react-native");
|
|
2595
|
+
var import_react_native_reanimated7 = require("react-native-reanimated");
|
|
2596
|
+
var useRollAnimation = ({
|
|
2597
|
+
duration = 500,
|
|
2598
|
+
delay = 0,
|
|
2599
|
+
closeAfter = null,
|
|
2600
|
+
initialTranslateY = 100,
|
|
2601
|
+
initialRotate = "0deg"
|
|
2602
|
+
} = {}) => {
|
|
2603
|
+
const translateY = (0, import_react_native_reanimated7.useSharedValue)(initialTranslateY);
|
|
2604
|
+
const rotate = (0, import_react_native_reanimated7.useSharedValue)(0);
|
|
2605
|
+
const { isActive } = useAppState_default();
|
|
2606
|
+
const animatedStyle = (0, import_react_native_reanimated7.useAnimatedStyle)(() => {
|
|
2607
|
+
const rotateInterpolated = (0, import_react_native_reanimated7.interpolate)(
|
|
2608
|
+
rotate.value,
|
|
2609
|
+
[0, 1],
|
|
2610
|
+
[parseFloat(initialRotate.replace("deg", "")), 360]
|
|
2611
|
+
);
|
|
2612
|
+
return {
|
|
2613
|
+
transform: [
|
|
2614
|
+
{ translateY: translateY.value },
|
|
2615
|
+
{ rotate: `${rotateInterpolated}deg` }
|
|
2616
|
+
]
|
|
2617
|
+
};
|
|
2618
|
+
});
|
|
2619
|
+
(0, import_react27.useEffect)(() => {
|
|
2620
|
+
if (!isActive && import_react_native27.Platform.OS === "ios") {
|
|
2621
|
+
translateY.value = initialTranslateY;
|
|
2622
|
+
rotate.value = 0;
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
translateY.value = (0, import_react_native_reanimated7.withDelay)(
|
|
2626
|
+
delay,
|
|
2627
|
+
(0, import_react_native_reanimated7.withTiming)(0, {
|
|
2628
|
+
duration,
|
|
2629
|
+
easing: import_react_native_reanimated7.Easing.out(import_react_native_reanimated7.Easing.ease)
|
|
2630
|
+
})
|
|
2631
|
+
);
|
|
2632
|
+
rotate.value = (0, import_react_native_reanimated7.withDelay)(
|
|
2633
|
+
delay,
|
|
2634
|
+
(0, import_react_native_reanimated7.withTiming)(
|
|
2635
|
+
1,
|
|
2636
|
+
{
|
|
2637
|
+
duration,
|
|
2638
|
+
easing: import_react_native_reanimated7.Easing.out(import_react_native_reanimated7.Easing.ease)
|
|
2639
|
+
},
|
|
2640
|
+
() => {
|
|
2641
|
+
if (closeAfter) {
|
|
2642
|
+
translateY.value = (0, import_react_native_reanimated7.withDelay)(
|
|
2643
|
+
closeAfter,
|
|
2644
|
+
(0, import_react_native_reanimated7.withTiming)(initialTranslateY, {
|
|
2645
|
+
duration,
|
|
2646
|
+
easing: import_react_native_reanimated7.Easing.out(import_react_native_reanimated7.Easing.ease)
|
|
2647
|
+
})
|
|
2648
|
+
);
|
|
2649
|
+
rotate.value = (0, import_react_native_reanimated7.withDelay)(
|
|
2650
|
+
closeAfter,
|
|
2651
|
+
(0, import_react_native_reanimated7.withTiming)(0, {
|
|
2652
|
+
duration,
|
|
2653
|
+
easing: import_react_native_reanimated7.Easing.out(import_react_native_reanimated7.Easing.ease)
|
|
2654
|
+
})
|
|
2655
|
+
);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
)
|
|
2659
|
+
);
|
|
2660
|
+
}, [
|
|
2661
|
+
translateY,
|
|
2662
|
+
rotate,
|
|
2663
|
+
duration,
|
|
2664
|
+
delay,
|
|
2665
|
+
closeAfter,
|
|
2666
|
+
initialTranslateY,
|
|
2667
|
+
initialRotate,
|
|
2668
|
+
isActive
|
|
2669
|
+
]);
|
|
2670
|
+
return {
|
|
2671
|
+
animatedStyle
|
|
2672
|
+
};
|
|
2673
|
+
};
|
|
2674
|
+
|
|
2675
|
+
// ../src/Components/Animators/hooks/useSlideAnimation.ts
|
|
2676
|
+
var import_react28 = require("react");
|
|
2677
|
+
var import_react_native28 = require("react-native");
|
|
2678
|
+
var import_react_native_reanimated8 = require("react-native-reanimated");
|
|
2679
|
+
var { width, height } = import_react_native28.Dimensions.get("window");
|
|
2680
|
+
var getInitialPosition = (direction) => {
|
|
2681
|
+
switch (direction) {
|
|
2682
|
+
case "up":
|
|
2683
|
+
return height;
|
|
2684
|
+
case "down":
|
|
2685
|
+
return -height;
|
|
2686
|
+
case "left":
|
|
2687
|
+
return width;
|
|
2688
|
+
case "right":
|
|
2689
|
+
return -width;
|
|
2690
|
+
default:
|
|
2691
|
+
return 0;
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
var useSlideAnimation = ({
|
|
2695
|
+
duration = 1e3,
|
|
2696
|
+
delay = 0,
|
|
2697
|
+
direction = "up",
|
|
2698
|
+
closeAfter,
|
|
2699
|
+
initialValue
|
|
2700
|
+
} = {}) => {
|
|
2701
|
+
const translateValue = (0, import_react_native_reanimated8.useSharedValue)(0);
|
|
2702
|
+
const { isActive } = useAppState_default();
|
|
2703
|
+
const animatedStyle = (0, import_react_native_reanimated8.useAnimatedStyle)(() => {
|
|
2704
|
+
const slideStyle = direction === "up" || direction === "down" ? { transform: [{ translateY: translateValue.value }] } : { transform: [{ translateX: translateValue.value }] };
|
|
2705
|
+
return slideStyle;
|
|
2706
|
+
});
|
|
2707
|
+
(0, import_react28.useEffect)(() => {
|
|
2708
|
+
if (!isActive && import_react_native28.Platform.OS === "ios") {
|
|
2709
|
+
const initialPosition2 = initialValue || getInitialPosition(direction);
|
|
2710
|
+
translateValue.value = initialPosition2;
|
|
2711
|
+
return;
|
|
2712
|
+
}
|
|
2713
|
+
const initialPosition = initialValue || getInitialPosition(direction);
|
|
2714
|
+
translateValue.value = initialPosition;
|
|
2715
|
+
translateValue.value = (0, import_react_native_reanimated8.withDelay)(
|
|
2716
|
+
delay,
|
|
2717
|
+
(0, import_react_native_reanimated8.withTiming)(0, {
|
|
2718
|
+
duration,
|
|
2719
|
+
easing: import_react_native_reanimated8.Easing.out(import_react_native_reanimated8.Easing.ease)
|
|
2720
|
+
})
|
|
2721
|
+
);
|
|
2722
|
+
if (closeAfter) {
|
|
2723
|
+
translateValue.value = (0, import_react_native_reanimated8.withDelay)(
|
|
2724
|
+
closeAfter + duration + delay,
|
|
2725
|
+
(0, import_react_native_reanimated8.withTiming)(initialPosition, {
|
|
2726
|
+
duration,
|
|
2727
|
+
easing: import_react_native_reanimated8.Easing.out(import_react_native_reanimated8.Easing.ease)
|
|
2728
|
+
})
|
|
2729
|
+
);
|
|
2730
|
+
}
|
|
2731
|
+
}, [
|
|
2732
|
+
translateValue,
|
|
2733
|
+
duration,
|
|
2734
|
+
delay,
|
|
2735
|
+
direction,
|
|
2736
|
+
closeAfter,
|
|
2737
|
+
initialValue,
|
|
2738
|
+
isActive
|
|
2739
|
+
]);
|
|
2740
|
+
return {
|
|
2741
|
+
animatedStyle
|
|
2742
|
+
};
|
|
2743
|
+
};
|
|
2744
|
+
|
|
2745
|
+
// ../src/Components/Animators/hooks/useThrownUpAnimation.ts
|
|
2746
|
+
var import_react29 = require("react");
|
|
2747
|
+
var import_react_native29 = require("react-native");
|
|
2748
|
+
var import_react_native_reanimated9 = require("react-native-reanimated");
|
|
2749
|
+
var useThrownUpAnimation = ({
|
|
2750
|
+
delay = 0,
|
|
2751
|
+
closeAfter = null
|
|
2752
|
+
} = {}) => {
|
|
2753
|
+
const translateY = (0, import_react_native_reanimated9.useSharedValue)(600);
|
|
2754
|
+
const opacity = (0, import_react_native_reanimated9.useSharedValue)(0);
|
|
2755
|
+
const isUnmounting = (0, import_react29.useRef)(false);
|
|
2756
|
+
const { isActive } = useAppState_default();
|
|
2757
|
+
const animatedStyle = (0, import_react_native_reanimated9.useAnimatedStyle)(() => {
|
|
2758
|
+
return {
|
|
2759
|
+
transform: [{ translateY: translateY.value }],
|
|
2760
|
+
opacity: opacity.value
|
|
2761
|
+
};
|
|
2762
|
+
});
|
|
2763
|
+
(0, import_react29.useEffect)(() => {
|
|
2764
|
+
if (!isActive && import_react_native29.Platform.OS === "ios") {
|
|
2765
|
+
translateY.value = 600;
|
|
2766
|
+
opacity.value = 0;
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
translateY.value = (0, import_react_native_reanimated9.withDelay)(
|
|
2770
|
+
delay,
|
|
2771
|
+
(0, import_react_native_reanimated9.withSpring)(0, {
|
|
2772
|
+
velocity: 1,
|
|
2773
|
+
stiffness: 100,
|
|
2774
|
+
damping: 15
|
|
2775
|
+
})
|
|
2776
|
+
);
|
|
2777
|
+
opacity.value = (0, import_react_native_reanimated9.withDelay)(delay, (0, import_react_native_reanimated9.withTiming)(1, { duration: 500 }));
|
|
2778
|
+
if (closeAfter) {
|
|
2779
|
+
translateY.value = (0, import_react_native_reanimated9.withDelay)(
|
|
2780
|
+
closeAfter,
|
|
2781
|
+
(0, import_react_native_reanimated9.withSpring)(800, {
|
|
2782
|
+
velocity: 1,
|
|
2783
|
+
stiffness: 200,
|
|
2784
|
+
damping: 20
|
|
2785
|
+
})
|
|
2786
|
+
);
|
|
2787
|
+
opacity.value = (0, import_react_native_reanimated9.withDelay)(closeAfter, (0, import_react_native_reanimated9.withTiming)(0, { duration: 500 }));
|
|
2788
|
+
}
|
|
2789
|
+
return () => {
|
|
2790
|
+
translateY.value = 600;
|
|
2791
|
+
opacity.value = 0;
|
|
2792
|
+
isUnmounting.current = true;
|
|
2793
|
+
};
|
|
2794
|
+
}, [translateY, opacity, delay, closeAfter, isActive]);
|
|
2795
|
+
return {
|
|
2796
|
+
animatedStyle
|
|
2797
|
+
};
|
|
2798
|
+
};
|
|
2799
|
+
|
|
2800
|
+
// ../src/Components/Animators/Animator.tsx
|
|
2801
|
+
var import_react30 = __toESM(require("react"));
|
|
2802
|
+
var import_react_native_reanimated10 = __toESM(require("react-native-reanimated"));
|
|
2803
|
+
var Animator = (props) => {
|
|
2804
|
+
const { children, type, duration, delay, closeAfter, style = {} } = props;
|
|
2805
|
+
const getAnimationStyle = () => {
|
|
2806
|
+
switch (type) {
|
|
2807
|
+
case "fade":
|
|
2808
|
+
return useFadeAnimation({ duration, delay, closeAfter });
|
|
2809
|
+
case "grow":
|
|
2810
|
+
return useGrowAnimation({
|
|
2811
|
+
duration,
|
|
2812
|
+
delay,
|
|
2813
|
+
closeAfter,
|
|
2814
|
+
initialScale: props.initialScale
|
|
2815
|
+
});
|
|
2816
|
+
case "slide":
|
|
2817
|
+
return useSlideAnimation({
|
|
2818
|
+
duration,
|
|
2819
|
+
delay,
|
|
2820
|
+
direction: props.direction,
|
|
2821
|
+
closeAfter,
|
|
2822
|
+
initialValue: props.initialValue
|
|
2823
|
+
});
|
|
2824
|
+
case "blink":
|
|
2825
|
+
return useBlinkAnimation({
|
|
2826
|
+
delay,
|
|
2827
|
+
blinkDuration: props.blinkDuration,
|
|
2828
|
+
minOpacity: props.minOpacity,
|
|
2829
|
+
maxOpacity: props.maxOpacity
|
|
2830
|
+
});
|
|
2831
|
+
case "float":
|
|
2832
|
+
return useFloatAnimation({
|
|
2833
|
+
duration,
|
|
2834
|
+
delay,
|
|
2835
|
+
closeAfter,
|
|
2836
|
+
closeDuration: props.closeDuration,
|
|
2837
|
+
floatDistance: props.floatDistance,
|
|
2838
|
+
floatDuration: props.floatDuration
|
|
2839
|
+
});
|
|
2840
|
+
case "roll":
|
|
2841
|
+
return useRollAnimation({
|
|
2842
|
+
duration,
|
|
2843
|
+
delay,
|
|
2844
|
+
closeAfter,
|
|
2845
|
+
initialTranslateY: props.initialTranslateY,
|
|
2846
|
+
initialRotate: props.initialRotate
|
|
2847
|
+
});
|
|
2848
|
+
case "thrownup":
|
|
2849
|
+
return useThrownUpAnimation({ delay, closeAfter });
|
|
2850
|
+
default:
|
|
2851
|
+
return { animatedStyle: {} };
|
|
2852
|
+
}
|
|
2853
|
+
};
|
|
2854
|
+
const { animatedStyle } = getAnimationStyle();
|
|
2855
|
+
return /* @__PURE__ */ import_react30.default.createElement(import_react_native_reanimated10.default.View, { style: [style, animatedStyle] }, children);
|
|
2856
|
+
};
|
|
2857
|
+
|
|
2322
2858
|
// index.ts
|
|
2323
2859
|
var HoddyUI = {
|
|
2324
2860
|
initialize
|
|
@@ -2328,6 +2864,7 @@ var next_default = HoddyUI;
|
|
|
2328
2864
|
0 && (module.exports = {
|
|
2329
2865
|
AdaptiveStatusBar,
|
|
2330
2866
|
AlertX,
|
|
2867
|
+
Animator,
|
|
2331
2868
|
Avatar,
|
|
2332
2869
|
Button,
|
|
2333
2870
|
CheckBox,
|
|
@@ -2354,9 +2891,17 @@ var next_default = HoddyUI;
|
|
|
2354
2891
|
getPredictionsFromCoords,
|
|
2355
2892
|
getPredictionsFromQuery,
|
|
2356
2893
|
showFlashMessage,
|
|
2894
|
+
useAppState,
|
|
2895
|
+
useBlinkAnimation,
|
|
2357
2896
|
useColors,
|
|
2897
|
+
useFadeAnimation,
|
|
2898
|
+
useFloatAnimation,
|
|
2899
|
+
useGrowAnimation,
|
|
2358
2900
|
useNavScreenOptions,
|
|
2901
|
+
useRollAnimation,
|
|
2902
|
+
useSlideAnimation,
|
|
2359
2903
|
useTheme,
|
|
2360
|
-
useThemeContext
|
|
2904
|
+
useThemeContext,
|
|
2905
|
+
useThrownUpAnimation
|
|
2361
2906
|
});
|
|
2362
2907
|
//# sourceMappingURL=index.js.map
|