about summary refs log tree commit diff
path: root/src/alf/util/navigationBar.ts
blob: cb315f70a22b9c03db099441deaa6555a167d482 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as NavigationBar from 'expo-navigation-bar'
import * as SystemUI from 'expo-system-ui'

import {isAndroid} from '#/platform/detection'
import {Theme} from '../types'

export function setNavigationBar(themeType: 'theme' | 'lightbox', t: Theme) {
  if (isAndroid) {
    if (themeType === 'theme') {
      NavigationBar.setBackgroundColorAsync(t.atoms.bg.backgroundColor)
      NavigationBar.setBorderColorAsync(t.atoms.bg.backgroundColor)
      NavigationBar.setButtonStyleAsync(t.name !== 'light' ? 'light' : 'dark')
      SystemUI.setBackgroundColorAsync(t.atoms.bg.backgroundColor)
    } else {
      NavigationBar.setBackgroundColorAsync('black')
      NavigationBar.setBorderColorAsync('black')
      NavigationBar.setButtonStyleAsync('light')
      SystemUI.setBackgroundColorAsync('black')
    }
  }
}