diff options
Diffstat (limited to 'src/screens/chat/ChatScreen.tsx')
-rw-r--r-- | src/screens/chat/ChatScreen.tsx | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/screens/chat/ChatScreen.tsx b/src/screens/chat/ChatScreen.tsx index af83f504..eeb1a7d6 100644 --- a/src/screens/chat/ChatScreen.tsx +++ b/src/screens/chat/ChatScreen.tsx @@ -1,7 +1,14 @@ -import React from 'react'; -import {View, StyleSheet, Text} from 'react-native'; -import {StackNavigationProp} from '@react-navigation/stack'; - +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'>; @@ -12,22 +19,25 @@ interface ChatScreenProps { * 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}> - <Text style={styles.placeholder}>I am a chat!</Text> + <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: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - placeholder: { - fontSize: 14, - fontWeight: 'bold', + backgroundColor: 'white', }, }); |