@nguyentc21/react-native-tooltip
Version:
Simple tooltip for React native app
29 lines • 1.37 kB
JavaScript
import { useMemo } from 'react';
export default params => {
const {
tooltipPosition,
placement
} = params;
return 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]);
};
//# sourceMappingURL=useContainerStyles.js.map