Browse Source

Initial commit for SideMenu implementation in v2.0

Guy Carmeli 8 years ago
parent
commit
65425ae4f8
2 changed files with 42 additions and 0 deletions
  1. 9
    0
      example-redux/src/app.js
  2. 33
    0
      example-redux/src/screens/FirstSideMenu.js

+ 9
- 0
example-redux/src/app.js View File

@@ -103,6 +103,15 @@ export default class App {
103 103
               }
104 104
             ],
105 105
             navigatorStyle: {}
106
+          },
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
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
113
+            },
114
+            disableOpenGesture: false // optional, can the drawer be opened with a swipe instead of button
106 115
           }
107 116
         });
108 117
         return;

+ 33
- 0
example-redux/src/screens/FirstSideMenu.js View File

@@ -0,0 +1,33 @@
1
+import React, {Component, PropTypes} from 'react';
2
+import {
3
+  Text,
4
+  View,
5
+  ScrollView,
6
+  TouchableOpacity,
7
+  StyleSheet,
8
+  Alert
9
+} from 'react-native';
10
+import {connect} from 'react-redux';
11
+import * as counterActions from '../reducers/counter/actions';
12
+import _ from 'lodash';
13
+
14
+class FirstSideMenu extends Component {
15
+
16
+  constructor(props) {
17
+    super(props);
18
+    // if you want to listen on navigator events, set this up
19
+    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
20
+  }
21
+
22
+  onNavigatorEvent(event) {
23
+      console.log('Unhandled event ' + event.id);
24
+  }
25
+
26
+  render() {
27
+    return (
28
+      <View style={{flex: 1, padding: 20}}>
29
+        <Text style={styles.text}>Hello from SideMenu</Text>
30
+      </View>
31
+    );
32
+  }
33
+}