If this View is persisted when changing channels, and the channelObj changes to a new channel, the MessageList does not automatically update in most circumstances.
The exception to this is if you start using MessageInput to send messages. Once you "send a message," switching channels works as expected. However, if you load up a channel on a fresh boot without ever sending a message, the UI will not appropriately update until you send a message.
Steps to reproduce
Steps to reproduce the behavior:
Create a persistent View with Channel, MessageList, and MessageInput
Select a new channel in a popup modal, such that the View in question is not destroyed
Observe that messages shown in the View are still showing the old channel
Send a message, observe that the View will immediately update to show the correct channels in the new channel
Expected behavior
I expect to be able to see the messages in a newly selected channel in a View without destroying it and without needing to send a message.
[ ] The feature I'm having does not occur when offline support is disabled. (stripe out if not applicable)
Environment
Click To Expand
#### `package.json`:
```json
# N/A
```
**`react-native info` output:**
```
OUTPUT GOES HERE
```
- **Platform that you're experiencing the issue on**:
- [] iOS
- [ ] Android
- [X] **iOS** but have not tested behavior on Android
- [ ] **Android** but have not tested behavior on iOS
- [ ] Both
- **`stream-chat-react-native` version you're using that has this issue:**
- 5.33.1
- Device/Emulator info:
- [ ] I am using a physical device
- OS version: `e.g. Android 10`
- Device/Emulator: `e.g. iPhone 11`
Issue
If you have a view with the following structure:
If this View is persisted when changing channels, and the channelObj changes to a new channel, the MessageList does not automatically update in most circumstances.
The exception to this is if you start using MessageInput to send messages. Once you "send a message," switching channels works as expected. However, if you load up a channel on a fresh boot without ever sending a message, the UI will not appropriately update until you send a message.
Steps to reproduce
Steps to reproduce the behavior:
Expected behavior
I expect to be able to see the messages in a newly selected channel in a View without destroying it and without needing to send a message.
Project Related Information
Customization
Click To Expand
```typescript jsx try { const channels = await chatClient.queryChannels( { type: "community", id: { $eq: newChannel.id } }, [], { watch: true, state: true, }, ); const channel = channels[0]; setChannel(channel); } catch (error) { console.error(error); }
{channel && (
),
}}
inverted={false}
onListScroll={onScroll}
HeaderComponent={CustomHeader}
ScrollToBottomButton={empty}
/>
)}
```
Offline support
Environment
Click To Expand
#### `package.json`: ```json # N/A ``` **`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [] iOS - [ ] Android - [X] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`stream-chat-react-native` version you're using that has this issue:** - 5.33.1 - Device/Emulator info: - [ ] I am using a physical device - OS version: `e.g. Android 10` - Device/Emulator: `e.g. iPhone 11`
Additional context
Screenshots
Click To Expand