@sendbird/uikit-react-native
Version:
Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
70 lines • 1.77 kB
JavaScript
import React from 'react';
import { Platform, TouchableOpacity, View } from 'react-native';
import { Icon, Text, createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';
import { useLocalization } from '../hooks/useContext';
const UnreadMessagesFloating = ({
unreadMessageCount,
visible,
onPressClose
}) => {
const {
STRINGS
} = useLocalization();
const {
select,
palette,
colors
} = useUIKitTheme();
if (unreadMessageCount <= 0 || !visible) return null;
return /*#__PURE__*/React.createElement(View, {
style: [styles.container, {
backgroundColor: select({
dark: palette.background400,
light: palette.background50
})
}]
}, /*#__PURE__*/React.createElement(Text, {
body2: true,
color: colors.onBackground02
}, STRINGS.GROUP_CHANNEL.LIST_FLOATING_UNREAD_MSG(unreadMessageCount)), /*#__PURE__*/React.createElement(TouchableOpacity, {
onPress: onPressClose,
style: {
marginLeft: 4
},
hitSlop: {
top: 12,
bottom: 12,
left: 14,
right: 38
}
}, /*#__PURE__*/React.createElement(Icon, {
icon: 'close',
size: 14
})));
};
const styles = createStyleSheet({
container: {
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'center',
paddingHorizontal: 16,
paddingVertical: 12,
borderRadius: 20,
...Platform.select({
android: {
elevation: 3
},
ios: {
shadowColor: 'black',
shadowRadius: 3,
shadowOffset: {
width: 0,
height: 4
},
shadowOpacity: 0.08
}
})
}
});
export default /*#__PURE__*/React.memo(UnreadMessagesFloating);
//# sourceMappingURL=UnreadMessagesFloating.js.map