Pārlūkot izejas kodu

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

Yedidya Kennard 8 gadus atpakaļ
vecāks
revīzija
d9acbedae5

+ 32
- 44
example-redux/src/app.js Parādīt failu

@@ -39,28 +39,28 @@ export default class App {
39 39
           screen: {
40 40
             screen: 'example.LoginScreen',
41 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 66
         return;
@@ -74,18 +74,6 @@ export default class App {
74 74
               selectedIcon: require('../img/one_selected.png'),
75 75
               title: 'Screen One',
76 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 79
               label: 'Two',
@@ -94,20 +82,20 @@ export default class App {
94 82
               selectedIcon: require('../img/two_selected.png'),
95 83
               title: 'Screen Two',
96 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 99
           animationType: 'slide-down',
112 100
           title: 'Redux Example'
113 101
         });

+ 2
- 2
example-redux/src/screens/FirstTabScreen.js Parādīt failu

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

+ 4
- 6
src/platformSpecific.android.js Parādīt failu

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