Browse Source

push not working

Daniel Zlotin 8 years ago
parent
commit
882aa4d051

+ 4
- 0
android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java View File

31
         handler.post(runnable);
31
         handler.post(runnable);
32
     }
32
     }
33
 
33
 
34
+    public void runOnMainThread(Runnable runnable, long delay) {
35
+        handler.postDelayed(runnable, delay);
36
+    }
37
+
34
     public NavigationReactInstance getNavigationReactInstance() {
38
     public NavigationReactInstance getNavigationReactInstance() {
35
         return navigationReactInstance;
39
         return navigationReactInstance;
36
     }
40
     }

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadHandler.java View File

33
                     return true;
33
                     return true;
34
                 } else {
34
                 } else {
35
                     shouldRefreshOnRR = true;
35
                     shouldRefreshOnRR = true;
36
-                    NavigationApplication.instance.getMainHandler().postDelayed(
36
+                    NavigationApplication.instance.runOnMainThread(
37
                             new Runnable() {
37
                             new Runnable() {
38
                                 @Override
38
                                 @Override
39
                                 public void run() {
39
                                 public void run() {

+ 1
- 1
example-redux/src/app.js View File

37
       case 'login':
37
       case 'login':
38
         Navigation.startSingleScreenApp({
38
         Navigation.startSingleScreenApp({
39
           screen: {
39
           screen: {
40
-            screen: 'example.LoginScreen',
40
+            screen: 'example.FirstTabScreen',
41
             title: 'Login',
41
             title: 'Login',
42
             navigatorStyle: {}
42
             navigatorStyle: {}
43
           },
43
           },

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

7
   StyleSheet,
7
   StyleSheet,
8
   Alert
8
   Alert
9
 } from 'react-native';
9
 } from 'react-native';
10
-import { connect } from 'react-redux';
10
+import {connect} from 'react-redux';
11
 import * as counterActions from '../reducers/counter/actions';
11
 import * as counterActions from '../reducers/counter/actions';
12
 
12
 
13
 let navBarVisiable = true;
13
 let navBarVisiable = true;
147
     textAlign: 'center',
147
     textAlign: 'center',
148
     fontSize: 18,
148
     fontSize: 18,
149
     marginBottom: 10,
149
     marginBottom: 10,
150
-    marginTop:10
150
+    marginTop: 10
151
   },
151
   },
152
   button: {
152
   button: {
153
     textAlign: 'center',
153
     textAlign: 'center',
154
     fontSize: 18,
154
     fontSize: 18,
155
     marginBottom: 10,
155
     marginBottom: 10,
156
-    marginTop:10,
156
+    marginTop: 10,
157
     color: 'blue'
157
     color: 'blue'
158
   }
158
   }
159
 });
159
 });

+ 12
- 7
src/deprecated/platformSpecificDeprecated.android.js View File

32
   newPlatformSpecific.startApp(params);
32
   newPlatformSpecific.startApp(params);
33
 }
33
 }
34
 
34
 
35
+function navigatorPush(navigator, params) {
36
+  debugger;
37
+  addNavigatorParams(params, navigator);
38
+  addNavigatorButtons(params);
39
+  addNavigationStyleParams(params);
40
+
41
+  params = adaptNavigationStyleToScreenStyle(params);
42
+  params = adaptNavigationParams(params);
43
+
44
+  newPlatformSpecific.push(params);
45
+}
46
+
35
 function adaptNavigationStyleToScreenStyle(screen) {
47
 function adaptNavigationStyleToScreenStyle(screen) {
36
   const navigatorStyle = screen.navigatorStyle;
48
   const navigatorStyle = screen.navigatorStyle;
37
   if (!navigatorStyle) {
49
   if (!navigatorStyle) {
92
   }
104
   }
93
 }
105
 }
94
 
106
 
95
-function navigatorPush(navigator, params) {
96
-  //addNavigatorParams(params, navigator);
97
-  //addNavigatorButtons(params);
98
-  //addNavigationStyleParams(params);
99
-  //RctActivity.navigatorPush(params);
100
-}
101
-
102
 function navigatorSetButtons(navigator, navigatorEventID, params) {
107
 function navigatorSetButtons(navigator, navigatorEventID, params) {
103
   //if (params.rightButtons) {
108
   //if (params.rightButtons) {
104
   //  params.rightButtons.forEach(function(button) {
109
   //  params.rightButtons.forEach(function(button) {

+ 10
- 5
src/platformSpecific.android.js View File

6
 
6
 
7
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
7
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
8
 
8
 
9
-function startApp(params) {
10
-  const screen = params.screen;
9
+function startApp(activityParams) {
10
+  const screen = activityParams.screen;
11
   if (!screen.screenId) {
11
   if (!screen.screenId) {
12
-    console.error('startApp(params): screenId property must be supplied');
12
+    console.error('startApp(activityParams): screenId property must be supplied');
13
     return;
13
     return;
14
   }
14
   }
15
 
15
 
16
-  NativeModules.NavigationReactModule.startApp(params);
16
+  NativeModules.NavigationReactModule.startApp(activityParams);
17
+}
18
+
19
+function push(screenParams) {
20
+  NativeModules.NavigationReactModule.push(screenParams);
17
 }
21
 }
18
 
22
 
19
 module.exports = {
23
 module.exports = {
20
-  startApp
24
+  startApp,
25
+  push
21
 };
26
 };