@nguyentc21/react-native-tooltip
Version:
Simple tooltip for React native app
36 lines (35 loc) • 1.52 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = require("react");
var _default = params => {
const {
tooltipPosition,
placement
} = params;
return (0, _react.useMemo)(() => {
const wrapContainerStyles = {
top: tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.top,
left: tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.left,
bottom: tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.bottom,
right: tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.right
};
const containerStyles = [placement === 'top' && {
flexDirection: 'column'
}, placement === 'bottom' && {
flexDirection: 'column-reverse'
}, placement === 'left' && {
flexDirection: 'row'
}, placement === 'right' && {
flexDirection: 'row-reverse'
}];
return {
wrapContainerStyles,
containerStyles
};
}, [tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.top, tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.left, tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.bottom, tooltipPosition === null || tooltipPosition === void 0 ? void 0 : tooltipPosition.right, placement]);
};
exports.default = _default;
//# sourceMappingURL=useContainerStyles.js.map