UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

30 lines 1.77 kB
Object.defineProperty(exports, "__esModule", { value: true }); exports.getGalleryImageBorderRadius = getGalleryImageBorderRadius; var _theme = require("../../../theme"); function getGalleryImageBorderRadius({ colIndex, height, invertedDirections, numOfColumns, numOfRows, rowIndex, sizeConfig, width, messageHasOnlyOneMedia = false }) { var isSingleImage = numOfColumns === 1 && numOfRows === 1; var isImageSmallerThanMinContainerSize = isSingleImage && height && width && (height > width && width === sizeConfig.minWidth || height < width && height === sizeConfig.minHeight); var topLeftEdgeExposed = colIndex === 0 && rowIndex === 0; var bottomLeftEdgeExposed = !invertedDirections && colIndex === 0 && rowIndex === numOfRows - 1 || invertedDirections && colIndex === numOfColumns - 1 && rowIndex === 0; var topRightEdgeExposed = !invertedDirections && colIndex === numOfColumns - 1 && rowIndex === 0 || invertedDirections && colIndex === 0 && rowIndex === numOfRows - 1; var bottomRightEdgeExposed = colIndex === numOfColumns - 1 && rowIndex === numOfRows - 1; return { borderTopLeftRadius: !isImageSmallerThanMinContainerSize && topLeftEdgeExposed ? 12 : 8, borderTopRightRadius: !isImageSmallerThanMinContainerSize && topRightEdgeExposed ? 12 : 8, borderBottomLeftRadius: messageHasOnlyOneMedia ? _theme.primitives.radiusNone : !isImageSmallerThanMinContainerSize && bottomLeftEdgeExposed ? _theme.primitives.radiusLg : _theme.primitives.radiusMd, borderBottomRightRadius: messageHasOnlyOneMedia ? _theme.primitives.radiusNone : !isImageSmallerThanMinContainerSize && bottomRightEdgeExposed ? _theme.primitives.radiusLg : _theme.primitives.radiusMd }; } //# sourceMappingURL=getGalleryImageBorderRadius.js.map