forked from keybase/client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ios.js
36 lines (32 loc) · 1.03 KB
/
index.ios.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// @flow
// React-native tooling assumes this file is here, so we just require our real entry point
import './app/globals.native'
import {NativeModules} from 'react-native'
import {_setSystemIsDarkMode, _setSystemSupported, _setDarkModePreference} from './styles/dark-mode'
// Load storybook or the app
if (__STORYBOOK__) {
const load = require('./storybook/index.native').default
load()
} else {
const NativeAppearance = NativeModules.Appearance
if (NativeAppearance) {
_setSystemIsDarkMode(NativeAppearance.initialColorScheme === 'dark')
_setSystemSupported(NativeAppearance.supported === '1')
}
const NativeEngine = NativeModules.KeybaseEngine
try {
const obj = JSON.parse(NativeEngine.guiConfig)
if (obj && obj.ui) {
const dm = obj.ui.darkMode
switch (dm) {
case 'system': // fallthrough
case 'alwaysDark': // fallthrough
case 'alwaysLight':
_setDarkModePreference(dm)
break
}
}
} catch (_) {}
const {load} = require('./app/index.native')
load()
}