File tree Expand file tree Collapse file tree 1 file changed +21
-21
lines changed
package/src/components/ChannelPreview Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Original file line number Diff line number Diff line change @@ -7,22 +7,6 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
77
88import type { DefaultStreamChatGenerics } from '../../types/types' ;
99
10- const styles = StyleSheet . create ( {
11- unreadContainer : {
12- alignItems : 'center' ,
13- borderRadius : 8 ,
14- flexShrink : 1 ,
15- justifyContent : 'center' ,
16- } ,
17- unreadText : {
18- color : '#FFFFFF' ,
19- fontSize : 11 ,
20- fontWeight : '700' ,
21- paddingHorizontal : 5 ,
22- paddingVertical : 1 ,
23- } ,
24- } ) ;
25-
2610export type ChannelPreviewUnreadCountProps <
2711 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
2812> = Pick < ChannelPreviewProps < StreamChatGenerics > , 'channel' > & {
@@ -43,13 +27,29 @@ export const ChannelPreviewUnreadCount = <
4327 } ,
4428 } = useTheme ( ) ;
4529
30+ if ( ! unread ) return null ;
31+
4632 return (
4733 < View style = { [ styles . unreadContainer , { backgroundColor : accent_red } , unreadContainer ] } >
48- { ! ! unread && (
49- < Text numberOfLines = { 1 } style = { [ styles . unreadText , unreadText ] } >
50- { unread > maxUnreadCount ? `${ maxUnreadCount } +` : unread }
51- </ Text >
52- ) }
34+ < Text numberOfLines = { 1 } style = { [ styles . unreadText , unreadText ] } >
35+ { unread > maxUnreadCount ? `${ maxUnreadCount } +` : unread }
36+ </ Text >
5337 </ View >
5438 ) ;
5539} ;
40+
41+ const styles = StyleSheet . create ( {
42+ unreadContainer : {
43+ alignItems : 'center' ,
44+ borderRadius : 8 ,
45+ flexShrink : 1 ,
46+ justifyContent : 'center' ,
47+ } ,
48+ unreadText : {
49+ color : '#FFFFFF' ,
50+ fontSize : 11 ,
51+ fontWeight : '700' ,
52+ paddingHorizontal : 5 ,
53+ paddingVertical : 1 ,
54+ } ,
55+ } ) ;
You can’t perform that action at this time.
0 commit comments