Created
April 7, 2020 09:56
-
-
Save vishalnarkhede/5208c392b246f10784cd660c4949b22a 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
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