forked from nklhtv/react-native-system-ui-flags
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsystemuiflags.android.js
45 lines (37 loc) · 1.56 KB
/
systemuiflags.android.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
37
38
39
40
41
42
43
44
45
import { NativeModules } from 'react-native';
const SystemUiFlags = NativeModules.SystemUiFlags;
const CONSTANTS = {
SYSTEM_UI_FLAG_HIDE_NAVIGATION: SystemUiFlags.SYSTEM_UI_FLAG_HIDE_NAVIGATION,
SYSTEM_UI_FLAG_FULLSCREEN: SystemUiFlags.SYSTEM_UI_FLAG_FULLSCREEN,
SYSTEM_UI_FLAG_LAYOUT_STABLE: SystemUiFlags.SYSTEM_UI_FLAG_LAYOUT_STABLE,
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION: SystemUiFlags.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION,
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN: SystemUiFlags.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN,
SYSTEM_UI_FLAG_LOW_PROFILE: SystemUiFlags.SYSTEM_UI_FLAG_LOW_PROFILE,
SYSTEM_UI_FLAG_VISIBLE: SystemUiFlags.SYSTEM_UI_FLAG_VISIBLE,
SYSTEM_UI_FLAG_LIGHT_STATUS_BAR: SystemUiFlags.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR,
SYSTEM_UI_FLAG_IMMERSIVE_STICKY: SystemUiFlags.SYSTEM_UI_FLAG_IMMERSIVE_STICKY,
SYSTEM_UI_FLAG_IMMERSIVE: SystemUiFlags.SYSTEM_UI_FLAG_IMMERSIVE
};
const setSystemUiFlags = (flags) => {
if (typeof flags !== 'number' || isNaN(flags)) {
console.warn('setSystemUiFlags called with invalid parameters', flags);
return;
}
SystemUiFlags.setSystemUiFlags(flags);
};
const updateSystemUiFlags = (flags) => {
if (typeof flags !== 'number' || isNaN(flags)) {
console.warn('updateSystemUiFlags called with invalid parameters', flags);
return;
}
SystemUiFlags.updateSystemUiFlags(flags);
};
const getSystemUiFlags = () => {
return SystemUiFlags.getSystemUiFlags();
};
export default {
getSystemUiFlags,
setSystemUiFlags,
updateSystemUiFlags,
...CONSTANTS
};