Ver código fonte

Add show modal button to SideMenu

Guy Carmeli 7 anos atrás
pai
commit
aa7e9b28e4
1 arquivos alterados com 19 adições e 2 exclusões
  1. 19
    2
      example/src/screens/types/Drawer.js

+ 19
- 2
example/src/screens/types/Drawer.js Ver arquivo

@@ -1,12 +1,26 @@
1 1
 import React from 'react';
2
-import {StyleSheet, View, Text} from 'react-native';
2
+import {StyleSheet, View, Button} from 'react-native';
3 3
 
4 4
 class MyClass extends React.Component {
5 5
 
6
+  onShowModal = () => {
7
+    this.props.navigator.toggleDrawer({
8
+      side: 'left'
9
+    });
10
+    this.props.navigator.showModal({
11
+      screen: 'example.Types.Modal',
12
+      title: `Modal`
13
+    });
14
+  };
15
+
6 16
   render() {
7 17
     return (
8 18
       <View style={styles.container}>
9
-
19
+        <View style={styles.button}>
20
+          <Button
21
+            onPress={this.onShowModal}
22
+            title="Show Modal"/>
23
+        </View>
10 24
       </View>
11 25
     );
12 26
   }
@@ -20,6 +34,9 @@ const styles = StyleSheet.create({
20 34
     justifyContent: 'center',
21 35
     backgroundColor: '#ffffff',
22 36
   },
37
+  button: {
38
+    marginTop: 16
39
+  }
23 40
 });
24 41
 
25 42
 export default MyClass;