Browse Source

Basic SideMenu

Guy Carmeli 9 years ago
parent
commit
bf2418e2bd

+ 1
- 4
example-redux/src/app.js View File

106
           },
106
           },
107
           drawer: { // optional, add this if you want a side menu drawer in your app
107
           drawer: { // optional, add this if you want a side menu drawer in your app
108
             left: { // optional, define if you want a drawer from the left
108
             left: { // optional, define if you want a drawer from the left
109
-              screen: 'example.FirstSideMenu' // unique ID registered with Navigation.registerScreen
110
-            },
111
-            right: { // optional, define if you want a drawer from the right
112
-              screen: 'example.SecondSideMenu' // unique ID registered with Navigation.registerScreen
109
+              screen: 'example.SideMenu' // unique ID registered with Navigation.registerScreen
113
             },
110
             },
114
             disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
111
             disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
115
           }
112
           }

example-redux/src/screens/FirstSideMenu.js → example-redux/src/screens/SideMenu.js View File

11
 import * as counterActions from '../reducers/counter/actions';
11
 import * as counterActions from '../reducers/counter/actions';
12
 import _ from 'lodash';
12
 import _ from 'lodash';
13
 
13
 
14
-class FirstSideMenu extends Component {
14
+class SideMenu extends Component {
15
 
15
 
16
   constructor(props) {
16
   constructor(props) {
17
     super(props);
17
     super(props);
25
 
25
 
26
   render() {
26
   render() {
27
     return (
27
     return (
28
-      <View style={{flex: 1, padding: 20}}>
29
-        <Text style={styles.text}>Hello from SideMenu</Text>
28
+      <View style={{flex: 1, padding: 20, backgroundColor: 'green'}}>
29
+        <Text>Hello from SideMenu</Text>
30
       </View>
30
       </View>
31
     );
31
     );
32
   }
32
   }
33
-}
33
+}
34
+
35
+export default connect()(SideMenu);

+ 2
- 0
example-redux/src/screens/index.js View File

5
 import SecondTabScreen from './SecondTabScreen';
5
 import SecondTabScreen from './SecondTabScreen';
6
 import PushedScreen from './PushedScreen';
6
 import PushedScreen from './PushedScreen';
7
 import ListScreen from './ListScreen';
7
 import ListScreen from './ListScreen';
8
+import SideMenu from './SideMenu';
8
 
9
 
9
 // register all screens of the app (including internal ones)
10
 // register all screens of the app (including internal ones)
10
 export function registerScreens(store, Provider) {
11
 export function registerScreens(store, Provider) {
13
   Navigation.registerComponent('example.SecondTabScreen', () => SecondTabScreen, store, Provider);
14
   Navigation.registerComponent('example.SecondTabScreen', () => SecondTabScreen, store, Provider);
14
   Navigation.registerComponent('example.PushedScreen', () => PushedScreen, store, Provider);
15
   Navigation.registerComponent('example.PushedScreen', () => PushedScreen, store, Provider);
15
   Navigation.registerComponent('example.ListScreen', () => ListScreen, store, Provider);
16
   Navigation.registerComponent('example.ListScreen', () => ListScreen, store, Provider);
17
+  Navigation.registerComponent('example.SideMenu', () => SideMenu, store, Provider);
16
 }
18
 }