Skip to content

Commit 50bafb5

Browse files
authored
Merge pull request #2294 from gluestack/release/@gluestack-ui/tooltip@0.1.32
Release/@gluestack UI/tooltip@0.1.32
2 parents 54e2461 + 811e100 commit 50bafb5

File tree

9 files changed

+71
-38
lines changed

9 files changed

+71
-38
lines changed

example/storybook-nativewind/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@gluestack-style/animation-resolver": "^1.0.4",
3333
"@gluestack-style/react": "^1.0.57",
3434
"@gluestack-ui/config": "^1.1.19",
35-
"@gluestack-ui/themed": "^1.1.35",
35+
"@gluestack-ui/themed": "^1.1.36",
3636
"@gluestack/design-system": "^0.5.36",
3737
"@gorhom/bottom-sheet": "^5.0.0-alpha.10",
3838
"@legendapp/motion": "^2.2.0",

example/storybook-nativewind/src/core-components/nativewind/tooltip/index.tsx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,6 @@ export const TooltipContent = React.forwardRef(
105105
return (
106106
<UITooltip.Content
107107
ref={ref}
108-
initial={{
109-
opacity: 0,
110-
scale: 0.5,
111-
}}
112-
animate={{
113-
opacity: 1,
114-
scale: 1,
115-
}}
116-
exit={{
117-
opacity: 0,
118-
scale: 0.5,
119-
}}
120-
transition={{
121-
type: 'spring',
122-
damping: 18,
123-
stiffness: 50,
124-
opacity: {
125-
type: 'timing',
126-
duration: 250,
127-
},
128-
}}
129108
{...props}
130109
className={tooltipContentStyle({
131110
class: className,

packages/config/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@
6666
"@gluestack-ui/switch": "0.1.22",
6767
"@gluestack-ui/tabs": "0.1.16",
6868
"@gluestack-ui/textarea": "0.1.23",
69-
"@gluestack-ui/themed": "1.1.35",
69+
"@gluestack-ui/themed": "1.1.36",
7070
"@gluestack-ui/toast": "1.0.6",
71-
"@gluestack-ui/tooltip": "0.1.31",
71+
"@gluestack-ui/tooltip": "0.1.32",
7272
"@legendapp/motion": "latest"
7373
},
7474
"peerDependencies": {
7575
"@gluestack-style/react": ">=1.0.57",
76-
"@gluestack-ui/themed": ">=1.1.35"
76+
"@gluestack-ui/themed": ">=1.1.36"
7777
},
7878
"release-it": {
7979
"git": {

packages/themed/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @gluestack-ui/themed
22

3+
## 1.1.36
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @gluestack-ui/tooltip@0.1.32
9+
310
## 1.1.35
411

512
### Patch Changes

packages/themed/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gluestack-ui/themed",
3-
"version": "1.1.35",
3+
"version": "1.1.36",
44
"main": "build/index.js",
55
"types": "build/index.d.ts",
66
"module": "build/index",
@@ -66,7 +66,7 @@
6666
"@gluestack-ui/tabs": "0.1.16",
6767
"@gluestack-ui/textarea": "0.1.23",
6868
"@gluestack-ui/toast": "1.0.6",
69-
"@gluestack-ui/tooltip": "0.1.31",
69+
"@gluestack-ui/tooltip": "0.1.32",
7070
"@legendapp/motion": "latest"
7171
},
7272
"devDependencies": {

packages/unstyled/tooltip/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @gluestack-ui/tooltip
22

3+
## 0.1.32
4+
5+
### Patch Changes
6+
7+
- - Fixed tooltip animation
8+
- Changed default delay to 350ms
9+
310
## 0.1.31
411

512
### Patch Changes

packages/unstyled/tooltip/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@gluestack-ui/tooltip",
33
"description": "A universal headless tooltip component for React Native, Next.js & React",
4-
"version": "0.1.31",
4+
"version": "0.1.32",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
77
"types": "lib/typescript/index.d.ts",

packages/unstyled/tooltip/src/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function Tooltip<StyledTooltipProp>(
1919
defaultIsOpen = false,
2020
onClose,
2121
onOpen,
22-
openDelay = 0,
22+
openDelay = 350,
2323
closeDelay = 0,
2424
placement = 'bottom',
2525
children,

packages/unstyled/tooltip/src/TooltipContent.tsx

Lines changed: 49 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export function TooltipContent<StyledTooltipContentProps>(
2121
shouldOverlapWithTrigger,
2222
} = value;
2323
const overlayRef = React.useRef(null);
24-
const { overlayProps } = useOverlayPosition({
25-
placement,
26-
targetRef,
27-
overlayRef,
28-
crossOffset,
29-
offset,
30-
shouldOverlapWithTrigger,
31-
shouldFlip,
32-
});
24+
const { overlayProps, placement: calculatedPlacement } = useOverlayPosition(
25+
{
26+
placement,
27+
targetRef,
28+
overlayRef,
29+
crossOffset,
30+
offset,
31+
shouldOverlapWithTrigger,
32+
shouldFlip,
33+
}
34+
);
3335

3436
if (Object.keys(overlayProps.style).length === 0) {
3537
overlayProps.style = {
@@ -39,14 +41,52 @@ export function TooltipContent<StyledTooltipContentProps>(
3941
}
4042
const mergedRef = mergeRefs([ref, overlayRef]);
4143

44+
const initialAnimatedStyles = {
45+
opacity: 0,
46+
scale: 0.9,
47+
y:
48+
calculatedPlacement === 'top'
49+
? 6
50+
: calculatedPlacement === 'bottom'
51+
? -6
52+
: 0,
53+
x:
54+
calculatedPlacement === 'right'
55+
? -6
56+
: calculatedPlacement === 'left'
57+
? 6
58+
: 0,
59+
};
60+
61+
const animatedStyles = {
62+
opacity: 1,
63+
y: 0,
64+
scale: 1,
65+
x: 0,
66+
};
67+
68+
const exitAnimatedStyles = {
69+
opacity: 0,
70+
x: 0,
71+
y: 0,
72+
};
73+
4274
return (
4375
<OverlayAnimatePresence
4476
visible={isOpen}
4577
AnimatePresence={AnimatePresence}
4678
>
4779
<StyledTooltipContent
80+
initial={initialAnimatedStyles}
81+
animate={animatedStyles}
82+
exit={exitAnimatedStyles}
83+
transition={{
84+
type: 'timing',
85+
duration: 100,
86+
}}
4887
{...props}
4988
ref={mergedRef}
89+
key={placement + calculatedPlacement}
5090
role={Platform.OS === 'web' ? 'tooltip' : undefined}
5191
style={[overlayProps.style, { position: 'absolute' }, style]}
5292
>

0 commit comments

Comments
 (0)