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 screenshot taking and screen recording in AR #256

Merged
merged 3 commits into from
Feb 10, 2024

Conversation

robertjcolley
Copy link
Collaborator

Screenshot taking wasn't working due to a react "this" issue. In JavaScript, class methods are not bound to the instance like an arrow function is. So, when a user of ViroARSceneNavigator tries to use these functions, the "this" instance didn't have all of the React properties that make React Native's findNodeHandle work correctly.

Changing functions like:

async _takeScreenshot(fileName, saveToCameraRoll) {
  // ...
}

To

_takeScreenshot = (filename, saveToCameraRoll) => {
  // ...
}

Fixes the issue and allows "this" to be properly accessed by findNodeHandle()

Also adds more documentation to the ViroARSceneNavigator.

Screenshot taking wasn't working due to a react "this" issue. In JavaScript,
class methods are not bound to the instance like an arrow function is.
So, when a user of ViroARSceneNavigator tries to use these functions,
the "this" instance didn't have all of the React properties that make
React Native's findNodeHandle work correctly.

Changing functions like:

async _takeScreenshot(fileName, saveToCameraRoll) {
  // ...
}

To

_takeScreenshot = (filename, saveToCameraRoll) => {
  // ...
}

Fixes the issue.

Also adds more documentation to the ViroARSceneNavigator.
@robertjcolley
Copy link
Collaborator Author

robertjcolley commented Feb 2, 2024

TODO:

  • Update documentation
  • Link GitHub issues that are closed by this PR
  • Test with community
  • Update version number to 2.23.2

@robertjcolley robertjcolley merged commit eac9454 into main Feb 10, 2024
1 check passed
@robertjcolley robertjcolley deleted the 254-android-13-not-able-to-take-screenshot branch February 10, 2024 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant