@momo-kits/animated-tooltip 0.154.1-beta.16 → 0.154.1-beta.17
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.tsx +5 -20
- package/package.json +15 -15
- package/styles.ts +8 -4
- package/types.ts +2 -7
package/index.tsx
CHANGED
|
@@ -7,14 +7,7 @@ import React, {
|
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react';
|
|
10
|
-
import {
|
|
11
|
-
Animated,
|
|
12
|
-
Easing,
|
|
13
|
-
TouchableOpacity,
|
|
14
|
-
useWindowDimensions,
|
|
15
|
-
View,
|
|
16
|
-
ViewStyle,
|
|
17
|
-
} from 'react-native';
|
|
10
|
+
import { Animated, Easing, TouchableOpacity, View, ViewStyle } from 'react-native';
|
|
18
11
|
import {
|
|
19
12
|
Colors,
|
|
20
13
|
Icon,
|
|
@@ -43,13 +36,11 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
|
|
|
43
36
|
accessibilityLabel,
|
|
44
37
|
onVisibleChange,
|
|
45
38
|
onPressClose,
|
|
46
|
-
containerStyle,
|
|
47
39
|
},
|
|
48
40
|
ref,
|
|
49
41
|
) {
|
|
50
42
|
const app = useContext<any>(MiniAppContext);
|
|
51
43
|
const screen = useContext<any>(ScreenContext);
|
|
52
|
-
const SCREEN_WIDTH = useWindowDimensions().width;
|
|
53
44
|
const arrowSize = 6;
|
|
54
45
|
const [tooltipSize, setTooltipSize] = useState({ width: 0, height: 0 });
|
|
55
46
|
|
|
@@ -193,6 +184,7 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
|
|
|
193
184
|
? { bottom: 0 }
|
|
194
185
|
: { top: centerVerticalOffset };
|
|
195
186
|
|
|
187
|
+
const resolvedBackground = Colors.black_17;
|
|
196
188
|
const resolvedTextColor = Colors.black_01;
|
|
197
189
|
|
|
198
190
|
const renderButtons = () => {
|
|
@@ -283,11 +275,7 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
|
|
|
283
275
|
return (
|
|
284
276
|
<View style={styles.content}>
|
|
285
277
|
<View style={styles.contentHeader}>
|
|
286
|
-
<View
|
|
287
|
-
style={{
|
|
288
|
-
maxWidth: SCREEN_WIDTH - Spacing.M * 2 - 48,
|
|
289
|
-
}}
|
|
290
|
-
>
|
|
278
|
+
<View style={styles.contentTextContainer}>
|
|
291
279
|
{title ? (
|
|
292
280
|
<Text
|
|
293
281
|
typography={'header_s_semibold'}
|
|
@@ -331,7 +319,7 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
|
|
|
331
319
|
{
|
|
332
320
|
width: size * 2,
|
|
333
321
|
height: size * 2,
|
|
334
|
-
backgroundColor:
|
|
322
|
+
backgroundColor: resolvedBackground,
|
|
335
323
|
transform: [{ rotate: '45deg' }],
|
|
336
324
|
borderRadius: size / 2,
|
|
337
325
|
},
|
|
@@ -394,16 +382,13 @@ const Tooltip = forwardRef<TooltipRef, TooltipProps>(function Tooltip(
|
|
|
394
382
|
<Animated.View
|
|
395
383
|
pointerEvents="auto"
|
|
396
384
|
style={[
|
|
397
|
-
{
|
|
398
|
-
maxWidth: SCREEN_WIDTH - Spacing.M * 2,
|
|
399
|
-
},
|
|
400
|
-
containerStyle,
|
|
401
385
|
styles.tooltip,
|
|
402
386
|
placementStyle,
|
|
403
387
|
alignStyle,
|
|
404
388
|
{
|
|
405
389
|
opacity: animatedValue,
|
|
406
390
|
transform: [translate],
|
|
391
|
+
backgroundColor: resolvedBackground,
|
|
407
392
|
},
|
|
408
393
|
]}
|
|
409
394
|
onLayout={event => setTooltipSize(event.nativeEvent.layout)}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
2
|
+
"name": "@momo-kits/animated-tooltip",
|
|
3
|
+
"version": "0.154.1-beta.17",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "index.tsx",
|
|
6
|
+
"dependencies": {},
|
|
7
|
+
"peerDependencies": {
|
|
8
|
+
"@momo-kits/foundation": "latest",
|
|
9
|
+
"react": "*",
|
|
10
|
+
"react-native": "*"
|
|
11
|
+
},
|
|
12
|
+
"license": "MoMo",
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"registry": "https://registry.npmjs.org/"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/styles.ts
CHANGED
|
@@ -11,6 +11,7 @@ export default StyleSheet.create({
|
|
|
11
11
|
padding: Spacing.M,
|
|
12
12
|
backgroundColor: Colors.black_17,
|
|
13
13
|
borderRadius: Radius.S,
|
|
14
|
+
width: 256,
|
|
14
15
|
},
|
|
15
16
|
text: {
|
|
16
17
|
color: Colors.black_01,
|
|
@@ -24,10 +25,10 @@ export default StyleSheet.create({
|
|
|
24
25
|
flexDirection: 'column',
|
|
25
26
|
},
|
|
26
27
|
title: {
|
|
27
|
-
marginBottom: Spacing.
|
|
28
|
+
marginBottom: Spacing.XS / 2,
|
|
28
29
|
},
|
|
29
30
|
description: {
|
|
30
|
-
marginBottom: Spacing.
|
|
31
|
+
marginBottom: Spacing.XS / 2,
|
|
31
32
|
},
|
|
32
33
|
buttonsRow: {
|
|
33
34
|
flexDirection: 'row',
|
|
@@ -36,8 +37,8 @@ export default StyleSheet.create({
|
|
|
36
37
|
marginTop: Spacing.M,
|
|
37
38
|
},
|
|
38
39
|
button: {
|
|
39
|
-
marginRight: Spacing.
|
|
40
|
-
marginBottom: Spacing.
|
|
40
|
+
marginRight: Spacing.XS / 2,
|
|
41
|
+
marginBottom: Spacing.XS / 2,
|
|
41
42
|
},
|
|
42
43
|
textButton: {},
|
|
43
44
|
iconButton: {},
|
|
@@ -52,6 +53,9 @@ export default StyleSheet.create({
|
|
|
52
53
|
contentHeader: {
|
|
53
54
|
flexDirection: 'row',
|
|
54
55
|
},
|
|
56
|
+
contentTextContainer: {
|
|
57
|
+
flex: 1,
|
|
58
|
+
},
|
|
55
59
|
closeIconSpacing: {
|
|
56
60
|
marginLeft: Spacing.S,
|
|
57
61
|
},
|
package/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
1
|
+
import {ReactNode} from 'react';
|
|
3
2
|
|
|
4
3
|
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
|
|
5
4
|
|
|
@@ -78,9 +77,5 @@ export type TooltipProps = {
|
|
|
78
77
|
* Triggered when the close button (X) is pressed.
|
|
79
78
|
*/
|
|
80
79
|
onPressClose?: () => void;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Tooltip container style.
|
|
84
|
-
*/
|
|
85
|
-
containerStyle?: ViewStyle;
|
|
86
80
|
};
|
|
81
|
+
|