-
Notifications
You must be signed in to change notification settings - Fork 374
Expand file tree
/
Copy pathChannelPreview.tsx
More file actions
59 lines (54 loc) · 1.37 KB
/
ChannelPreview.tsx
File metadata and controls
59 lines (54 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react';
import { StyleSheet, View } from 'react-native';
import {
ChannelPreviewMessenger,
ChannelPreviewMessengerProps,
ChannelPreviewStatus,
ChannelPreviewStatusProps,
Pin,
useChannelMembershipState,
useTheme,
} from 'stream-chat-react-native';
const styles = StyleSheet.create({
leftSwipeableButton: {
paddingLeft: 16,
paddingRight: 8,
paddingVertical: 20,
},
rightSwipeableButton: {
paddingLeft: 8,
paddingRight: 16,
paddingVertical: 20,
},
swipeableContainer: {
alignItems: 'center',
flexDirection: 'row',
},
statusContainer: {
display: 'flex',
flexDirection: 'row',
},
pinIconContainer: {
marginLeft: 8,
},
});
const CustomChannelPreviewStatus = (props: ChannelPreviewStatusProps) => {
const { channel } = props;
const membership = useChannelMembershipState(channel);
const {
theme: { semantics },
} = useTheme();
return (
<View style={styles.statusContainer}>
<ChannelPreviewStatus {...props} />
{membership.pinned_at && (
<View style={styles.pinIconContainer}>
<Pin height={24} width={24} stroke={semantics.textSecondary} />
</View>
)}
</View>
);
};
export const ChannelPreview: React.FC<ChannelPreviewMessengerProps> = (props) => {
return <ChannelPreviewMessenger {...props} PreviewStatus={CustomChannelPreviewStatus} />;
};