-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathindex.js
32 lines (30 loc) · 918 Bytes
/
index.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
import { Platform, StatusBar, NativeModules } from 'react-native'
let NavigationBar = NativeModules.RNNavBarColor;
module.exports = {
getAPILevel: () => {
if (Platform.OS == 'android') {
return NavigationBar.apiLevel;
}
},
setColor: (color) => {
if (Platform.OS == 'android' && NavigationBar.apiLevel >= 21) {
return NavigationBar.setColor(color);
}
},
setStatusBarColor: (color, animation) => {
if (Platform.OS == 'android') {
return StatusBar.setBackgroundColor(color, animation);
}
},
setStatusBarTheme: (theme, animation) => {
if (theme == 'light') {
return StatusBar.setBarStyle('light-content', animation);
}
else if (theme == 'dark') {
return StatusBar.setBarStyle('dark-content', animation);
}
else {
return StatusBar.setBarStyle('default', animation);
}
}
}