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

[screen-capture] Fix crash on bridgeless #28244

Merged
merged 2 commits into from
Apr 17, 2024

Conversation

alanjhughes
Copy link
Collaborator

Why

Fixes a crash on bridgeless caused by accessing the activity too early

How

Refactored to register the listener when the user first uses the api.

Test Plan

bare-expo on bridgeless. Crash does not occur and the module works as expected

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Apr 16, 2024
@expo-bot
Copy link
Collaborator

expo-bot commented Apr 16, 2024

The Pull Request introduced fingerprint changes against the base commit: b30d376

Fingerprint diff
[
  {
    "type": "dir",
    "filePath": "../../packages/expo-screen-capture/android",
    "reasons": [
      "expoAutolinkingAndroid"
    ],
    "hash": "aec51f980b0e08b59e09ec7b98ed9a8bf6617e2d"
  }
]

Generated by PR labeler 🤖

@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Apr 16, 2024
@alanjhughes alanjhughes marked this pull request as ready for review April 16, 2024 21:06
@@ -32,7 +33,6 @@ class ScreenCaptureModule : Module() {
screenCaptureCallback = Activity.ScreenCaptureCallback {
sendEvent(eventName)
}
currentActivity.registerScreenCaptureCallback(currentActivity.mainExecutor, screenCaptureCallback!!)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that, in theory, the current activity should be available at this point. Maybe it's connected with #28200? I'm okay with merging your fix, but generally speaking, I don't like that the order of initialization was changed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It could be. AFAIK it's an upstream issue that Kudo has brought up with them. I just made this change for now because this is the only module that stops the app from running on bridgeless.

@alanjhughes alanjhughes merged commit ab7aaf6 into main Apr 17, 2024
20 checks passed
@alanjhughes alanjhughes deleted the @alanhughes/screen-capture/fix-bridgeless branch April 17, 2024 10:07
@brentvatne brentvatne added the published Changes from the PR have been published to npm label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: fingerprint changed bot: passed checks ExpoBot has nothing to complain about published Changes from the PR have been published to npm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants