Search code examples
cordovaionic-framework

ionic - how to get safe-area in javascript


In Ionic I can use env(safe-area-inset-top) fine for CSS files.

So now I need to get this variable value in javascript files. Is it possible?

Something like this:

ngOnInit() {
  let safeAreaInsetTop = ?????
}

Solution

  • You can use this plugin for this specific purpose:

    capacitor-plugin-safe-area