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

Unable to take the screenshot. #980

Open
kaushallalo opened this issue Oct 13, 2022 · 1 comment
Open

Unable to take the screenshot. #980

kaushallalo opened this issue Oct 13, 2022 · 1 comment

Comments

@kaushallalo
Copy link

Hi,I am trying to take a screenshot but i am getting the following error.

onButtonTap = async () => {
if (!this.state.writeAccessPermission) {
this.requestWriteAccessPermission();
}
try {
await this.ARSceneNav.sceneNavigator.takeScreenshot('kartvya', true).then(result => {
console.log(result.url, 'urlurlurlurlurl');
console.log(result.success, 'successsuccesssuccesssuccesssuccess');
console.log(result.errorCode, 'errorCodeerrorCodeerrorCodeerrorCode');
});
} catch (error) {
console.log(error, 'errorerrorerrorerrorerror');
}
};

<TouchableOpacity
style={{justifyContent: 'center'}}
onPress={this.onButtonTap}>
Capture

Screenshot 2022-10-13 at 9 24 00 AM

@skizzo
Copy link

skizzo commented May 26, 2023

This can be achieved by using react-native-view-shot, by wrapping your ViroARSceneNavigator in a ViewShot and then calling the captureRef() method on said ViewShot.

In the latest version, this also works for Android, just be sure to set the handleGLSurfaceViewOnAndroid option to true, otherwise the screenshot will just be a fully black image.

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

No branches or pull requests

2 participants