Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typing in chat freezes the app on Android #1810

Closed
gregssdev opened this issue Nov 15, 2022 · 29 comments · Fixed by #1964
Closed

Typing in chat freezes the app on Android #1810

gregssdev opened this issue Nov 15, 2022 · 29 comments · Fixed by #1964
Assignees
Labels
Android Only Issue that only concern Android platform

Comments

@gregssdev
Copy link

Describe the bug
On Android when you type some message, a long message it will freeze the app at a random interval of time

Dev environment info (please complete/provide the following information):

  • Package version (stream-chat-react-native): 5.0.0
  • react-native: 0.66.3
  • Device/Emulator: Android (Any)

To Reproduce
Steps to reproduce the behavior:

  1. Go to Message Input
  2. Type something random around 100-200 words
  3. If the app didn't freeze, clear a few words and start typing again for a while
  4. App will freeze

Expected behavior
App should run smoothly

@billnbell
Copy link

Is there a limit in SQLite or in Android ?

@vishalnarkhede
Copy link
Contributor

limit for?

@vishalnarkhede
Copy link
Contributor

@billnbell what props are you passing the Channel component? Could you show me some code?

@billnbell
Copy link

I am not having any issues @gregssdev is

@vishalnarkhede
Copy link
Contributor

vishalnarkhede commented Nov 19, 2022

@billnbell what props are you passing the Channel component? Could you show me some code?

@gregssdev for you

@vishalnarkhede vishalnarkhede added the Needs More Information Further information needed from the requester label Nov 19, 2022
@gregssdev
Copy link
Author

I used these props

        AutoCompleteSuggestionItem
        AutoCompleteSuggestionHeader
        channel
        disableKeyboardCompatibleView
        DateHeader
        deletedMessagesVisibiltyType
        doMarkReadRequest
        forceAlignMessages
        giphyEnabled
        hasFilePicker
        InlineUnreadIndicator
        InputButtons
        mentionAllAppUsersEnabled
        mentionAllAppUsersQuery
        MessageFooter
        MessageSimple
        MessageStatus
        MessageSystem
        ReactionList
        Reply
        SendButton
        ScrollToBottomButton
        SendMessageDisallowedIndicator
        supportedReactions
        TypingIndicator

@vishalnarkhede
Copy link
Contributor

It's hard to point out without looking at the implementation of these props. But I can give few tips:

  • Avoid using ChannelContext on message level custom components e.g, MessageSimple, MessageStatus etc
  • Avoid passing inline functions as custom component or inline objects/arrays as props
  • You might need to do some profiling using Flipper to check if there is any particular component causing overhead for the app

@1987cr
Copy link

1987cr commented Nov 21, 2022

Maybe related to this facebook/react-native#35350?

@vishalnarkhede
Copy link
Contributor

hmm interesting....

@hannojg
Copy link

hannojg commented Nov 22, 2022

Does it happen for you guys on any android version? For us this issue only happens on android 13 (aka. API 33)

@atsss
Copy link
Contributor

atsss commented Dec 5, 2022

Any updates on it? We're also struggling with freezing chat only on Android.

@santhoshvai
Copy link
Member

@atsss @gregssdev I guess both of you are running android 13 (aka. API 33) ?

@atsss
Copy link
Contributor

atsss commented Dec 6, 2022

Yes. It's happening on android 13.

@Eigilak
Copy link

Eigilak commented Dec 15, 2022

Same. We only experience this on 33 aka Pixel devices!
We are on 0.70.5

@vanGalilea
Copy link
Contributor

vanGalilea commented Dec 20, 2022

Hey guys, this is a known RN/Android issue, and we're still awaiting it.

@vanGalilea vanGalilea added the Android Only Issue that only concern Android platform label Dec 20, 2022
@santhoshvai santhoshvai removed Needs More Information Further information needed from the requester Needs Triaging labels Jan 5, 2023
@mi-fa
Copy link

mi-fa commented Jan 25, 2023

Hi! Are there any updates on resolving this issue?

@nathancoleman
Copy link

Is there any sort of workaround for this? Chat is basically unusable for our impacted users on Android.

@billnbell
Copy link

What version are you using ?

@billnbell
Copy link

billnbell commented Jan 26, 2023

What I meant by limit is: 200 words being stored in SQLite might hit a 64K limit. Also there might be a limit in the REST call back to Getstream. Did you try this on IOS? Does it do the same thing?

Also, can you set an input limit to like like 2K or something?

@billnbell
Copy link

billnbell commented Jan 26, 2023

Can someone submit a repo that is small so we can see it? Something like an app.tsx, and Chat ?

@gpahal
Copy link

gpahal commented Jan 27, 2023

We are facing the same issue. We have a simple chat screen using stream. Something like this:

<StreamChannel
  {...props}
  initialValue={messages[channelId]}
  onChangeText={debounce((value) => {
    updateCache(channelId, value)
  }, 300)}
>
  <MessageList
    {...listProps}
  />
  <MessageInput />
  <MessageActions {...actionProps} />
</StreamChannel>

After interacting a bit with the message input the screen completely freezes. This is fixed by adding inverted={false} to the MessageList

<StreamChannel
  {...props}
  initialValue={messages[channelId]}
  onChangeText={debounce((value) => {
    updateCache(channelId, value)
  }, 300)}
>
  <MessageList
    inverted={false}
    {...listProps}
  />
  <MessageInput />
  <MessageActions {...actionProps} />
</StreamChannel>

@vanGalilea
Copy link
Contributor

Can someone submit a repo that is small so we can see it? Something like an app.tsx, and Chat ?

The fastest way to achieve that is with the following command to create a new RN project with Stream chat in it:

npx react-native init StreamChatApp --template react-native-stream-chat-template

More information about how to run the template after initialization can be found here

@atsss
Copy link
Contributor

atsss commented Feb 6, 2023

Do you have any plans to fix the problem like that temporarily? Because our android customer is having difficulties with typing and it's so critical for chatting.

facebook/react-native#35350 (comment)

@vanGalilea
Copy link
Contributor

vanGalilea commented Feb 7, 2023

This is not a proper solution, but you can think about the following fix until RN introduces an official fix
You can patch React Native and create your inverted flat list containing the right styling. More info in this PR.
After creating your new and improved FlatList, you can pass it to Channel under the prop FlatList.

One BIG drawback is that bi-directional lazy loading will not work anymore.

We keep on monitoring this issue here and, will think along when a proper solution will be introduced.

@nathancoleman
Copy link

nathancoleman commented Feb 8, 2023

@vanGalilea is there any workaround that can happen in the stream-chat-react-native library so that we're not having to patch React Native and create custom components? We're paying a large amount of money for Stream every month, and our Android users are having a bad experience due to this bug. I realize the root issue is outside of this project; however, that doesn't change the fact that we're paying for a broken product right now.

@nathancoleman
Copy link

So excited to consume that workaround @santhoshvai, thanks!

@santhoshvai
Copy link
Member

Hey everyone, We have released a workaround in 5.11.0-beta.2. Can anyone please upgrade to that version and try it out. If confirmed, we will release it to stable. This workaround seemed to work in our pixel 7 device, but we would like confirmation from users before releasing it.

@santhoshvai
Copy link
Member

@nathancoleman 😊 Please try the workaround and report if it works please. We have also contacted other customers to try it out and we intend to ship this to stable asap.

@nathancoleman
Copy link

@santhoshvai I've confirmed that I can no longer reproduce the issue on my Pixel 4a with the beta release installed 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Only Issue that only concern Android platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.