|
1 | 1 | import React, { useMemo } from 'react'; |
2 | | -import { StyleSheet, View, ViewStyle } from 'react-native'; |
3 | 2 | import Animated, { useAnimatedStyle } from 'react-native-reanimated'; |
4 | 3 |
|
5 | 4 | import { useLayout } from '../../hooks'; |
| 5 | +import { getPositionStyles } from '../../utils'; |
6 | 6 | import type { TooltipWrapperProps } from '../../types'; |
7 | | -import { getPointerWrapperStyle, getPositionStyles } from '../../utils'; |
8 | 7 |
|
9 | | -import Pointer from '../Pointer'; |
| 8 | +import PointerWrapper from '../PointerWrapper'; |
10 | 9 |
|
11 | 10 | import styles from './styles'; |
12 | 11 |
|
@@ -37,22 +36,17 @@ const TooltipWrapperComponent: React.FC<TooltipWrapperProps> = (props) => { |
37 | 36 | }); |
38 | 37 | }, [layout, position, props]); |
39 | 38 |
|
40 | | - const pointerStyles = useMemo(() => { |
41 | | - return StyleSheet.flatten<ViewStyle>([ |
42 | | - styles.pointer, |
43 | | - getPointerWrapperStyle({ position, ...pointerProps }, layout), |
44 | | - ]); |
45 | | - }, [position, pointerProps, layout]); |
46 | | - |
47 | 39 | return ( |
48 | 40 | <Animated.View |
49 | 41 | onLayout={onLayout} |
50 | 42 | style={[styles.tooltipWrapper, positionStyles, stylez]} |
51 | 43 | > |
52 | 44 | {children} |
53 | | - <View style={pointerStyles}> |
54 | | - <Pointer {...pointerProps} position={position} /> |
55 | | - </View> |
| 45 | + <PointerWrapper |
| 46 | + {...pointerProps} |
| 47 | + tooltipLayout={layout} |
| 48 | + position={position} |
| 49 | + /> |
56 | 50 | </Animated.View> |
57 | 51 | ); |
58 | 52 | }; |
|
0 commit comments