stream-chat-react-native icon indicating copy to clipboard operation
stream-chat-react-native copied to clipboard

[🐛] iOS. deletedMessagesVisibilityType='never' breaks FlatList on message delete

Open nemrosim opened this issue 6 months ago • 0 comments

Issue

Adding deletedMessagesVisibilityType={'never'} to Channels component...

https://github.com/GetStream/stream-chat-react-native/blob/4912ce99e59a3b9ae5100836ad18636bfe640622/examples/ExpoMessaging/app/channel/%5Bcid%5D/thread/%5Bcid%5D/index.tsx#L16-L27

  return (
    <SafeAreaView>
      <Stack.Screen options={{ title: 'Thread Screen' }} />

      <Channel
        audioRecordingEnabled={true}
        channel={channel}
        keyboardVerticalOffset={headerHeight}
        thread={thread}
        threadList
+     deletedMessagesVisibilityType={'never'}
      >

... will break list on iOS devices after deleting the only last thread message.

https://github.com/user-attachments/assets/5d5dfbdd-5c3c-4f1c-a8e2-61e85f8b57c8

If wait a bit we will get an infinite loop and a warning in console:

 Message pagination request failed with error [Error: StreamChat error code 9: GetReplies failed with error: "Too many requests, check response headers for more information."]
Image

After removing maintainVisibleContentPosition styles in MessageList.tsx file -> issue will be gone. https://github.com/GetStream/stream-chat-react-native/blob/e2a01e9375267b97a7b552055edaf4548c9ef551/package/src/components/MessageList/MessageList.tsx#L1228-L1245

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to Main Chat App (iOS simulator/device. No issues on Android)
  2. Click on any message, reply in Thread, and delete that only reply message.
  3. See error etc...

Expected behavior

User should not see any UI glitches, infinite scroll event and there should be no pagination request failed with error warnings.

https://github.com/user-attachments/assets/44c3ae6c-9596-453c-ad25-4ae1796d6abc

Project Related Information

Customization

Click To Expand

# N/A

Offline support

  • [ ] I have enabled offline support.
  • [ ] The feature I'm having does not occur when offline support is disabled. (stripe out if not applicable)

Environment

Click To Expand

package.json:

# N/A

react-native info output:

System:
  OS: macOS 15.4.1
  CPU: (12) arm64 Apple M2 Pro
  Memory: 188.75 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 8.19.4
    path: ~/Documents/Projects/CHAT-DEMO/stream-chat-react-native/node_modules/.bin/npm
  Watchman:
    version: 2025.04.28.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods: Not Found
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.12816248
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /Users/artemdiashkin/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: ^18.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.77.1
    wanted: 0.77.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

  • 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
    • [ ] Both
  • stream-chat-react-native version you're using that has this issue:
    • e.g. 5.4.3
  • 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

https://github.com/user-attachments/assets/5257425b-88e4-4f22-892a-e50a45f61a2e

Image

nemrosim avatar May 27 '25 12:05 nemrosim