-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
105 lines (94 loc) · 2.93 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import React from 'react';
import { Provider } from 'mobx-react';
import { StatusBar } from 'react-native';
import { createStackNavigator, createBottomTabNavigator, createAppContainer } from 'react-navigation';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import ScreenModelsFactory from './screen_models/ScreenModelsFactory';
import ArtistsListScreen from './screens/Artists/ArtistsListScreen';
import ArtistDetailsScreen from './screens/Artists/ArtistDetailsScreen';
import AlbumsListScreen from './screens/Albums/AlbumsListScreen';
import AlbumDetailsScreen from './screens/Albums/AlbumDetailsScreen';
import SongsListScreen from './screens/Songs/SongsListScreen';
import colors from './constants/colors';
/**
* Class repersents the highest order component - App component.
* It wraps and returns the all navigators.
*
* @class App
* @extends {React.Component}
*/
class App extends React.Component {
/**
* Called immediately after a component is mounted.
* Starts the data loading.
*
* @memberof App
*/
componentDidMount() {
StatusBar.setBackgroundColor(colors.activeTabTintColor);
}
/**
* Renders the app.
*
* @returns app elements
* @memberof App
*/
render() {
const ArtistsStack = createStackNavigator({
'ArtistsList': ArtistsListScreen,
'ArtistDetails': ArtistDetailsScreen,
'ArtistsAlbumDetails': AlbumDetailsScreen
});
const AlbumsStack = createStackNavigator({
'AlbumsList': AlbumsListScreen,
'AlbumDetails': AlbumDetailsScreen
});
const SongsStack = createStackNavigator({
'SongsList': SongsListScreen
})
const AppContainer = createAppContainer(
createBottomTabNavigator(
{
'ArtistsStack': {
screen: ArtistsStack,
navigationOptions: {
title: 'Artists',
tabBarIcon: ({ tintColor }) => <Icon name="artist" size={30} color={tintColor}/>
}
},
'AlbumsStack': {
screen: AlbumsStack,
navigationOptions: {
title: 'Albums',
tabBarIcon: ({ tintColor }) => <Icon name="album" size={30} color={tintColor}/>
}
},
'SongsStack': {
screen: SongsStack,
navigationOptions: {
title: 'Songs',
tabBarIcon: ({ tintColor }) => <Icon name="music" size={30} color={tintColor}/>
}
}
},
{
tabBarOptions: {
activeTintColor: colors.activeTabTintColor,
inactiveTintColor : colors.inactiveTabTintColor,
showLabel: false,
style: {
backgroundColor: colors.mainColor
}
}
}
)
);
const screenModels = ScreenModelsFactory.getScreenModels();
return (
<Provider screenModels={screenModels}>
<AppContainer />
</Provider>
);
}
}
export default App;