forked from ChannelizeIO/Channelize-React-Native-Redux-Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.js
executable file
·45 lines (36 loc) · 1.12 KB
/
Example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import { App, ConversationList, ConversationWindow, store } from './src';
import { Channelize } from './channelize-websdk/dist/index';
if (process.env.NODE_ENV === 'development') {
GLOBAL.XMLHttpRequest = GLOBAL.originalXMLHttpRequest || GLOBAL.XMLHttpRequest;
console.disableYellowBox = true;
}
const PUBLIC_KEY; //Channelize.io public key
const LOGGEDIN_USER_ID;//User id of loggedin user
const CH_ACCESS_TOKEN; //Channelize access token of loggedin userid
export default class Example extends Component {
constructor(props) {
super(props);
this.state = {
conversation: null
}
}
componentDidMount() {
console.log('app is launched');
}
componentWillUnmount() {
console.log('app is killed');
}
render() {
var client = new Channelize.client({publicKey: PUBLIC_KEY});
return (
<Provider store={store}>
<App client={client} userId={LOGGEDIN_USER_ID} accessToken={CH_ACCESS_TOKEN}>
<ConversationList />
<ConversationWindow />
</App>
</Provider>
);
}
}