-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.android.js
More file actions
71 lines (57 loc) · 1.79 KB
/
index.android.js
File metadata and controls
71 lines (57 loc) · 1.79 KB
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
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
// -- redux --
import {Provider} from 'react-redux'
import {createStore, applyMiddleware, combineReducers, compose} from 'redux'
import thunkMiddleware from 'redux-thunk'
import {createLogger} from 'redux-logger'
import reducer from './app/reducers'
const loggerMiddleware = createLogger({predicate: (getState, action) => {__DEV__}});
function configureStore(initialState) {
const enhancer = compose(
applyMiddleware(
thunkMiddleware,
loggerMiddleware,
)
);
return createStore(reducer, initialState, enhancer);
}
const store = configureStore({});
// ---
import UserList from './app/components/user/UserList'
import UserDetails from './app/components/user/UserDetails'
import React, { Component } from 'react';
import {
AppRegistry,
Navigator,
} from 'react-native';
export default class UsersSearch extends Component {
renderScene(route, navigator) {
switch (route.id) {
case 'UserList' :
return (<UserList navigator={navigator} title="UserList" />);
case 'UserDetails' :
return (<UserDetails user={route.user} navigator={navigator} title="UserDetails" />);
}
}
render() {
return (
<Navigator
initialRoute={{id: "UserList"}}
renderScene={this.renderScene}
configureScreen={
(route, routeStack) => Navigator.SceneConfigs.FloatFromBottom
}
/>
);
}
}
const App = ()=> ( // it is a root for our app, and it connects us to redux
<Provider store={store}>
<UsersSearch/>
</Provider>
);
AppRegistry.registerComponent('myReactNativeApp', () => App);