Explorar el Código

Update README

Guy Carmeli hace 8 años
padre
commit
b32f760f40
Se han modificado 1 ficheros con 81 adiciones y 3 borrados
  1. 81
    3
      README.md

+ 81
- 3
README.md Ver fichero

@@ -1,3 +1,4 @@
1
+[TOC]
1 2
 # React Native Navigation
2 3
 
3 4
 App-wide support for 100% native navigation with an easy cross-platform interface. For iOS, this package is a wrapper around [react-native-controllers](https://github.com/wix/react-native-controllers), but provides a simplified more abstract API over it. This abstract API will be unified with the Android solution which is currently work in progress. It also fully supports redux if you use it.
@@ -66,11 +67,88 @@ For example, this package replaces the native [NavigatorIOS](https://facebook.gi
66 67
 }
67 68
 ```
68 69
 
69
-3. Have your `MainActivity.java` extend `com.reactnativenavigation.activities.RootActivity`. 
70
-`RootActivity` is used as a proxy activity to start your actuall app.
70
+3. Your `MainActivity` should extend `com.reactnativenavigation.controllers.SplashActivity` instead of `ReactActivity`. If you have any `react-native` related methods in your `MainActivity` you can safely delete them.
71 71
 
72
-	The only method you might need to override is `getPackages()`, make sure you add `RnnPackage` as well.
72
+4. Create a custom Application class and update the `Application` element in `AndroidManifest.xml`
73
+	
74
+	```java
75
+	import com.reactnativenavigation.NavigationApplication;
76
+	
77
+	public class MyApplication extends NavigationApplication {
78
+	
79
+	}
80
+	```
81
+	
82
+	```xml
83
+	<application
84
+        android:name=".MyApplication"
85
+        ...
86
+        />
87
+	```
88
+5. Implement `isDebug` and `createAdditionalReactPackages`
89
+
90
+	```java
91
+	import com.reactnativenavigation.NavigationApplication;
92
+	
93
+	public class MyApplication extends NavigationApplication {
94
+ 
95
+    	@Override
96
+		public boolean isDebug() {
97
+			return BuildConfig.DEBUG;
98
+		}
99
+
100
+	    @NonNull
101
+	    @Override
102
+	    public List<ReactPackage> createAdditionalReactPackages() {
103
+		    // Add the packages you require here.
104
+			// No need to add RnnPackage and MainReactPackage
105
+	        return null;
106
+	    }
107
+	}
108
+	```
109
+
110
+## Migrating to version 2.0
111
+Migrating your code base to version 2.0 will require a few changes to your native Java code. The actual navigation API has not changes so there will be no changes to your JS code base.
73 112
 
113
+* Your `MainActivity` should now extend `com.reactnativenavigation.controllers.SplashActivity`
114
+* Delete the `getPackages()` method if you've overridden it in `MainActivity`. Don't forget to delete unused imports after this step.
115
+* Create a custom Application class and update the `Application` element in `AndroidManifest.xml`
116
+	
117
+	```java
118
+	import com.reactnativenavigation.NavigationApplication;
119
+	
120
+	public class MyApplication extends NavigationApplication {
121
+	
122
+	}
123
+	```
124
+	
125
+	```xml
126
+	<application
127
+        android:name=".MyApplication"
128
+        ...
129
+        />
130
+	```
131
+* Implement `isDebug` and `createAdditionalReactPackages`
132
+
133
+	```java
134
+	import com.reactnativenavigation.NavigationApplication;
135
+	
136
+	public class MyApplication extends NavigationApplication {
137
+ 
138
+    	@Override
139
+		public boolean isDebug() {
140
+			return BuildConfig.DEBUG;
141
+		}
142
+
143
+	    @NonNull
144
+	    @Override
145
+	    public List<ReactPackage> createAdditionalReactPackages() {
146
+		    // Add the packages you require here.
147
+			// No need to add RnnPackage and MainReactPackage
148
+	        return null;
149
+	    }
150
+	}
151
+	```
74 152
 
75 153
 ## Usage
76 154