Skip to content

Instantly share code, notes, and snippets.

@vishalnarkhede
Created April 7, 2020 09:56
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/5208c392b246f10784cd660c4949b22a to your computer and use it in GitHub Desktop.
Save vishalnarkhede/5208c392b246f10784cd660c4949b22a to your computer and use it in GitHub Desktop.
import {
Chat,
MessageList,
MessageInput,
Channel,
} from 'stream-chat-react-native';
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}>
<Channel channel={channel}>
<MessageList />
<MessageInput />
</Channel>
</Chat>
</View>
</View>
</SafeAreaView>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment