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

Conditionally import react-native-view-shot dependency #11

Open
tijs opened this issue Dec 19, 2019 · 5 comments
Open

Conditionally import react-native-view-shot dependency #11

tijs opened this issue Dec 19, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@tijs
Copy link

tijs commented Dec 19, 2019

This package includes a peer dependency on react-native-view-shot and i noticed some code for screenshots in the Deployment component. I have added that dependency to my project since it won't build otherwise, but i don't see any documentation on how to use this feature.

  • is the screen shot functionality on by default?
  • is it available to developers using the API?
  • can i also turn off this functionality if i do not intend to use it and do not want the extra dependency?
@Anwardo
Copy link
Collaborator

Anwardo commented Dec 23, 2019

The screenshot functionality is only used if you open a form that has a screenshot element inside it. So to use it you have to create a form in our platform with a screenshot type element added to it.

Since v1.0.0 we specified react-native-view-shot as a peerDependency (previously it was a dependency) and as such you should be able to skip installing it. This means that you wont be able to use the screenshot element in our form builder though.

@tijs
Copy link
Author

tijs commented Dec 23, 2019

@Anwardo i could only run the app with the dependency installed so i'm guessing you still have a direct dependency to this code somewhere. Maybe try it out with a clean install and you should get a redbox error like i did.

@Anwardo Anwardo added the enhancement New feature or request label Dec 23, 2019
@Anwardo
Copy link
Collaborator

Anwardo commented Dec 23, 2019

Ah yeah I see. Though it's specified as a peerDependency it's not conditionally imported in the codebase so it will still error if not present. This is a good enhancement for a new release. But as of now it's not possible yet.

@tijs
Copy link
Author

tijs commented Dec 23, 2019

Ok, good that's it's on the radar at least. We do not need the screen shot functionality so i'd prefer to remove the dependency. I'll leave it up to you to close the issue now or when a new release is available then.

@Anwardo Anwardo changed the title Screenshot functionality undocumented Conditionally import react-native-view-shot dependency Dec 23, 2019
@tijs
Copy link
Author

tijs commented Sep 30, 2021

@Anwardo I have upgraded mopinion to 2.0.1 and I noticed that you now have the same issue with react-native-image-picker. if I upgrade mopinion my project will no longer run since it misses the react-native-image-picker dependency. if this is a dependency it should be added to your package.json file. now I have to add dependencies to our projects for which it is unclear where or how they are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants