GetStream / stream-chat-react-native

💬 React-Native Chat SDK ➜ Stream Chat. Includes a tutorial on building your own chat app experience using React-Native, React-Navigation and Stream
https://getstream.io/chat/sdk/react-native/
Other
949 stars 321 forks source link

[🐛] Thread messages have gone when a user start typing #2396

Closed atsss closed 7 months ago

atsss commented 7 months ago

Issue

I've updated stream-chat-expo to 5.23.0 and found the issue. When I open a Thread screen and start typing, the messages in the thread have gone. Sometimes they come back when I scroll the screen or send a new message but sometimes they never come back.

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to a Channel screen
  2. Go to a Thread screen
  3. Start typing

Expected behavior

The sent messages keep being in the thread

Project Related Information

Customization

Click To Expand

- Channel.tsx ``` import { View, SafeAreaView } from 'react-native'; import { useEffect, useContext, useCallback } from 'react'; import { Channel, Chat, MessageInput, MessageList, useAttachmentPickerContext, } from 'stream-chat-expo'; import { useHeaderHeight } from '@react-navigation/elements'; import { useNavigation } from '@react-navigation/native'; import type { MessageType } from 'stream-chat-expo'; import { streamI18n } from '../../config/streamI18n'; import { AuthContext } from '../../contexts/AuthContext'; import { useStreamChatContext } from '../../contexts/StreamChatContext'; import type { NavigationProp } from '../../types/navigation'; import type { StreamChatGenerics } from '../../types/streamChat'; function Content() { const { setThread } = useStreamChatContext(); const navigation = useNavigation(); const onThreadSelect = useCallback( (message: MessageType | null) => { setThread(message); navigation.navigate('Thread'); }, [setThread, navigation] ); return ( ); } export function Show() { const { chatClient } = useContext(AuthContext); const { channel, thread } = useStreamChatContext(); const headerHeight = useHeaderHeight(); const { setTopInset } = useAttachmentPickerContext(); useEffect(() => { setTopInset(headerHeight); }, [headerHeight]); return ( ); } ``` - Thread.tsx ``` import { SafeAreaView, View } from 'react-native'; import { useContext } from 'react'; import { Channel, Chat, Thread } from 'stream-chat-expo'; import { AuthContext } from '../../contexts/AuthContext'; import { useStreamChatContext } from '../../contexts/StreamChatContext'; import { streamI18n } from '../../config/streamI18n'; export function Index() { const { chatClient } = useContext(AuthContext); const { channel, setThread, thread } = useStreamChatContext(); return ( setThread(null)} /> ); } ```

Offline support

Environment

Click To Expand

#### `package.json`: ```json "dependencies": { "@expo/vector-icons": "^13.0.0", "@react-navigation/elements": "^1.3.3", "@react-navigation/native": "^6.0.10", "@react-navigation/stack": "^6.2.1", "expo": "^48.0.0", "expo-application": "~5.1.1", "expo-av": "~13.2.1", "expo-clipboard": "~4.1.2", "expo-constants": "~14.2.1", "expo-dev-client": "~2.2.1", "expo-document-picker": "~11.2.2", "expo-file-system": "~15.2.2", "expo-haptics": "~12.2.1", "expo-image-manipulator": "~11.1.1", "expo-image-picker": "~14.1.1", "expo-keep-awake": "~12.0.1", "expo-linking": "~4.0.1", "expo-localization": "~14.1.1", "expo-location": "~15.1.1", "expo-media-library": "~15.2.3", "expo-sharing": "~11.2.2", "expo-splash-screen": "~0.18.2", "expo-status-bar": "~1.4.4", "react": "18.2.0", "react-dom": "18.2.0", "react-native": "0.71.8", "react-native-safe-area-context": "4.5.0", "react-native-screens": "~3.20.0", "react-native-storage": "^1.0.1", "react-native-svg": "13.4.0", "react-native-web": "~0.18.7", "stream-chat-expo": "5.23.0", }, ``` **`react-native info` output:** ``` OUTPUT GOES HERE ``` - **Platform that you're experiencing the issue on**: - [ ] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [x] Both - **`stream-chat-react-native` version you're using that has this issue:** - `"stream-chat-expo": "5.22.1"` - Device/Emulator info: - [ ] I am using a physical device - OS version: - Emulator: `iPhone 12` , `Pixel 3a` , `Pixel 4` , `Pixel6`

Additional context

Screenshots

Click To Expand

- iOS https://github.com/GetStream/stream-chat-react-native/assets/17227480/882be470-791d-4480-97af-216a6c3de283 - Android https://github.com/GetStream/stream-chat-react-native/assets/17227480/fe0691e7-0cdf-4cbb-a139-a38ccd8b8f36


stream-ci-bot commented 7 months ago

:tada: This issue has been resolved in version 5.23.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: