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

Do not crash when the main activity is unavailable #601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

trne
Copy link

@trne trne commented Nov 1, 2023

Note

This is a dupe of this other PR, which is ready to merge but has merge conflicts that I can't solve because is not on my fork. so since I need this fix ASAP, I'm pushing the same fix on an up to date branch with no conflicts.

Summary

The React Native application context has a method for obtaining the current Android activity, but this sometimes returns null. We believe this happens due to a race condition between the JavaScript engine and the native code, but we aren't completely sure. What we do know is that this situation happens in the wild, since it shows up in our Bugsnag reports.

The fix is to leave the BlurView native component uninitialized in these cases. This prevents it from rendering anything, but that's preferable to crashing the whole app.

Screen Shot

Test Plan

Since we don't have a reproduction case for the crash, we intend to deploy these changes in the next release of our App and then see if our Bugsnag reports are any cleaner.

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added the documentation in README.md
  • I mentioned this change in CHANGELOG.md
  • I updated the typed files (TS and Flow)
  • I added a sample use of the API in the example project (example/App.js)

@trne
Copy link
Author

trne commented Nov 1, 2023

@Titozzz one for you I guess.

@solitarysp
Copy link

I got the same error. Have we solved it?

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.

2 participants