UNPKG

@nguyentc21/react-native-tooltip

Version:
22 lines (21 loc) 873 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _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 }; }; exports.default = _default; //# sourceMappingURL=calculateTooltipOffset.js.map