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

Cozy-bar should be a peer dependency in cozy-intent #1477

Open
acezard opened this issue Mar 2, 2022 · 0 comments
Open

Cozy-bar should be a peer dependency in cozy-intent #1477

acezard opened this issue Mar 2, 2022 · 0 comments
Assignees
Labels
cozy-intent Event-based library allowing interactions between React-Native and React applications

Comments

@acezard
Copy link
Contributor

acezard commented Mar 2, 2022

cozy-bar v7 is an "ambient" dependency, you can access it from Webpack dev server scope or from DOM scope in production.

That is not the case for cozy-bar v8 which does not expose an ambient API.

Currently, as a fast fix, it was chosen to inject the required setWebviewContext method as props to WebviewProvider. A more elegant solution would be to use cozy-bar as a peerDep in cozy-intent. That way we can try/catch to import the module in production and fall back to v7 API if the cozy-app doesn't have cozy-bar 8.

In the end, that would allow us to keep the initial aim of cozy-intent to be "config-free", and keep WebviewProvider with 0 React props.

cc @Crash--

@acezard acezard added the cozy-intent Event-based library allowing interactions between React-Native and React applications label Mar 2, 2022
@acezard acezard self-assigned this Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cozy-intent Event-based library allowing interactions between React-Native and React applications
Projects
None yet
Development

No branches or pull requests

1 participant