capacitor-community/safe-area

await SafeArea.enable() get stucked

Closed this issue · 2 comments

I use SafeArea to set the status bar and nav bar style and manage the insets with the injected CSS variables. This is a great plugin but when I call await SafeArea.enable() more than once (ex: to change the app theme according to the one selected by the user), it gets stuck. The code that should be run after this call in the function is not.

For now I call it without await as a workaround but this is far from being perfect.

This issue existed because call.resolve() was not being called by the plugin method. This is now resolved in the latest version (v6.0.0-alpha.4)

For now I call it without await as a workaround but this is far from being perfect.

I'm not sure though what you mean by this. Why is that "far from being perfect"? There's nothing to await for. No data is being returned anyways. So it shouldn't really matter when omitting await. Why do you think otherwise?

This is because it returns a Promise. It's better to use await in an async function.

Thanks for your reactivity :)