Created
April 7, 2020 13:32
-
-
Save vishalnarkhede/ff57edf4c77b6cde117044a6ff97e42e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ChannelScreen({navigation, route}) { | |
const [channel, setChannel] = useState(null); | |
useEffect(() => { | |
if (!channel) { | |
navigation.openDrawer(); | |
} | |
const channelId = route.params ? route.params.channelId : null; | |
const _channel = chatClient.channel('messaging', channelId); | |
setChannel(_channel); | |
}, [route.params]); | |
return ( | |
<SafeAreaView style={styles.channelScreenSaveAreaView}> | |
<View style={styles.channelScreenContainer}> | |
<ChannelHeader | |
navigation={navigation} | |
channel={channel} | |
client={chatClient} | |
/> | |
<View style={styles.chatContainer}> | |
<Chat client={chatClient} style={streamChatTheme}> | |
<Channel channel={channel}> | |
<MessageList | |
Message={MessageSlack} | |
DateSeparator={DateSeparator} | |
/> | |
<MessageInput | |
Input={InputBox} | |
additionalTextInputProps={{ | |
placeholderTextColor: '#979A9A', | |
placeholder: | |
channel && channel.data.name | |
? 'Message #' + | |
channel.data.name.toLowerCase().replace(' ', '_') | |
: 'Message', | |
}} | |
/> | |
</Channel> | |
</Chat> | |
</View> | |
</View> | |
</SafeAreaView> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment