diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-09 17:15:29 -0400 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-04-09 17:15:29 -0400 |
commit | 347e9e450268e4897b8dd241721b84945d9e2ec9 (patch) | |
tree | 58334be3724398c886365e99901e4442f5657172 /src/screens/chat/ChatScreen.tsx | |
parent | 097b515066f1a0c38cb7fb69cf78b16b945594e5 (diff) | |
parent | 3ec56863bfdd47b2ee8d0f0fe5a45be779508660 (diff) |
Merge branch 'master' into tma756-bugfix-onpress-tagg-on-sp
# Conflicts:
# src/components/taggs/TaggsBar.tsx
Diffstat (limited to 'src/screens/chat/ChatScreen.tsx')
-rw-r--r-- | src/screens/chat/ChatScreen.tsx | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/screens/chat/ChatScreen.tsx b/src/screens/chat/ChatScreen.tsx new file mode 100644 index 00000000..59c53c99 --- /dev/null +++ b/src/screens/chat/ChatScreen.tsx @@ -0,0 +1,53 @@ +import {useBottomTabBarHeight} from '@react-navigation/bottom-tabs'; +import {StackNavigationProp} from '@react-navigation/stack'; +import React, {useContext} from 'react'; +import {StyleSheet} from 'react-native'; +import {SafeAreaView} from 'react-native-safe-area-context'; +import { + Channel, + Chat, + MessageInput, + MessageList, +} from 'stream-chat-react-native'; +import {ChatContext} from '../../App'; +import ChatHeader from '../../components/messages/ChatHeader'; +import {MainStackParams} from '../../routes'; +import {isIPhoneX} from '../../utils'; + +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 tabbarHeight = useBottomTabBarHeight(); + + return ( + <SafeAreaView + style={[ + styles.container, + // unable to figure out the padding issue, a hacky solution + {paddingBottom: isIPhoneX() ? tabbarHeight + 20 : tabbarHeight + 50}, + ]}> + <ChatHeader /> + <Chat client={chatClient}> + <Channel channel={channel} keyboardVerticalOffset={0}> + <MessageList onThreadSelect={() => {}} /> + <MessageInput /> + </Channel> + </Chat> + </SafeAreaView> + ); +}; + +const styles = StyleSheet.create({ + container: { + backgroundColor: 'white', + flex: 1, + }, +}); + +export default ChatScreen; |