diff options
author | Ivan Chen <ivan@tagg.id> | 2021-04-07 16:36:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 16:36:34 -0400 |
commit | 4cf3bc720ebcc0b16d158caf60fbdf091621c327 (patch) | |
tree | 97d8db434060a7bf8579bb2975f9be25331ecb73 /src/App.tsx | |
parent | a3abb3abe322ea84306e1a12cec46972a81a37de (diff) | |
parent | 6db092b4b88a71c53088a14e330ec73e208ad958 (diff) |
Merge pull request #354 from TaggiD-Inc/chat-poc
[POC] Chat
Diffstat (limited to 'src/App.tsx')
-rw-r--r-- | src/App.tsx | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/src/App.tsx b/src/App.tsx index ea3617dc..9510c193 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,18 +1,57 @@ import {NavigationContainer} from '@react-navigation/native'; -import React from 'react'; +import React, {useState} from 'react'; import {Provider} from 'react-redux'; +import {Channel as ChannelType, StreamChat} from 'stream-chat'; +import {OverlayProvider} from 'stream-chat-react-native'; +import {STREAM_CHAT_API} from './constants'; import {navigationRef} from './RootNavigation'; import Routes from './routes'; import store from './store/configureStore'; +import { + ChatContextType, + LocalAttachmentType, + LocalChannelType, + LocalCommandType, + LocalEventType, + LocalMessageType, + LocalResponseType, + LocalUserType, +} from './types'; + +export const ChatContext = React.createContext({} as ChatContextType); const App = () => { + const [channel, setChannel] = useState< + ChannelType< + LocalAttachmentType, + LocalChannelType, + LocalCommandType, + LocalEventType, + LocalMessageType, + LocalResponseType, + LocalUserType + > + >(); + const chatClient = StreamChat.getInstance< + LocalAttachmentType, + LocalChannelType, + LocalCommandType, + LocalEventType, + LocalMessageType, + LocalResponseType, + LocalUserType + >(STREAM_CHAT_API); return ( /** * This is the provider from the redux store, it acts as the root provider for our application */ <Provider store={store}> <NavigationContainer ref={navigationRef}> - <Routes /> + <ChatContext.Provider value={{channel, setChannel, chatClient}}> + <OverlayProvider> + <Routes /> + </OverlayProvider> + </ChatContext.Provider> </NavigationContainer> </Provider> ); |