-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathApp.js
43 lines (32 loc) · 888 Bytes
/
App.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
import * as React from 'react';
import { StatusBar } from 'react-native';
// grab navigation root stack
import RootStack from './src/navigation/RootStack';
// context
import { colorOptions, ColorContext } from './src/context/ColorContext';
class App extends React.Component {
constructor() {
super();
const defaultColor = 'pictonBlue';
this.state = {
color: defaultColor,
colorObj: colorOptions[defaultColor]
};
this.setColor = this.setColor.bind(this);
}
setColor(color) {
this.setState({ color, colorObj: colorOptions[color] });
}
render() {
const { color, colorObj } = this.state;
return (
<ColorContext.Provider
value={{ color, colorObj, setColor: this.setColor }}
>
<StatusBar barStyle="dark-content" />
<RootStack />
</ColorContext.Provider>
);
}
}
export default App;