Enable fullscreen view on nativescript-vue

meyt

Meyti

Posted on April 14, 2020

Enable fullscreen view on nativescript-vue
import * as app from 'tns-core-modules/application'
import { device } from 'tns-core-modules/platform'

export function hideSystemUi () {
  if (!app.android || parseInt(device.sdkVersion) < 21) { return }
  const androidViewPkg = android.view // eslint-disable-line no-undef
  const window = app.android.startActivity.getWindow()
  window.addFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FULLSCREEN)
  window.clearFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
}

export function showSystemUi () {
  if (!app.android || parseInt(device.sdkVersion) < 21) { return }
  const androidViewPkg = android.view // eslint-disable-line no-undef
  const window = app.android.startActivity.getWindow()
  window.addFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN)
  window.clearFlags(androidViewPkg.WindowManager.LayoutParams.FLAG_FULLSCREEN)
}

💖 💪 🙅 🚩
meyt
Meyti

Posted on April 14, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Enable fullscreen view on nativescript-vue
nativescriptvue Enable fullscreen view on nativescript-vue

April 14, 2020