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

[SDK 51] expo-sensors 13.0.6 crash #28820

Closed
mlecoq opened this issue May 14, 2024 · 2 comments · Fixed by #28839
Closed

[SDK 51] expo-sensors 13.0.6 crash #28820

mlecoq opened this issue May 14, 2024 · 2 comments · Fixed by #28839
Assignees

Comments

@mlecoq
Copy link

mlecoq commented May 14, 2024

Minimal reproducible example

https://github.com/mlecoq/expo-sensors-issue

What platform(s) does this occur on?

Android

Did you reproduce this issue in a development build?

Yes

Summary

I have the following error displayed on Android on DeviceMotion.addListener call:

 Tried to obtain display from a Context not associated with  one. Only visual Contexts (such as Activity or one created with Context#createWindowContext) or ones created with Context#createDisplayContext are associated with displays. Other types of Contexts are typically related to background entities and may return an arbitrary display.
   at android.app.ContextImpl.getDisplay(ContextImpl.java:2580)

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.6.1 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/98961_1715670776511/bin/node
Yarn: 1.22.22 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/98961_1715670776511/bin/yarn
npm: 9.8.1 - /var/folders/md/1qkynwbs1216d57grkbc682h0000gn/T/fnm_multishells/98961_1715670776511/bin/npm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11330709
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.5 => 51.0.5
expo-router: ~3.5.12 => 3.5.12
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.10 => 0.19.11
npmGlobalPackages:
eas-cli: 8.0.0
Expo Workflow: bare

Expo Doctor Diagnostics

npx expo-doctor@latest
Need to install the following packages:
expo-doctor@1.6.0
Ok to proceed? (y) y
✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check npm/ yarn versions
✔ Check for issues with metro config
✖ Check for common project setup issues
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check native tooling versions
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

This project has native project folders but also has config plugins, indicating it is configured to use Prebuild. EAS Build will not sync your native configuration if the ios or android folders are present. Add these folders to your .gitignore file if you intend to use prebuild (aka "managed" workflow).
This project has multiple package manager lock files (yarn.lock, package-lock.json). This may cause EAS build to restore dependencies with a different package manager from what you use in other environments.

One or more checks failed, indicating possible issues with the project.

@mlecoq mlecoq added the needs validation Issue needs to be validated label May 14, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 14, 2024
@mlecoq
Copy link
Author

mlecoq commented May 14, 2024

Fyi the issue has been introduced in 13.0.5

@behenate behenate added Issue accepted and removed needs review Issue is ready to be reviewed by a maintainer labels May 14, 2024
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

@behenate behenate self-assigned this May 14, 2024
brentvatne pushed a commit that referenced this issue May 14, 2024
# Why

Currently `DeviceMotion` module crashes with 

```
Tried to obtain display from a Context not associated with  one.
```

Fixes #28820

# How

The orientation is now obtained from the current activity instead of
`reactContext.applicationContext`

# Test Plan

Tested in BareExpo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants