blob: eeb1a7d69c9acbb45b00c59c6b8bcd7b9988a707 (
plain)
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
|
import {useBottomTabBarHeight} from '@react-navigation/bottom-tabs';
import {StackNavigationProp, useHeaderHeight} from '@react-navigation/stack';
import React, {useContext} from 'react';
import {StyleSheet, View} from 'react-native';
import {
Channel,
Chat,
MessageInput,
MessageList,
} from 'stream-chat-react-native';
import {ChatContext} from '../../App';
import {MainStackParams} from '../../routes';
type ChatScreenNavigationProp = StackNavigationProp<MainStackParams, 'Chat'>;
interface ChatScreenProps {
navigation: ChatScreenNavigationProp;
}
/*
* Screen that displays all of the user's active conversations.
*/
const ChatScreen: React.FC<ChatScreenProps> = () => {
const {channel, chatClient} = useContext(ChatContext);
const headerHeight = useHeaderHeight();
const tabbarHeight = useBottomTabBarHeight();
return (
<View style={[styles.container, {paddingBottom: tabbarHeight}]}>
<Chat client={chatClient}>
<Channel channel={channel} keyboardVerticalOffset={headerHeight}>
<MessageList onThreadSelect={() => {}} />
<MessageInput />
</Channel>
</Chat>
</View>
);
};
const styles = StyleSheet.create({
container: {
backgroundColor: 'white',
},
});
export default ChatScreen;
|