stream-chat-react-native-core
Version:
The official React Native and Expo components for Stream Chat, a service for building chat applications
116 lines • 4.99 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EmptyStateIndicator = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _ComponentsContext = require("../../contexts/componentsContext/ComponentsContext");
var _ThemeContext = require("../../contexts/themeContext/ThemeContext");
var _TranslationContext = require("../../contexts/translationContext/TranslationContext");
var _theme = require("../../theme");
var _jsxRuntime = require("react/jsx-runtime");
var _jsxFileName = "/home/runner/work/stream-chat-react-native/stream-chat-react-native/package/src/components/Indicators/EmptyStateIndicator.tsx";
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
var EmptyStateIndicator = ({
listType
}) => {
var _useTheme = (0, _ThemeContext.useTheme)(),
_useTheme$theme = _useTheme.theme,
_useTheme$theme$empty = _useTheme$theme.emptyStateIndicator,
channelContainer = _useTheme$theme$empty.channelContainer,
channelTitle = _useTheme$theme$empty.channelTitle,
messageContainer = _useTheme$theme$empty.messageContainer,
messageTitle = _useTheme$theme$empty.messageTitle,
semantics = _useTheme$theme.semantics;
var _useComponentsContext = (0, _ComponentsContext.useComponentsContext)(),
icons = _useComponentsContext.icons;
var _useTranslationContex = (0, _TranslationContext.useTranslationContext)(),
t = _useTranslationContex.t;
var styles = useStyles();
switch (listType) {
case 'channel':
return (0, _jsxRuntime.jsxs)(_reactNative.View, {
style: [styles.container, channelContainer],
children: [(0, _jsxRuntime.jsx)(icons.MessageBubbleEmpty, {
height: 27,
stroke: semantics.textTertiary,
width: 25
}), (0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [styles.channelTitle, channelTitle],
testID: "empty-channel-state-title",
children: t('No conversations yet')
})]
});
case 'message':
return (0, _jsxRuntime.jsxs)(_reactNative.View, {
style: [styles.container, messageContainer],
children: [(0, _jsxRuntime.jsx)(icons.MessageBubbleEmpty, {
height: 27,
stroke: semantics.textTertiary,
width: 25
}), (0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [styles.messageTitle, messageTitle],
children: t('No chats here yet…')
})]
});
case 'threads':
return (0, _jsxRuntime.jsxs)(_reactNative.View, {
style: styles.container,
children: [(0, _jsxRuntime.jsx)(icons.MessageBubbleEmpty, {
height: 27,
stroke: semantics.textTertiary,
width: 25
}), (0, _jsxRuntime.jsx)(_reactNative.Text, {
style: styles.threadText,
children: t('Reply to a message to start a thread')
})]
});
default:
return (0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [{
color: semantics.textSecondary
}, messageContainer],
children: t('No items exist')
});
}
};
exports.EmptyStateIndicator = EmptyStateIndicator;
var useStyles = () => {
var _useTheme2 = (0, _ThemeContext.useTheme)(),
semantics = _useTheme2.theme.semantics;
return (0, _react.useMemo)(() => {
return _reactNative.StyleSheet.create({
channelDetails: {
fontSize: 14,
textAlign: 'center'
},
channelTitle: {
color: semantics.textSecondary,
fontSize: _theme.primitives.typographyFontSizeMd,
fontWeight: _theme.primitives.typographyFontWeightRegular,
lineHeight: _theme.primitives.typographyLineHeightNormal,
textAlign: 'center',
paddingVertical: _theme.primitives.spacingSm
},
container: {
alignItems: 'center',
flex: 1,
justifyContent: 'center'
},
messageTitle: {
fontSize: 20,
fontWeight: 'bold',
paddingBottom: 8
},
threadText: {
color: semantics.textSecondary,
fontSize: _theme.primitives.typographyFontSizeMd,
fontWeight: _theme.primitives.typographyFontWeightRegular,
lineHeight: _theme.primitives.typographyLineHeightNormal,
textAlign: 'center',
paddingVertical: _theme.primitives.spacingSm
}
});
}, [semantics]);
};
//# sourceMappingURL=EmptyStateIndicator.js.map