@hoddy-ui/core 2.5.10 → 2.5.11

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/next/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoddy-ui/next",
3
- "version": "2.0.52",
3
+ "version": "2.0.58",
4
4
  "description": "Core rich react native components written in typescript, with support for expo-router",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hoddy-ui/core",
3
- "version": "2.5.10",
3
+ "version": "2.5.11",
4
4
  "description": "Core rich react native components written in typescript",
5
5
  "main": "index.ts",
6
6
  "repository": {
@@ -40,9 +40,7 @@ export const useFadeAnimation = ({
40
40
  withTiming(1, { duration }, () => {
41
41
  if (closeAfter) {
42
42
  // Schedule fade-out after closeAfter duration
43
- setTimeout(() => {
44
- opacity.value = withTiming(0, { duration });
45
- }, closeAfter);
43
+ opacity.value = withDelay(closeAfter, withTiming(0, { duration }));
46
44
  }
47
45
  })
48
46
  );
@@ -64,11 +64,6 @@ export const useFloatAnimation = ({
64
64
  }
65
65
  };
66
66
 
67
- const stopFloating = () => {
68
- isFloating.current = false;
69
- translateY.value = withTiming(0, { duration: 200 });
70
- };
71
-
72
67
  useEffect(() => {
73
68
  if (!isActive && Platform.OS === "ios") {
74
69
  opacity.value = 0;
@@ -84,10 +79,15 @@ export const useFloatAnimation = ({
84
79
  startFloating();
85
80
 
86
81
  if (closeAfter) {
87
- setTimeout(() => {
88
- stopFloating();
89
- opacity.value = withTiming(0, { duration: closeDuration });
90
- }, closeAfter);
82
+ opacity.value = withDelay(
83
+ closeAfter,
84
+ withTiming(0, { duration: closeDuration })
85
+ );
86
+ translateY.value = withDelay(
87
+ closeAfter,
88
+ withTiming(0, { duration: closeDuration })
89
+ );
90
+ isFloating.current = false;
91
91
  }
92
92
  })
93
93
  );
@@ -48,12 +48,13 @@ export const useGrowAnimation = ({
48
48
  },
49
49
  () => {
50
50
  if (closeAfter) {
51
- setTimeout(() => {
52
- scale.value = withTiming(initialScale, {
51
+ scale.value = withDelay(
52
+ closeAfter,
53
+ withTiming(initialScale, {
53
54
  duration,
54
55
  easing: Easing.out(Easing.ease),
55
- });
56
- }, closeAfter);
56
+ })
57
+ );
57
58
  }
58
59
  }
59
60
  )
@@ -71,16 +71,20 @@ export const useRollAnimation = ({
71
71
  },
72
72
  () => {
73
73
  if (closeAfter) {
74
- setTimeout(() => {
75
- translateY.value = withTiming(initialTranslateY, {
74
+ translateY.value = withDelay(
75
+ closeAfter,
76
+ withTiming(initialTranslateY, {
76
77
  duration,
77
78
  easing: Easing.out(Easing.ease),
78
- });
79
- rotate.value = withTiming(0, {
79
+ })
80
+ );
81
+ rotate.value = withDelay(
82
+ closeAfter,
83
+ withTiming(0, {
80
84
  duration,
81
85
  easing: Easing.out(Easing.ease),
82
- });
83
- }, closeAfter);
86
+ })
87
+ );
84
88
  }
85
89
  }
86
90
  )
@@ -73,16 +73,13 @@ export const useSlideAnimation = ({
73
73
  );
74
74
 
75
75
  if (closeAfter) {
76
- const timer = setTimeout(() => {
77
- translateValue.value = withTiming(initialPosition, {
76
+ translateValue.value = withDelay(
77
+ closeAfter + duration + delay,
78
+ withTiming(initialPosition, {
78
79
  duration,
79
80
  easing: Easing.out(Easing.ease),
80
- });
81
- }, closeAfter + duration + delay);
82
-
83
- return () => {
84
- clearTimeout(timer);
85
- };
81
+ })
82
+ );
86
83
  }
87
84
  }, [
88
85
  translateValue,
@@ -50,22 +50,19 @@ export const useThrownUpAnimation = ({
50
50
  opacity.value = withDelay(delay, withTiming(1, { duration: 500 }));
51
51
 
52
52
  // Start timer to animate out after duration
53
- let timer: NodeJS.Timeout | null = null;
54
53
  if (closeAfter) {
55
- timer = setTimeout(() => {
56
- if (!isUnmounting.current) {
57
- translateY.value = withSpring(800, {
58
- velocity: 1,
59
- stiffness: 200,
60
- damping: 20,
61
- });
62
- opacity.value = withTiming(0, { duration: 500 });
63
- }
64
- }, closeAfter);
54
+ translateY.value = withDelay(
55
+ closeAfter,
56
+ withSpring(800, {
57
+ velocity: 1,
58
+ stiffness: 200,
59
+ damping: 20,
60
+ })
61
+ );
62
+ opacity.value = withDelay(closeAfter, withTiming(0, { duration: 500 }));
65
63
  }
66
64
 
67
65
  return () => {
68
- if (timer) clearTimeout(timer);
69
66
  translateY.value = 600;
70
67
  opacity.value = 0;
71
68
  isUnmounting.current = true;
@@ -11,8 +11,10 @@ import {
11
11
 
12
12
  import React, { useEffect, useState } from "react";
13
13
  import Animated, {
14
+ CurvedTransition,
14
15
  LinearTransition,
15
16
  runOnJS,
17
+ SequencedTransition,
16
18
  useAnimatedStyle,
17
19
  useSharedValue,
18
20
  withTiming,
@@ -48,7 +50,8 @@ export const Popup: React.FC<PopupProps> = ({
48
50
  const contentTranslateY = useSharedValue(1000);
49
51
 
50
52
  // Memoized keyboard vertical offset based on platform and keyboard state
51
- const keyboardVerticalOffsetValue = Platform.OS === "ios" ? -10 : -bottom * 2;
53
+ const keyboardVerticalOffsetValue =
54
+ Platform.OS === "ios" ? -bottom : -bottom * 2;
52
55
 
53
56
  // Keyboard event listeners
54
57
  useEffect(() => {
@@ -111,11 +114,12 @@ export const Popup: React.FC<PopupProps> = ({
111
114
  },
112
115
  keyboardView: {
113
116
  flex: 1,
117
+ zIndex: 1000,
114
118
  },
115
119
  avoidingView: {
120
+ zIndex: 2,
116
121
  minHeight: typeof sheet === "number" ? sheet : undefined,
117
122
  maxHeight: "90%",
118
- zIndex: 1000,
119
123
  alignSelf: "center",
120
124
  maxWidth: sheet ? undefined : "90%",
121
125
  width: sheet ? "100%" : undefined,
@@ -167,6 +171,7 @@ export const Popup: React.FC<PopupProps> = ({
167
171
  onRequestClose={closeAction}
168
172
  >
169
173
  <UIThemeProvider>
174
+ <Animated.View style={[styles.backdrop, backdropAnimatedStyle]} />
170
175
  <KeyboardAvoidingView
171
176
  style={styles.keyboardView}
172
177
  behavior={Platform.OS === "ios" ? "padding" : "height"}
@@ -176,22 +181,21 @@ export const Popup: React.FC<PopupProps> = ({
176
181
  >
177
182
  <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
178
183
  <View style={styles.root}>
179
- <Animated.View style={[styles.backdrop, backdropAnimatedStyle]} />
180
184
  {open && (
181
185
  <Pressable
182
- style={[StyleSheet.absoluteFill, { zIndex: 2 }]}
186
+ style={[StyleSheet.absoluteFill, { zIndex: 1 }]}
183
187
  onPress={closeAction}
184
188
  />
185
189
  )}
186
190
 
187
191
  <Animated.View
188
192
  style={[styles.avoidingView, contentAnimatedStyle]}
189
- layout={LinearTransition.springify(1)}
193
+ layout={LinearTransition.springify()
194
+ .stiffness(200)
195
+ .mass(0.5)
196
+ .damping(100)}
190
197
  >
191
- <View
192
- // layout={LinearTransition}
193
- style={styles.container}
194
- >
198
+ <View style={styles.container}>
195
199
  {!bare && (
196
200
  <View style={styles.title}>
197
201
  <View style={styles.titleIcon}>