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,6 +31,10 @@ public abstract class NavigationApplication extends Application {
31 31
         handler.post(runnable);
32 32
     }
33 33
 
34
+    public void runOnMainThread(Runnable runnable, long delay) {
35
+        handler.postDelayed(runnable, delay);
36
+    }
37
+
34 38
     public NavigationReactInstance getNavigationReactInstance() {
35 39
         return navigationReactInstance;
36 40
     }

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

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

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

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

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

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

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

@@ -32,6 +32,18 @@ function startSingleScreenApp(params) {
32 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 47
 function adaptNavigationStyleToScreenStyle(screen) {
36 48
   const navigatorStyle = screen.navigatorStyle;
37 49
   if (!navigatorStyle) {
@@ -92,13 +104,6 @@ function addTabIcon(tab) {
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 107
 function navigatorSetButtons(navigator, navigatorEventID, params) {
103 108
   //if (params.rightButtons) {
104 109
   //  params.rightButtons.forEach(function(button) {

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

@@ -6,16 +6,21 @@ import Navigation from './Navigation';
6 6
 
7 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 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 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 23
 module.exports = {
20
-  startApp
24
+  startApp,
25
+  push
21 26
 };