@nguyentc21/react-native-tooltip
Version:
Simple tooltip for React native app
15 lines • 739 B
JavaScript
export default params => {
const {
targetContentLayout,
tooltipContentLayout
} = params;
const halfTargetHeight = targetContentLayout.height * 0.5;
const halfTooltipHeight = ((tooltipContentLayout === null || tooltipContentLayout === void 0 ? void 0 : tooltipContentLayout.height) || 0) * 0.5;
const halfTargetWidth = targetContentLayout.width * 0.5;
const halfTooltipWidth = ((tooltipContentLayout === null || tooltipContentLayout === void 0 ? void 0 : tooltipContentLayout.width) || 0) * 0.5;
return {
offsetY: targetContentLayout.pageY + halfTargetHeight - halfTooltipHeight,
offsetX: targetContentLayout.pageX + halfTargetWidth - halfTooltipWidth
};
};
//# sourceMappingURL=calculateTooltipOffset.js.map