|  | @@ -6,8 +6,7 @@ We are rebuilding react-native-navigation
 | 
	
		
			
			| 6 | 6 |  
 | 
	
		
			
			| 7 | 7 |  - [Why?](#why-rebuild-react-native-navigation)
 | 
	
		
			
			| 8 | 8 |  - [Where is it standing now?](#current-status)
 | 
	
		
			
			| 9 |  | -- [Getting Started](#getting-started-with-v2)
 | 
	
		
			
			| 10 |  | -- [Usage](#usage)
 | 
	
		
			
			|  | 9 | +- [Documentation](https://wix.github.io/react-native-navigation/v2/)
 | 
	
		
			
			| 11 | 10 |  - [Contributing](CONTRIBUTING.md)
 | 
	
		
			
			| 12 | 11 |  
 | 
	
		
			
			| 13 | 12 |  ## Why Rebuild react-native-navigation?
 | 
	
	
		
			
			|  | @@ -109,257 +108,4 @@ Note:  v1 properties with names beginning with 'navBar' are replaced in v2 with
 | 
	
		
			
			| 109 | 108 |  | splitViewScreen       |     :x:  |    [Contribute](CONTRIBUTING.md)      | [Contribute](CONTRIBUTING.md)|
 | 
	
		
			
			| 110 | 109 |  
 | 
	
		
			
			| 111 | 110 |  
 | 
	
		
			
			| 112 |  | -Element tranisitions, adding buttons and styles are not yet implemented. [Contribute](CONTRIBUTING.md)
 | 
	
		
			
			| 113 |  | -
 | 
	
		
			
			| 114 |  | -## Getting started with v2
 | 
	
		
			
			| 115 |  | -If v2 supports everything you need for your app we encourage you to use it.
 | 
	
		
			
			| 116 |  | -
 | 
	
		
			
			| 117 |  | -### Installation
 | 
	
		
			
			| 118 |  | -1. Download react-native-navigation v2
 | 
	
		
			
			| 119 |  | -```bash
 | 
	
		
			
			| 120 |  | -npm install --save react-native-navigation@alpha
 | 
	
		
			
			| 121 |  | -```
 | 
	
		
			
			| 122 |  | -##### iOS
 | 
	
		
			
			| 123 |  | -2. In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `./node_modules/react-native-navigation/lib/ios/ReactNativeNavigation.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-1))
 | 
	
		
			
			| 124 |  | -
 | 
	
		
			
			| 125 |  | -3. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Phases` tab (right pane). In the `Link Binary With Libraries` section add `libReactNativeNavigation.a` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-2))
 | 
	
		
			
			| 126 |  | -
 | 
	
		
			
			| 127 |  | -4. In Xcode, in Project Navigator (left pane), click on your project (top) and select the `Build Settings` tab (right pane). In the `Header Search Paths` section add `$(SRCROOT)/../node_modules/react-native-navigation/lib/ios`. Make sure on the right to mark this new path `recursive` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-3))
 | 
	
		
			
			| 128 |  | -
 | 
	
		
			
			| 129 |  | -5. In Xcode, under your project files, modify `AppDelegate.m`. add:
 | 
	
		
			
			| 130 |  | -
 | 
	
		
			
			| 131 |  | -`#import <ReactNativeNavigation/ReactNativeNavigation.h>`
 | 
	
		
			
			| 132 |  | -
 | 
	
		
			
			| 133 |  | -remove everything in the method didFinishLaunchingWithOptions and add:
 | 
	
		
			
			| 134 |  | -
 | 
	
		
			
			| 135 |  | -```
 | 
	
		
			
			| 136 |  | -NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
 | 
	
		
			
			| 137 |  | -[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
 | 
	
		
			
			| 138 |  | -```
 | 
	
		
			
			| 139 |  | -
 | 
	
		
			
			| 140 |  | -##### Android
 | 
	
		
			
			| 141 |  | -2. Add the following in `android/settings.gradle`.
 | 
	
		
			
			| 142 |  | -
 | 
	
		
			
			| 143 |  | -	```groovy
 | 
	
		
			
			| 144 |  | -	include ':react-native-navigation'
 | 
	
		
			
			| 145 |  | -	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
 | 
	
		
			
			| 146 |  | -	```
 | 
	
		
			
			| 147 |  | -
 | 
	
		
			
			| 148 |  | -3. Update project dependencies in `android/app/build.gradle`.
 | 
	
		
			
			| 149 |  | -	```groovy
 | 
	
		
			
			| 150 |  | -	android {
 | 
	
		
			
			| 151 |  | -		compileSdkVersion 25
 | 
	
		
			
			| 152 |  | -		buildToolsVersion "25.0.1"
 | 
	
		
			
			| 153 |  | -		...
 | 
	
		
			
			| 154 |  | -	}
 | 
	
		
			
			| 155 |  | -
 | 
	
		
			
			| 156 |  | -	dependencies {
 | 
	
		
			
			| 157 |  | -		compile fileTree(dir: "libs", include: ["*.jar"])
 | 
	
		
			
			| 158 |  | -		compile "com.android.support:appcompat-v7:23.0.1"
 | 
	
		
			
			| 159 |  | -		compile "com.facebook.react:react-native:+"
 | 
	
		
			
			| 160 |  | -		compile project(':react-native-navigation')
 | 
	
		
			
			| 161 |  | -	}
 | 
	
		
			
			| 162 |  | -	```
 | 
	
		
			
			| 163 |  | -
 | 
	
		
			
			| 164 |  | -4. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
 | 
	
		
			
			| 165 |  | -
 | 
	
		
			
			| 166 |  | -	This file can be located in `android/app/src/main/java/com/yourproject/`.
 | 
	
		
			
			| 167 |  | -
 | 
	
		
			
			| 168 |  | -	```java
 | 
	
		
			
			| 169 |  | -	import com.reactnativenavigation.NavigationActivity;
 | 
	
		
			
			| 170 |  | -
 | 
	
		
			
			| 171 |  | -	public class MainActivity extends NavigationActivity {
 | 
	
		
			
			| 172 |  | -
 | 
	
		
			
			| 173 |  | -	}
 | 
	
		
			
			| 174 |  | -	```
 | 
	
		
			
			| 175 |  | -
 | 
	
		
			
			| 176 |  | -	If you have any **react-native** related methods, you can safely delete them.
 | 
	
		
			
			| 177 |  | -
 | 
	
		
			
			| 178 |  | -5. In `MainApplication.java`, add the following
 | 
	
		
			
			| 179 |  | -	```java
 | 
	
		
			
			| 180 |  | -	import com.reactnativenavigation.NavigationApplication;
 | 
	
		
			
			| 181 |  | -
 | 
	
		
			
			| 182 |  | -	public class MainApplication extends NavigationApplication {
 | 
	
		
			
			| 183 |  | -
 | 
	
		
			
			| 184 |  | -		@Override
 | 
	
		
			
			| 185 |  | -		public boolean isDebug() {
 | 
	
		
			
			| 186 |  | -			// Make sure you are using BuildConfig from your own application
 | 
	
		
			
			| 187 |  | -			return BuildConfig.DEBUG;
 | 
	
		
			
			| 188 |  | -		}
 | 
	
		
			
			| 189 |  | -
 | 
	
		
			
			| 190 |  | -		protected List<ReactPackage> getPackages() {
 | 
	
		
			
			| 191 |  | -			// Add additional packages you require here
 | 
	
		
			
			| 192 |  | -			// No need to add RnnPackage and MainReactPackage
 | 
	
		
			
			| 193 |  | -			return Arrays.<ReactPackage>asList(
 | 
	
		
			
			| 194 |  | -				// eg. new VectorIconsPackage()
 | 
	
		
			
			| 195 |  | -			);
 | 
	
		
			
			| 196 |  | -		}
 | 
	
		
			
			| 197 |  | -	}
 | 
	
		
			
			| 198 |  | -	```
 | 
	
		
			
			| 199 |  | -
 | 
	
		
			
			| 200 |  | -	Make sure that `isDebug` methods is implemented.
 | 
	
		
			
			| 201 |  | -
 | 
	
		
			
			| 202 |  | -6. Update `AndroidManifest.xml` and set **android:name** value to `.MainApplication`
 | 
	
		
			
			| 203 |  | -	```xml
 | 
	
		
			
			| 204 |  | -	<application
 | 
	
		
			
			| 205 |  | -		android:name=".MainApplication"
 | 
	
		
			
			| 206 |  | -		...
 | 
	
		
			
			| 207 |  | -	/>
 | 
	
		
			
			| 208 |  | -## Usage
 | 
	
		
			
			| 209 |  | -### Top Screen API
 | 
	
		
			
			| 210 |  | -
 | 
	
		
			
			| 211 |  | -#### Navigation
 | 
	
		
			
			| 212 |  | -```js
 | 
	
		
			
			| 213 |  | -import Navigation from 'react-native-navigation';
 | 
	
		
			
			| 214 |  | -```
 | 
	
		
			
			| 215 |  | -#### Events - On App Launched
 | 
	
		
			
			| 216 |  | -How to initiate your app.
 | 
	
		
			
			| 217 |  | -
 | 
	
		
			
			| 218 |  | -```js
 | 
	
		
			
			| 219 |  | -Navigation.events().onAppLaunched(() => {
 | 
	
		
			
			| 220 |  | -    Navigation.setRoot({
 | 
	
		
			
			| 221 |  | -      container: {
 | 
	
		
			
			| 222 |  | -        name: 'navigation.playground.WelcomeScreen'
 | 
	
		
			
			| 223 |  | -      }
 | 
	
		
			
			| 224 |  | -    });
 | 
	
		
			
			| 225 |  | -  });
 | 
	
		
			
			| 226 |  | -```
 | 
	
		
			
			| 227 |  | -
 | 
	
		
			
			| 228 |  | -#### registerContainer(screenID, generator)
 | 
	
		
			
			| 229 |  | -Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
 | 
	
		
			
			| 230 |  | -```js
 | 
	
		
			
			| 231 |  | -Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
 | 
	
		
			
			| 232 |  | -```
 | 
	
		
			
			| 233 |  | -
 | 
	
		
			
			| 234 |  | -#### setRoot({params})
 | 
	
		
			
			| 235 |  | -Start a Single page app with two side menus:
 | 
	
		
			
			| 236 |  | -```js
 | 
	
		
			
			| 237 |  | -Navigation.setRoot({
 | 
	
		
			
			| 238 |  | -      container: {
 | 
	
		
			
			| 239 |  | -        name: 'navigation.playground.WelcomeScreen'
 | 
	
		
			
			| 240 |  | -      },
 | 
	
		
			
			| 241 |  | -      sideMenu: {
 | 
	
		
			
			| 242 |  | -        left: {
 | 
	
		
			
			| 243 |  | -          container: {
 | 
	
		
			
			| 244 |  | -            name: 'navigation.playground.TextScreen',
 | 
	
		
			
			| 245 |  | -            passProps: {
 | 
	
		
			
			| 246 |  | -              text: 'This is a left side menu screen'
 | 
	
		
			
			| 247 |  | -            }
 | 
	
		
			
			| 248 |  | -          }
 | 
	
		
			
			| 249 |  | -        },
 | 
	
		
			
			| 250 |  | -        right: {
 | 
	
		
			
			| 251 |  | -          container: {
 | 
	
		
			
			| 252 |  | -            name: 'navigation.playground.TextScreen',
 | 
	
		
			
			| 253 |  | -            passProps: {
 | 
	
		
			
			| 254 |  | -              text: 'This is a right side menu screen'
 | 
	
		
			
			| 255 |  | -            }
 | 
	
		
			
			| 256 |  | -          }
 | 
	
		
			
			| 257 |  | -        }
 | 
	
		
			
			| 258 |  | -      }
 | 
	
		
			
			| 259 |  | -    });
 | 
	
		
			
			| 260 |  | -```
 | 
	
		
			
			| 261 |  | -Start a tab based app:
 | 
	
		
			
			| 262 |  | -```js
 | 
	
		
			
			| 263 |  | -Navigation.setRoot({
 | 
	
		
			
			| 264 |  | -      tabs: [
 | 
	
		
			
			| 265 |  | -        {
 | 
	
		
			
			| 266 |  | -          container: {
 | 
	
		
			
			| 267 |  | -            name: 'navigation.playground.TextScreen',
 | 
	
		
			
			| 268 |  | -            passProps: {
 | 
	
		
			
			| 269 |  | -              text: 'This is tab 1',
 | 
	
		
			
			| 270 |  | -              myFunction: () => 'Hello from a function!'
 | 
	
		
			
			| 271 |  | -            }
 | 
	
		
			
			| 272 |  | -          }
 | 
	
		
			
			| 273 |  | -        },
 | 
	
		
			
			| 274 |  | -        {
 | 
	
		
			
			| 275 |  | -          container: {
 | 
	
		
			
			| 276 |  | -            name: 'navigation.playground.TextScreen',
 | 
	
		
			
			| 277 |  | -            passProps: {
 | 
	
		
			
			| 278 |  | -              text: 'This is tab 2'
 | 
	
		
			
			| 279 |  | -            }
 | 
	
		
			
			| 280 |  | -          }
 | 
	
		
			
			| 281 |  | -        }
 | 
	
		
			
			| 282 |  | -      ]
 | 
	
		
			
			| 283 |  | -    });
 | 
	
		
			
			| 284 |  | -```
 | 
	
		
			
			| 285 |  | -### Screen API
 | 
	
		
			
			| 286 |  | -
 | 
	
		
			
			| 287 |  | -#### push(params)
 | 
	
		
			
			| 288 |  | -Push a new screen into this screen's navigation stack.
 | 
	
		
			
			| 289 |  | -```js
 | 
	
		
			
			| 290 |  | -Navigation.push(this.props.containerId, {
 | 
	
		
			
			| 291 |  | -      name: 'navigation.playground.PushedScreen',
 | 
	
		
			
			| 292 |  | -      passProps: {}
 | 
	
		
			
			| 293 |  | -    });
 | 
	
		
			
			| 294 |  | -```
 | 
	
		
			
			| 295 |  | -#### pop(containerId)
 | 
	
		
			
			| 296 |  | -Pop the top screen from this screen's navigation stack.
 | 
	
		
			
			| 297 |  | -```js
 | 
	
		
			
			| 298 |  | -Navigation.pop(this.props.containerId);
 | 
	
		
			
			| 299 |  | -```
 | 
	
		
			
			| 300 |  | -#### popTo(params)
 | 
	
		
			
			| 301 |  | -```js
 | 
	
		
			
			| 302 |  | -Navigation.popTo(this.props.containerId, this.props.previousScreenIds[0]);
 | 
	
		
			
			| 303 |  | -```
 | 
	
		
			
			| 304 |  | -#### popToRoot()
 | 
	
		
			
			| 305 |  | -Pop all the screens until the root from this screen's navigation stack
 | 
	
		
			
			| 306 |  | -```js
 | 
	
		
			
			| 307 |  | -Navigation.popToRoot(this.props.containerId);
 | 
	
		
			
			| 308 |  | -```
 | 
	
		
			
			| 309 |  | -#### showModal(params = {})
 | 
	
		
			
			| 310 |  | -Show a screen as a modal.
 | 
	
		
			
			| 311 |  | -```js
 | 
	
		
			
			| 312 |  | -Navigation.showModal({
 | 
	
		
			
			| 313 |  | -      container: {
 | 
	
		
			
			| 314 |  | -        name: 'navigation.playground.ModalScreen',
 | 
	
		
			
			| 315 |  | -        passProps: {
 | 
	
		
			
			| 316 |  | -            key: 'value'
 | 
	
		
			
			| 317 |  | -        }
 | 
	
		
			
			| 318 |  | -      }
 | 
	
		
			
			| 319 |  | -    });
 | 
	
		
			
			| 320 |  | -```
 | 
	
		
			
			| 321 |  | -#### dismissModal(containerId)
 | 
	
		
			
			| 322 |  | -Dismiss modal.
 | 
	
		
			
			| 323 |  | -```js
 | 
	
		
			
			| 324 |  | -Navigation.dismissModal(this.props.containerId);
 | 
	
		
			
			| 325 |  | -```
 | 
	
		
			
			| 326 |  | -#### dismissAllModals()
 | 
	
		
			
			| 327 |  | -Dismiss all the current modals at the same time.
 | 
	
		
			
			| 328 |  | -```js
 | 
	
		
			
			| 329 |  | -Navigation.dismissAllModals();
 | 
	
		
			
			| 330 |  | -```
 | 
	
		
			
			| 331 |  | -#### Screen Lifecycle - didDisappear() and didAppear()
 | 
	
		
			
			| 332 |  | -
 | 
	
		
			
			| 333 |  | -The didDisappear() and didAppear() functions are lifecycle functions that are added to the screen and run when a screen apears and disappears from the screen. To use them simply add them to your component like any other react lifecycle function:
 | 
	
		
			
			| 334 |  | -
 | 
	
		
			
			| 335 |  | -```js
 | 
	
		
			
			| 336 |  | -class LifecycleScreen extends Component {
 | 
	
		
			
			| 337 |  | -  constructor(props) {
 | 
	
		
			
			| 338 |  | -    super(props);
 | 
	
		
			
			| 339 |  | -    this.state = {
 | 
	
		
			
			| 340 |  | -      text: 'nothing yet'
 | 
	
		
			
			| 341 |  | -    };
 | 
	
		
			
			| 342 |  | -  }
 | 
	
		
			
			| 343 |  | -
 | 
	
		
			
			| 344 |  | -  didAppear() {
 | 
	
		
			
			| 345 |  | -    this.setState({ text: 'didAppear' });
 | 
	
		
			
			| 346 |  | -  }
 | 
	
		
			
			| 347 |  | -
 | 
	
		
			
			| 348 |  | -  didDisappear() {
 | 
	
		
			
			| 349 |  | -    alert('didDisappear');
 | 
	
		
			
			| 350 |  | -  }
 | 
	
		
			
			| 351 |  | -
 | 
	
		
			
			| 352 |  | -  componentWillUnmount() {
 | 
	
		
			
			| 353 |  | -    alert('componentWillUnmount');
 | 
	
		
			
			| 354 |  | -  }
 | 
	
		
			
			| 355 |  | -
 | 
	
		
			
			| 356 |  | -  render() {
 | 
	
		
			
			| 357 |  | -    return (
 | 
	
		
			
			| 358 |  | -      <View style={styles.root}>
 | 
	
		
			
			| 359 |  | -        <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
 | 
	
		
			
			| 360 |  | -	<Text style={styles.h1}>{this.state.text}</Text>
 | 
	
		
			
			| 361 |  | -      </View>
 | 
	
		
			
			| 362 |  | -    );
 | 
	
		
			
			| 363 |  | -  }
 | 
	
		
			
			| 364 |  | -}
 | 
	
		
			
			| 365 |  | -```
 | 
	
		
			
			|  | 111 | +Element tranisitions, adding buttons and styles are not yet implemented. [Contribute](CONTRIBUTING.md)
 |