Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Commit 5ab5989

Browse files
committed
docs: rephrasing and tweaking
1 parent 26d7f3d commit 5ab5989

File tree

1 file changed

+15
-21
lines changed

1 file changed

+15
-21
lines changed

docusaurus/docs/reactnative/guides/channel_background_customization.mdx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@ sidebar_position: 13
44
title: Channel Background Customization
55
---
66

7-
You can implement this customization in your existing app or create a new one by running the following
8-
9-
```shell
10-
npx react-native init MyApp --template stream-chat-react-native-template
11-
```
12-
137
## Basic Custom Background
148

15-
You can change the background statically by simply wrapping `MessageList` and `MessageInput` by using the `ImageBackground` component.
9+
You can change the background statically by wrapping `MessageList` and `MessageInput` by using the `ImageBackground` component.
1610

1711
<img
1812
src='https://user-images.githubusercontent.com/25864161/167857632-c0bc9d67-0a84-4cf5-9d75-305e3bcd1f3d.png'
@@ -25,6 +19,14 @@ Also make sure you adjust the `theme` correctly.
2519
import { Channel, MessageInput, MessageList, ThemeProvider } from 'stream-chat-react-native';
2620
import { ImageBackground } from 'react-native';
2721

22+
export const theme = {
23+
messageList: {
24+
container: {
25+
backgroundColor: 'transparent',
26+
},
27+
},
28+
};
29+
2830
const IMAGE_URI =
2931
'https://images.unsplash.com/photo-1549125764-91425ca48850?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8NjF8fHxlbnwwfHx8fA%3D%3D&auto=format&fit=crop&w=800&q=60';
3032

@@ -43,21 +45,13 @@ const ChannelScreen = ({ channel }) => (
4345
</Channel>
4446
</ThemeProvider>
4547
);
46-
47-
export const theme = {
48-
messageList: {
49-
container: {
50-
backgroundColor: 'transparent',
51-
},
52-
},
53-
};
5448
```
5549

5650
---
5751

5852
## Custom Background With Selection Screen
5953

60-
In this step, we will add a button that will navigate to a separate screen, where the user will be able to select his
54+
In this step, we will add a button that will navigate to a separate screen, where the user will be able to select their
6155
favorite background image for a specific channel.
6256

6357
<table>
@@ -90,7 +84,7 @@ Follow the [installation steps](https://github.com/mrousavy/react-native-mmkv#in
9084
We will start by creating our `ChannelBackgroundView` component.
9185
This component will be in charge of rendering the custom background by retrieving it from our key-value store.
9286
We save an object to a key-value store to be scalable and future-proof.
93-
You'd might want to add other preferences later, such as dimming value, background color, etc.
87+
You might want to add other preferences later, such as dimming value, background color, etc.
9488

9589
```tsx
9690
import type { ViewProps } from 'react-native';
@@ -109,14 +103,14 @@ const ChannelBackgroundView = ({
109103
channelId: string;
110104
} & ViewProps) => {
111105
const [channelPreferences] = useMMKVObject<ChannelPreferences>(channelId);
112-
let uri: string | undefined = channelPreferences?.imageUri || DEFAULT_BACKGROUND_URI;
106+
const uri = channelPreferences?.imageUri || DEFAULT_BACKGROUND_URI;
113107

114108
return <ImageBackground {...props} source={{ uri }} />;
115109
};
116110
```
117111

118112
We will then use it in our previously built `ChannelScreen`.
119-
Replace the static `ImageBackground` with `ChannelBackgroundView` and pass the `channelId`
113+
Replace the static `ImageBackground` with `ChannelBackgroundView` and pass the `channelId`.
120114

121115
```tsx
122116
const ChannelScreen = ({ channel }) => {
@@ -240,7 +234,7 @@ There are alternative approaches to achieve the same goal, for example by saving
240234

241235
### Add a configuration button
242236

243-
We will add now a button that will take the user from the Channel screen to our new WallpaperOverview screen
237+
We will now add a button that will take the user from the Channel screen to our new WallpaperOverview screen.
244238

245239
```tsx
246240
import { useNavigation } from '@react-navigation/native';
@@ -293,7 +287,7 @@ export const theme = {
293287

294288
### Optional: Connect all screens by navigation
295289

296-
If applicable to your use case, add our screens to a Navigation Stack by doing the following.
290+
If applicable to your use case, add our screens to a Navigation Stack by doing the following:
297291

298292
```tsx
299293
import { createNativeStackNavigator } from 'react-native-screens/native-stack';

0 commit comments

Comments
 (0)