mopinion / mopinion-sdk-react-native

Mopinion SDK for React Native
MIT License
3 stars 5 forks source link

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

Open tijs opened 4 years ago

tijs commented 4 years ago

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.

Anwardo commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

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.

tijs commented 3 years ago

@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.