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

[FIX] Modal freezing app after return from the background #4788

Closed
wants to merge 3 commits into from

Conversation

reinaldonetof
Copy link
Contributor

@reinaldonetof reinaldonetof commented Dec 30, 2022

Proposed changes

This issue was found the first time when the user opened the announcement and the announcement's text is a link. Then the user pressed the link and should open the web browser outside of the app. This behavior was forcing the app to go to the background, then when the user resume the app again and tried to close the modal, the app was freezing. This is a known behavior when using a modal as you can see here: facebook/react-native#32504

However, to do a workaround in this case, we aren't re-render the RoomView at the exact time that the app goes to the background, although we are forced to close the modal when resuming the app again and calling the observable again to the list's query.

Issue(s)

How to test or reproduce

  • Create a channel
  • Add an announcement with only a link: e.g: GitHub: Let’s build from here
  • Click on the announcement
  • Click on the link
  • Go back to the app

Screenshots

Before

Screen.Recording.2022-12-30.at.18.53.51.mov
Screen.Recording.2022-12-30.at.18.54.32.mov

After

Screen.Recording.2022-12-30.at.18.52.44.mov

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Further comments

TC-340

@reinaldonetof reinaldonetof self-assigned this Dec 30, 2022
Copy link
Contributor

@dnlsilva dnlsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be simpler to just disappear the modal before opening the link?

@reinaldonetof
Copy link
Contributor Author

Wouldn't it be simpler to just disappear the modal before opening the link?

yeap, but you need to keep in mind that if you minimize the app, then reopen it again, will freeze the app too. So, the flow to freeze the app isn't only when clicking on the link.

const { appState, theme, insets, route } = this.props;
if (theme !== nextProps.theme) {
return true;
}
if (appState !== nextProps.appState) {
if (appState === 'background' && showAnnouncementModal) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't do this.
It's going to be a mess to remove it later.

What if you just hide the modal before going background?

@reinaldonetof
Copy link
Contributor Author

The pr #4795 is fixing this issue

@reinaldonetof reinaldonetof deleted the fix.modal-freezing-app branch January 4, 2023 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants