Skip to content

Instantly share code, notes, and snippets.

@vishalnarkhede
Created April 7, 2020 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishalnarkhede/ff57edf4c77b6cde117044a6ff97e42e to your computer and use it in GitHub Desktop.
Save vishalnarkhede/ff57edf4c77b6cde117044a6ff97e42e to your computer and use it in GitHub Desktop.
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