Browse Source

Fixed passing props when starting app in Android to match the iOS method

Yedidya Kennard 8 years ago
parent
commit
d9acbedae5

+ 32
- 44
example-redux/src/app.js View File

39
           screen: {
39
           screen: {
40
             screen: 'example.LoginScreen',
40
             screen: 'example.LoginScreen',
41
             title: 'Login',
41
             title: 'Login',
42
-            navigatorStyle: {},
43
-            passProps: {
44
-              str: 'This is a prop passed in \'startSingleScreenApp()\'!',
45
-              obj: {
46
-                str: 'This is a prop passed in an object!',
47
-                arr: [
48
-                  {
49
-                    str: 'This is a prop in an object in an array in an object!'
50
-                  }
42
+            navigatorStyle: {}
43
+          },
44
+          passProps: {
45
+            str: 'This is a prop passed in \'startSingleScreenApp()\'!',
46
+            obj: {
47
+              str: 'This is a prop passed in an object!',
48
+              arr: [
49
+                {
50
+                  str: 'This is a prop in an object in an array in an object!'
51
+                }
52
+              ],
53
+              arr2: [
54
+                [
55
+                  'array of strings',
56
+                  'with two strings'
51
                 ],
57
                 ],
52
-                arr2: [
53
-                    [
54
-                        'array of strings',
55
-                        'with two strings'
56
-                    ],
57
-                    [
58
-                        1, 2, 3
59
-                    ]
58
+                [
59
+                  1, 2, 3
60
                 ]
60
                 ]
61
-              },
62
-              num: 1234
63
-            }
61
+              ]
62
+            },
63
+            num: 1234
64
           }
64
           }
65
         });
65
         });
66
         return;
66
         return;
74
               selectedIcon: require('../img/one_selected.png'),
74
               selectedIcon: require('../img/one_selected.png'),
75
               title: 'Screen One',
75
               title: 'Screen One',
76
               navigatorStyle: {},
76
               navigatorStyle: {},
77
-              passProps: {
78
-                str: 'This is a prop passed in \'startTabBasedApp\'!',
79
-                obj: {
80
-                  str: 'This is a prop passed in an object!',
81
-                  arr: [
82
-                    {
83
-                      str: 'This is a prop in an object in an array in an object!'
84
-                    }
85
-                  ]
86
-                },
87
-                num: 1234
88
-              }
89
             },
77
             },
90
             {
78
             {
91
               label: 'Two',
79
               label: 'Two',
94
               selectedIcon: require('../img/two_selected.png'),
82
               selectedIcon: require('../img/two_selected.png'),
95
               title: 'Screen Two',
83
               title: 'Screen Two',
96
               navigatorStyle: {},
84
               navigatorStyle: {},
97
-              passProps: {
98
-                str: 'This is a prop passed in \'startTabBasedApp\'!',
99
-                obj: {
100
-                  str: 'This is a prop passed in an object!',
101
-                  arr: [
102
-                    {
103
-                      str: 'This is a prop in an object in an array in an object!'
104
-                    }
105
-                  ]
106
-                },
107
-                num: 1234
108
-              }
109
             }
85
             }
110
           ],
86
           ],
87
+          passProps: {
88
+            str: 'This is a prop passed in \'startTabBasedApp\'!',
89
+            obj: {
90
+              str: 'This is a prop passed in an object!',
91
+              arr: [
92
+                {
93
+                  str: 'This is a prop in an object in an array in an object!'
94
+                }
95
+              ]
96
+            },
97
+            num: 1234
98
+          },
111
           animationType: 'slide-down',
99
           animationType: 'slide-down',
112
           title: 'Redux Example'
100
           title: 'Redux Example'
113
         });
101
         });

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

95
       title: "More",
95
       title: "More",
96
       screen: "example.PushedScreen",
96
       screen: "example.PushedScreen",
97
       passProps: {
97
       passProps: {
98
-        passed: 'This is a prop passed in \'navigator.push()\'!',
98
+        str: 'This is a prop passed in \'navigator.push()\'!',
99
         obj: {
99
         obj: {
100
           str: 'This is a prop passed in an object!',
100
           str: 'This is a prop passed in an object!',
101
           arr: [
101
           arr: [
114
       title: "Modal Screen",
114
       title: "Modal Screen",
115
       screen: "example.PushedScreen",
115
       screen: "example.PushedScreen",
116
       passProps: {
116
       passProps: {
117
-        passed: 'This is a prop passed in \'navigator.showModal()\'!',
117
+        str: 'This is a prop passed in \'navigator.showModal()\'!',
118
         obj: {
118
         obj: {
119
           str: 'This is a prop passed in an object!',
119
           str: 'This is a prop passed in an object!',
120
           arr: [
120
           arr: [

+ 4
- 6
src/platformSpecific.android.js View File

1
 import React, {Component} from 'react';
1
 import React, {Component} from 'react';
2
-import {
3
-  AppRegistry
4
-} from 'react-native';
2
+import {AppRegistry} from 'react-native';
5
 
3
 
6
 import Navigation from './Navigation';
4
 import Navigation from './Navigation';
7
 import utils from './utils';
5
 import utils from './utils';
8
 
6
 
9
-import {
10
-  RctActivity
11
-} from 'react-native-navigation';
7
+import {RctActivity} from 'react-native-navigation';
12
 
8
 
13
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
9
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
14
 
10
 
22
   addNavigatorParams(screen);
18
   addNavigatorParams(screen);
23
   addNavigatorButtons(screen);
19
   addNavigatorButtons(screen);
24
   addNavigationStyleParams(screen);
20
   addNavigationStyleParams(screen);
21
+  screen.passProps = params.passProps;
25
   RctActivity.startSingleScreenApp(screen);
22
   RctActivity.startSingleScreenApp(screen);
26
 }
23
 }
27
 
24
 
41
         tab.icon = icon.uri;
38
         tab.icon = icon.uri;
42
       }
39
       }
43
     }
40
     }
41
+    tab.passProps = params.passProps;
44
   });
42
   });
45
 
43
 
46
   RctActivity.startTabBasedApp(params.tabs, params.tabsStyle);
44
   RctActivity.startTabBasedApp(params.tabs, params.tabsStyle);