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

Make sensors work with different device orientations #4033

Merged
merged 9 commits into from Feb 10, 2023

Conversation

graszka22
Copy link
Member

Summary

  • Adds adjustToInterfaceOrientation option that adjusts the sensors values to current device orientation
  • Adds interfaceOrientation shared value that contains the current interface orientation
  • Adds iosReferenceFrame option that allows setting ios reference frame. Some reference frames doesn't work for example on iPods but give better results.

Test plan

  • AnimatedSensorExample.tsx
  • CubesExample.tsx - when device faces north the cubes should rotate in the correct way on every device orientation.

Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp Outdated Show resolved Hide resolved
Example/src/AnimatedSensorExample.tsx Outdated Show resolved Hide resolved
Example/src/CubesExample.tsx Show resolved Hide resolved
Example/src/CubesExample.tsx Outdated Show resolved Hide resolved
Example/src/CubesExample.tsx Outdated Show resolved Hide resolved
ios/sensor/ReanimatedSensor.m Show resolved Hide resolved
ios/sensor/ReanimatedSensor.m Show resolved Hide resolved
Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

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

@graszka22 Thank you for this PR. Well done! 🥳

@graszka22 graszka22 added this pull request to the merge queue Feb 10, 2023
Merged via the queue into main with commit 8851eff Feb 10, 2023
@graszka22 graszka22 deleted the graszka22/sensors-orientation branch February 10, 2023 22:49
fluiddot pushed a commit to wordpress-mobile/react-native-reanimated that referenced this pull request Jun 5, 2023
…n#4033)

<!-- Thanks for submitting a pull request! We appreciate you spending
the time to work on these changes. Please follow the template so that
the reviewers can easily understand what the code changes affect. -->

## Summary

- Adds `adjustToInterfaceOrientation` option that adjusts the sensors
values to current device orientation
- Adds `interfaceOrientation` shared value that contains the current
interface orientation
- Adds `iosReferenceFrame` option that allows setting ios reference
frame. Some reference frames doesn't work for example on iPods but give
better results.

## Test plan
- `AnimatedSensorExample.tsx`
- `CubesExample.tsx` - when device faces north the cubes should rotate
in the correct way on every device orientation.
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.

None yet

2 participants