Skip to content

Commit 66d07b6

Browse files
Adding theme to examples
1 parent abf1bd7 commit 66d07b6

File tree

2 files changed

+58
-22
lines changed

2 files changed

+58
-22
lines changed

examples/ExpoMessaging/App.js

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
MessageInput,
99
ChannelList,
1010
Thread,
11+
CloseButton,
1112
ChannelPreviewMessenger,
1213
} from 'stream-chat-expo';
1314

@@ -16,7 +17,30 @@ import { createAppContainer, createStackNavigator } from 'react-navigation';
1617
const chatClient = new StreamChat('qk4nn7rpcn75');
1718
const userToken =
1819
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYmlsbG93aW5nLWZpcmVmbHktOCJ9.CQTVyJ6INIM8u28BxkneY2gdYpamjLzSVUOTZKzfQlg';
19-
20+
const user = {
21+
id: 'billowing-firefly-8',
22+
name: 'Billowing firefly',
23+
image:
24+
'https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg',
25+
};
26+
// Read more about style customizations at - https://getstream.io/chat/react-native-chat/tutorial/#custom-styles
27+
const theme = {
28+
avatar: {
29+
image: {
30+
size: 32,
31+
},
32+
},
33+
colors: {
34+
primary: 'magenta',
35+
},
36+
spinner: {
37+
css: `
38+
width: 15px;
39+
height: 15px;
40+
`,
41+
},
42+
};
43+
2044

2145
const filters = { type: 'messaging' };
2246
const sort = { last_message_at: -1 };
@@ -34,7 +58,7 @@ class ChannelListScreen extends PureComponent {
3458
render() {
3559
return (
3660
<SafeAreaView>
37-
<Chat client={chatClient}>
61+
<Chat client={chatClient} style={theme}>
3862
<View style={{ display: 'flex', height: '100%', padding: 10 }}>
3963
<ChannelList
4064
filters={filters}
@@ -70,7 +94,7 @@ class ChannelScreen extends PureComponent {
7094

7195
return (
7296
<SafeAreaView>
73-
<Chat client={chatClient}>
97+
<Chat client={chatClient} style={theme}>
7498
<Channel client={chatClient} channel={channel}>
7599
<View style={{ display: 'flex', height: '100%' }}>
76100
<MessageList
@@ -110,7 +134,7 @@ class ThreadScreen extends PureComponent {
110134
borderRadius: 20,
111135
}}
112136
>
113-
<Text>X</Text>
137+
<CloseButton />
114138
</TouchableOpacity>
115139
),
116140
});
@@ -178,12 +202,7 @@ export default class App extends React.Component {
178202
async componentDidMount() {
179203

180204
await chatClient.setUser(
181-
{
182-
id: 'billowing-firefly-8',
183-
name: 'Billowing firefly',
184-
image:
185-
'https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg',
186-
},
205+
user,
187206
userToken,
188207
);
189208

examples/NativeMessaging/App.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,40 @@ import {
88
MessageInput,
99
ChannelList,
1010
Thread,
11+
CloseButton,
1112
ChannelPreviewMessenger,
1213
} from 'stream-chat-react-native';
1314

1415
import { createAppContainer, createStackNavigator } from 'react-navigation';
1516

16-
import { YellowBox } from 'react-native';
17+
// Read more about style customizations at - https://getstream.io/chat/react-native-chat/tutorial/#custom-styles
18+
const theme = {
19+
avatar: {
20+
image: {
21+
size: 32,
22+
},
23+
},
24+
colors: {
25+
primary: 'magenta',
26+
},
27+
spinner: {
28+
css: `
29+
width: 15px;
30+
height: 15px;
31+
`,
32+
},
33+
};
1734

18-
YellowBox.ignoreWarnings(['Remote debugger']);
1935
const chatClient = new StreamChat('qk4nn7rpcn75');
2036
const userToken =
2137
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiYmlsbG93aW5nLWZpcmVmbHktOCJ9.CQTVyJ6INIM8u28BxkneY2gdYpamjLzSVUOTZKzfQlg';
22-
38+
const user = {
39+
id: 'billowing-firefly-8',
40+
name: 'Billowing firefly',
41+
image:
42+
'https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg',
43+
};
44+
2345
const filters = { type: 'messaging' };
2446
const sort = { last_message_at: -1 };
2547
const options = {
@@ -35,7 +57,7 @@ class ChannelListScreen extends PureComponent {
3557
render() {
3658
return (
3759
<SafeAreaView>
38-
<Chat client={chatClient}>
60+
<Chat client={chatClient} style={theme}>
3961
<View style={{ display: 'flex', height: '100%', padding: 10 }}>
4062
<ChannelList
4163
filters={filters}
@@ -71,7 +93,7 @@ class ChannelScreen extends PureComponent {
7193

7294
return (
7395
<SafeAreaView>
74-
<Chat client={chatClient}>
96+
<Chat client={chatClient} style={theme}>
7597
<Channel client={chatClient} channel={channel}>
7698
<View style={{ display: 'flex', height: '100%' }}>
7799
<MessageList
@@ -110,7 +132,7 @@ class ThreadScreen extends PureComponent {
110132
justifyContent: 'center',
111133
borderRadius: 20,
112134
}}>
113-
<Text>X</Text>
135+
<CloseButton />
114136
</TouchableOpacity>
115137
),
116138
});
@@ -176,12 +198,7 @@ export default class App extends React.Component {
176198
async componentDidMount() {
177199

178200
await chatClient.setUser(
179-
{
180-
id: 'billowing-firefly-8',
181-
name: 'Billowing firefly',
182-
image:
183-
'https://stepupandlive.files.wordpress.com/2014/09/3d-animated-frog-image.jpg',
184-
},
201+
user,
185202
userToken,
186203
);
187204

0 commit comments

Comments
 (0)