stream-chat-react-native-core
Version:
The official React Native and Expo components for Stream Chat, a service for building chat applications
20 lines • 599 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useIsSvg = exports.isSvgUri = void 0;
var _react = require("react");
var isSvgUri = uri => {
if (typeof uri !== 'string' || uri.length === 0) {
return false;
}
var lower = uri.toLowerCase();
if (lower.startsWith('data:image/svg+xml')) {
return true;
}
var pathOnly = lower.split('#')[0].split('?')[0];
return pathOnly.endsWith('.svg');
};
exports.isSvgUri = isSvgUri;
var useIsSvg = uri => (0, _react.useMemo)(() => isSvgUri(uri), [uri]);
exports.useIsSvg = useIsSvg;
//# sourceMappingURL=useIsSvg.js.map