Kaynağa Gözat

Added missing RctActivity module

Guy Carmeli 8 yıl önce
ebeveyn
işleme
575d1588fd

+ 4
- 2
android/app/react-native-navigation.iml Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<module external.linked.project.id=":react-native-navigation" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../../../android" external.system.id="GRADLE" external.system.module.group="example" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2
+<module external.linked.project.id=":react-native-navigation" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/../../../../android" external.system.id="GRADLE" external.system.module.group="exampleRedux" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
3 3
   <component name="FacetManager">
4 4
     <facet type="android-gradle" name="Android-Gradle">
5 5
       <configuration>
@@ -87,6 +87,7 @@
87 87
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
88 88
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
89 89
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
90
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
90 91
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
91 92
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
92 93
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
@@ -95,6 +96,7 @@
95 96
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
96 97
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
97 98
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
99
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
98 100
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
99 101
       <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
100 102
     </content>
@@ -113,8 +115,8 @@
113 115
     <orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
114 116
     <orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
115 117
     <orderEntry type="library" exported="" name="okhttp-2.5.0" level="project" />
116
-    <orderEntry type="library" exported="" name="okhttp-ws-2.5.0" level="project" />
117 118
     <orderEntry type="library" exported="" name="okio-1.6.0" level="project" />
119
+    <orderEntry type="library" exported="" name="okhttp-ws-2.5.0" level="project" />
118 120
     <orderEntry type="library" exported="" name="fbcore-0.8.1" level="project" />
119 121
     <orderEntry type="library" exported="" name="android-jsc-r174650" level="project" />
120 122
     <orderEntry type="library" exported="" name="drawee-0.8.1" level="project" />

+ 0
- 12
android/app/src/main/java/com/reactnativenavigation/activities/RctActivity.java Dosyayı Görüntüle

@@ -2,7 +2,6 @@ package com.reactnativenavigation.activities;
2 2
 
3 3
 import android.content.Intent;
4 4
 import android.os.Bundle;
5
-import android.util.Log;
6 5
 
7 6
 import com.facebook.react.ReactInstanceManager;
8 7
 import com.facebook.react.ReactRootView;
@@ -68,15 +67,4 @@ public class RctActivity extends BaseReactActivity {
68 67
         }
69 68
         return rctManager.getReactInstanceManager();
70 69
     }
71
-
72
-    @Override
73
-    protected void onResume() {
74
-        Log.v(TAG, "onResume component: " + mComponentName);
75
-        super.onResume();
76
-    }
77
-
78
-    @Override
79
-    protected void onPause() {
80
-        super.onPause();
81
-    }
82 70
 }

+ 5
- 0
android/app/src/main/java/com/reactnativenavigation/modules/RctActivityModule.java Dosyayı Görüntüle

@@ -64,6 +64,11 @@ public class RctActivityModule extends ReactContextBaseJavaModule {
64 64
         return ret;
65 65
     }
66 66
 
67
+    @ReactMethod
68
+    public void startSingleScreenApp(ReadableMap screen) {
69
+        navigatorPush(screen);
70
+    }
71
+
67 72
     @ReactMethod
68 73
     public void navigatorPush(ReadableMap screen) {
69 74
         Activity context = ContextProvider.getActivityContext();

+ 1
- 10
android/app/src/main/java/com/reactnativenavigation/packages/RnnPackage.java Dosyayı Görüntüle

@@ -5,10 +5,6 @@ import com.facebook.react.bridge.JavaScriptModule;
5 5
 import com.facebook.react.bridge.NativeModule;
6 6
 import com.facebook.react.bridge.ReactApplicationContext;
7 7
 import com.facebook.react.uimanager.ViewManager;
8
-import com.reactnativenavigation.managers.AppBarLayoutManager;
9
-import com.reactnativenavigation.managers.CoordinatorLayoutManager;
10
-import com.reactnativenavigation.managers.TabLayoutManager;
11
-import com.reactnativenavigation.managers.ToolbarManager;
12 8
 import com.reactnativenavigation.modules.RctActivityModule;
13 9
 
14 10
 import java.util.Arrays;
@@ -35,11 +31,6 @@ public class RnnPackage implements ReactPackage {
35 31
 
36 32
     @Override
37 33
     public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
38
-        return Arrays.<ViewManager>asList(
39
-                new TabLayoutManager(),
40
-                new AppBarLayoutManager(),
41
-                new CoordinatorLayoutManager(),
42
-                new ToolbarManager()
43
-        );
34
+        return Collections.emptyList();
44 35
     }
45 36
 }

+ 3
- 1
index.js Dosyayı Görüntüle

@@ -1,7 +1,9 @@
1 1
 import Navigation from './src/Navigation';
2 2
 import Screen from './src/Screen';
3
+import RctActivity from './src/modules/RctActivity';
3 4
 
4 5
 export {
5 6
   Navigation,
6
-  Screen
7
+  Screen,
8
+  RctActivity
7 9
 };

+ 2
- 0
src/modules/RctActivity.js Dosyayı Görüntüle

@@ -0,0 +1,2 @@
1
+import { NativeModules } from 'react-native';
2
+module.exports = NativeModules.RctActivity;

+ 14
- 12
src/platformSpecific.android.js Dosyayı Görüntüle

@@ -3,19 +3,18 @@ import utils from './utils';
3 3
 
4 4
 import {
5 5
   RctActivity
6
-} from 'react-native-controllers';
6
+} from 'react-native-navigation';
7 7
 
8 8
 function startSingleScreenApp(params) {
9
-  const screen = params.screen;
9
+  let screen = params.screen;
10 10
   if (!screen.screen) {
11 11
     console.error('startSingleScreenApp(params): screen must include a screen property');
12 12
     return;
13 13
   }
14 14
 
15
-  console.warn('startSingleScreenApp not implemented yet');
16
-  // RctActivity.startSingleScreenApp(params);
17
-  // add screenInstanceID using random
18
-
15
+  console.log(RctActivity);
16
+  addNavigationParams(screen);
17
+  RctActivity.startSingleScreenApp(screen);
19 18
 }
20 19
 
21 20
 function startTabBasedApp(params) {
@@ -24,22 +23,25 @@ function startTabBasedApp(params) {
24 23
     return;
25 24
   }
26 25
 
27
-  // Add stackID for each tab
28
-  // TODO: Add propper documentation + switch to UUID? -guy
29 26
   params.tabs.forEach(function (tab, idx) {
30
-    tab.stackID = utils.getRandomId();
31
-    tab.navigatorID = utils.getRandomId() + '_nav' + idx;
32
-    tab.screenInstanceID = utils.getRandomId();
33
-    tab.navigatorEventID = tab.screenInstanceID + '_events';
27
+    addNavigationParams(tab, idx)
34 28
   });
35 29
 
36 30
   RctActivity.startTabBasedApp(params.tabs);
37 31
 }
38 32
 
39 33
 function navigatorPush(navigator, params) {
34
+  addNavigationParams(params)
40 35
   RctActivity.navigatorPush(params);
41 36
 }
42 37
 
38
+function addNavigationParams(screen, idx = '') {
39
+  screen.stackID = utils.getRandomId();
40
+  screen.navigatorID = utils.getRandomId() + '_nav' + idx;
41
+  screen.screenInstanceID = utils.getRandomId();
42
+  screen.navigatorEventID = screen.screenInstanceID + '_events';
43
+}
44
+
43 45
 export default {
44 46
   startSingleScreenApp,
45 47
   startTabBasedApp,