@nguyentc21/react-native-tooltip
Version:
Simple tooltip for React native app
25 lines • 865 B
JavaScript
import { useMemo } from 'react';
import findTooltipPlacement from '../utils/tooltip/findTooltipPlacement';
import { DEFAULT_SAFE_AREA_INSETS } from '../constants';
export default ({
placement,
forcePlacement,
safeAreaInsets = DEFAULT_SAFE_AREA_INSETS,
dimension,
targetContentLayout,
tooltipContentLayout,
borderRadius
}) => {
return useMemo(() => {
if (!targetContentLayout || forcePlacement) return placement;
return findTooltipPlacement({
tooltipContentLayout,
targetContentLayout,
dimension,
placement,
borderRadius,
safeAreaInsets
});
}, [placement, forcePlacement, dimension.width, dimension.height, safeAreaInsets.top, safeAreaInsets.bottom, safeAreaInsets.left, safeAreaInsets.right, targetContentLayout, tooltipContentLayout, borderRadius]);
};
//# sourceMappingURL=useFinalPlacement.js.map