Browse Source

changed for the new native API

Ran Greenberg 7 years ago
parent
commit
6d63cbd3e3

+ 22
- 8
example/src/app.js View File

@@ -11,14 +11,17 @@ const createTabs = () => {
11 11
   let tabs = [
12 12
     {
13 13
       label: 'One',
14
-      screen: 'example.FirstTabScreen',
14
+      screen: 'com.example.FirstTabScreen',
15 15
       icon: require('../img/one.png'),
16 16
       selectedIcon: require('../img/one_selected.png'),
17
-      title: 'Screen One'
17
+      title: 'Screen One',
18
+      navigatorStyle: {
19
+          tabBarHidden: true
20
+      }
18 21
     },
19 22
     {
20 23
       label: 'Two',
21
-      screen: 'example.SecondTabScreen',
24
+      screen: 'com.example.SecondTabScreen',
22 25
       icon: require('../img/two.png'),
23 26
       selectedIcon: require('../img/two_selected.png'),
24 27
       title: 'Screen Two',
@@ -37,35 +40,46 @@ const createTabs = () => {
37 40
   }
38 41
   return tabs;
39 42
 };
43
+
44
+import * as Commands from './../node_modules/react-native-navigation/src2/commands/valid-commands';
45
+//Navigation.startApp(Commands.singleScreenApp);
46
+//Navigation.startApp(Commands.tabBasedApp);
47
+//Navigation.startApp(Commands.singleWithSideMenu);
48
+//Navigation.startApp(Commands.singleWithRightSideMenu);
49
+//Navigation.startApp(Commands.singleWithBothMenus);
50
+//Navigation.startApp(Commands.tabBasedWithSideMenu);
51
+
40 52
 // this will start our app
41 53
 Navigation.startTabBasedApp({
42 54
   tabs: createTabs(),
43 55
   appStyle: {
44 56
     tabBarBackgroundColor: '#0f2362',
45 57
     tabBarButtonColor: '#ffffff',
46
-    tabBarSelectedButtonColor: '#63d7cc'
58
+    tabBarSelectedButtonColor: '#63d7cc',
47 59
   },
48 60
   drawer: {
49 61
     left: {
50
-      screen: 'example.SideMenu'
62
+      screen: 'com.example.SideMenu'
51 63
     }
52 64
   }
53 65
 });
54 66
 //Navigation.startSingleScreenApp({
55 67
 //  screen: {
56
-//    screen: 'example.FirstTabScreen',
68
+//    screen: 'com.example.FirstTabScreen',
57 69
 //    title: 'Navigation',
58 70
 //    navigatorStyle: {
59 71
 //      navBarBackgroundColor: '#4dbce9',
60 72
 //      navBarTextColor: '#ffff00',
61 73
 //      navBarSubtitleTextColor: '#ff0000',
62 74
 //      navBarButtonColor: '#ffffff',
63
-//      statusBarTextColorScheme: 'light'
75
+//      statusBarTextColorScheme: 'light',
76
+//      tabBarHidden: true
64 77
 //    }
65 78
 //  },
66 79
 //  drawer: {
67 80
 //    left: {
68
-//      screen: 'example.SideMenu'
81
+//      screen: 'com.example.SideMenu'
69 82
 //    }
70 83
 //  }
71 84
 //});
85
+

+ 9
- 9
example/src/screens/FirstTabScreen.js View File

@@ -40,7 +40,7 @@ export default class FirstTabScreen extends Component {
40 40
   constructor(props) {
41 41
     super(props);
42 42
     // if you want to listen on navigator events, set this up
43
-    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
43
+    //this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
44 44
   }
45 45
 
46 46
   onNavigatorEvent(event) {
@@ -60,7 +60,7 @@ export default class FirstTabScreen extends Component {
60 60
 
61 61
   render() {
62 62
     return (
63
-      <View style={{flex: 1, padding: 20}}>
63
+      <View style={{flex: 1, padding: 40}}>
64 64
         <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
65 65
           <Text style={styles.button}>Push Plain Screen</Text>
66 66
         </TouchableOpacity>
@@ -97,27 +97,27 @@ export default class FirstTabScreen extends Component {
97 97
   onPushPress() {
98 98
     this.props.navigator.push({
99 99
       title: "More",
100
-      screen: "example.PushedScreen"
100
+      screen: "com.example.PushedScreen"
101 101
     });
102 102
   }
103 103
 
104 104
   onPushStyledPress() {
105 105
     this.props.navigator.push({
106 106
       title: "Styled",
107
-      screen: "example.StyledScreen"
107
+      screen: "com.example.StyledScreen"
108 108
     });
109 109
   }
110 110
 
111 111
   onModalPress() {
112 112
     this.props.navigator.showModal({
113 113
       title: "Modal",
114
-      screen: "example.ModalScreen"
114
+      screen: "com.example.ModalScreen"
115 115
     });
116 116
   }
117 117
 
118 118
   onLightBoxPress() {
119 119
     this.props.navigator.showLightBox({
120
-      screen: "example.LightBoxScreen",
120
+      screen: "com.example.LightBoxScreen",
121 121
       style: {
122 122
         backgroundBlur: "dark"
123 123
       },
@@ -129,18 +129,18 @@ export default class FirstTabScreen extends Component {
129 129
 
130 130
   onInAppNotificationPress() {
131 131
     this.props.navigator.showInAppNotification({
132
-      screen: "example.NotificationScreen"
132
+      screen: "com.example.NotificationScreen"
133 133
     });
134 134
   }
135 135
 
136 136
   onStartSingleScreenApp() {
137 137
     Navigation.startSingleScreenApp({
138 138
       screen: {
139
-        screen: 'example.FirstTabScreen'
139
+        screen: 'com.example.FirstTabScreen'
140 140
       },
141 141
       drawer: {
142 142
         left: {
143
-          screen: 'example.SideMenu'
143
+          screen: 'com.example.SideMenu'
144 144
         }
145 145
       }
146 146
     });

+ 2
- 2
example/src/screens/ModalScreen.js View File

@@ -50,13 +50,13 @@ export default class ModalScreen extends Component {
50 50
   onPushPress() {
51 51
     this.props.navigator.push({
52 52
       title: "More",
53
-      screen: "example.PushedScreen"
53
+      screen: "com.example.PushedScreen"
54 54
     });
55 55
   }
56 56
   onPushStyledPress() {
57 57
     this.props.navigator.push({
58 58
       title: "More",
59
-      screen: "example.StyledScreen"
59
+      screen: "com.example.StyledScreen"
60 60
     });
61 61
   }
62 62
   onClosePress() {

+ 2
- 3
example/src/screens/PushedScreen.js View File

@@ -48,7 +48,7 @@ export default class PushedScreen extends Component {
48 48
   onPushStyledPress() {
49 49
     this.props.navigator.push({
50 50
       title: "More",
51
-      screen: "example.StyledScreen"
51
+      screen: "com.example.StyledScreen"
52 52
     });
53 53
   }
54 54
   onPopPress() {
@@ -60,8 +60,7 @@ export default class PushedScreen extends Component {
60 60
   onResetToPress() {
61 61
     this.props.navigator.resetTo({
62 62
       title: "New Root",
63
-      screen: "example.StyledScreen",
64
-      animated: true
63
+      screen: "com.example.ThirdTabScreen"
65 64
     });
66 65
   }
67 66
 }

+ 1
- 1
example/src/screens/SecondTabScreen.js View File

@@ -22,7 +22,7 @@ export default class SecondTabScreen extends Component {
22 22
     super(props);
23 23
     this.buttonsCounter = 0;
24 24
     // if you want to listen on navigator events, set this up
25
-    this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
25
+    //this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
26 26
   }
27 27
 
28 28
   render() {

+ 2
- 2
example/src/screens/StyledScreen.js View File

@@ -66,13 +66,13 @@ export default class StyledScreen extends Component {
66 66
   onPushPress() {
67 67
     this.props.navigator.push({
68 68
       title: "More",
69
-      screen: "example.PushedScreen"
69
+      screen: "com.example.PushedScreen"
70 70
     });
71 71
   }
72 72
   onPushStyledPress() {
73 73
     this.props.navigator.push({
74 74
       title: "More",
75
-      screen: "example.StyledScreen"
75
+      screen: "com.example.StyledScreen"
76 76
     });
77 77
   }
78 78
   onPopPress() {

+ 14
- 8
example/src/screens/index.ios.js View File

@@ -11,12 +11,18 @@ import LightBoxScreen from './LightBoxScreen';
11 11
 
12 12
 // register all screens of the app (including internal ones)
13 13
 export function registerScreens() {
14
-  Navigation.registerComponent('example.FirstTabScreen', () => FirstTabScreen);
15
-  Navigation.registerComponent('example.SecondTabScreen', () => SecondTabScreen);
16
-  Navigation.registerComponent('example.PushedScreen', () => PushedScreen);
17
-  Navigation.registerComponent('example.StyledScreen', () => StyledScreen);
18
-  Navigation.registerComponent('example.ModalScreen', () => ModalScreen);
19
-  Navigation.registerComponent('example.NotificationScreen', () => NotificationScreen);
20
-  Navigation.registerComponent('example.SideMenu', () => SideMenu);
21
-  Navigation.registerComponent('example.LightBoxScreen', () => LightBoxScreen);
14
+  Navigation.registerComponent('com.example.FirstTabScreen', () => FirstTabScreen);
15
+  Navigation.registerComponent('com.example.SecondTabScreen', () => SecondTabScreen);
16
+  Navigation.registerComponent('com.example.PushedScreen', () => PushedScreen);
17
+  Navigation.registerComponent('com.example.StyledScreen', () => StyledScreen);
18
+  Navigation.registerComponent('com.example.ModalScreen', () => ModalScreen);
19
+  Navigation.registerComponent('com.example.NotificationScreen', () => NotificationScreen);
20
+  Navigation.registerComponent('com.example.SideMenu', () => SideMenu);
21
+  Navigation.registerComponent('com.example.LightBoxScreen', () => LightBoxScreen);
22
+	
23
+  Navigation.registerComponent('com.example.MyScreen', () => FirstTabScreen);
24
+  Navigation.registerComponent('com.example.Menu', () => SideMenu);
25
+  Navigation.registerComponent('com.example.Menu1', () => SideMenu);
26
+  Navigation.registerComponent('com.example.Menu2', () => SideMenu);
27
+	
22 28
 }