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
/** | |
* | |
* Stream comes with some in-built components for message. | |
* | |
* 1. MessageLivestream - https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageLivestream.js | |
* 2. MessageSimple - https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageSimple.js | |
* 3. MessageTeam - https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageTeam.js | |
* 4. MessageCommerce - https://github.com/GetStream/stream-chat-react/blob/master/src/components/MessageTeam.js | |
* | |
* All these components are exported from 'stream-chat-react' package. |
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
module.exports = { | |
assets: ['./src/fonts/'], | |
}; |
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
# Create a new react-native project with name SlackChatApp */ | |
npx react-native init SlackChatApp | |
# Go to your app directory | |
cd SlackChatApp | |
# Add all the required dependencies for this project | |
yarn add @react-native-community/masked-view@0.1.7 | |
yarn add @react-native-community/netinfo@5.6.2 | |
yarn add @react-navigation/drawer@5.3.2 |
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 React from 'react'; | |
import {View, Text, TouchableOpacity, StyleSheet} from 'react-native'; | |
export const ChannelListItem = ({ | |
channel, | |
setActiveChannelId, | |
changeChannel, | |
isOneOnOneConversation, | |
isUnread, | |
activeChannelId, |
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 React, {useState, useEffect} from 'react'; | |
import { | |
View, | |
Text, | |
SafeAreaView, | |
TextInput, | |
StyleSheet, | |
SectionList, | |
} from 'react-native'; | |
import {ChannelListItem} from './ChannelListItem'; |
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 {ChannelHeader} from './src/components/ChannelHeader'; | |
import React, {useEffect, useState} from 'react'; | |
function ChannelScreen({navigation, route}) { | |
const [channel, setChannel] = useState(null); | |
useEffect(() => { | |
if (!channel) { | |
navigation.openDrawer(); | |
} | |
const channelId = route.params ? route.params.channelId : null; |
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 {StreamChat} from 'stream-chat'; | |
const chatClient = new StreamChat('q95x9hkbyd6p'); | |
const userToken = | |
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoidmlzaGFsIn0.LpDqH6U8V8Qg9sqGjz0bMQvOfWrWKAjPKqeODYM0Elk'; | |
const user = { | |
id: 'vishal', | |
name: 'Vishal', | |
}; |
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(() => { |
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 React from 'react'; | |
import {View, Text, StyleSheet} from 'react-native'; | |
import Moment from 'moment'; | |
export const MessageHeader = props => { | |
return ( | |
<View style={styles.column}> | |
{props.message.attachments.length > 0 && ( | |
<View style={styles.header}> | |
<MessageUserBar {...props} /> |
OlderNewer