@nguyentc21/react-native-tooltip
Version:
Simple tooltip for React native app
22 lines (21 loc) • 873 B
JavaScript
;
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