소스 검색

Added v2 docs (#1795)

Johan 7 년 전
부모
커밋
a147509332
7개의 변경된 파일416개의 추가작업 그리고 256개의 파일을 삭제
  1. 2
    256
      README.md
  2. 16
    0
      docs/_sidebar.md
  3. 56
    0
      docs/index.html
  4. 76
    0
      docs/installation-android.md
  5. 24
    0
      docs/installation-ios.md
  6. 83
    0
      docs/sw.js
  7. 159
    0
      docs/usage.md

+ 2
- 256
README.md 파일 보기

@@ -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)

+ 16
- 0
docs/_sidebar.md 파일 보기

@@ -1 +1,17 @@
1 1
 - Getting started
2
+ - [Installation - iOS](/installation-ios)
3
+ - [Installation - Android](/installation-android)
4
+ - [Usage](/usage)
5
+<!-- 
6
+- Guide
7
+ - [Top Level API](/top-level-api)
8
+ - [Screen API](/screen-api)
9
+ - [Deep links](/deep-links)
10
+ - [Android Specific Use Cases](/android-specific-use-cases)
11
+ - [Third Party Libraries Support](/third-party-libraries-support)
12
+
13
+- Customization
14
+  - [Styling the Navigator](/styling-the-navigator)
15
+  - [Adding Buttons to the Navigator](/adding-buttons-to-the-navigator)
16
+  - [Styling the Tab Bar](/styling-the-tab-bar)
17
+   -->

+ 56
- 0
docs/index.html 파일 보기

@@ -0,0 +1,56 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <title>React Native Navigation - truly native navigation for iOS and Android</title>
6
+    <meta name="description" content="React Native Navigation - truly native navigation for iOS and Android">
7
+    <meta name="viewport"
8
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
9
+    <link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
10
+    <link rel="shortcut icon" href="_images/favicon.ico" type="image/x-icon">
11
+    <link rel="icon" href="_images/favicon.ico" type="image/x-icon">
12
+</head>
13
+<body>
14
+<div id="app">
15
+    <img src="https://raw.githubusercontent.com/wix/react-native-navigation/master/logo.png"
16
+         alt="react-native-navigation logo">
17
+</div>
18
+</body>
19
+<script>
20
+    window.$docsify = {
21
+        repo: '',
22
+        name: 'React Native Navigation',
23
+        search: 'auto',
24
+        themeColor: '#21B8F0',
25
+        loadSidebar: true,
26
+        loadNavbar: true,
27
+        maxLevel: 4,
28
+        subMaxLevel: 2,
29
+        auto2top: true,
30
+        ga: 'UA-XXXXX-Y',
31
+        plugins: [
32
+            function (hook) {
33
+                var footer = [
34
+                    '<hr/>',
35
+                    '<footer class="Test">',
36
+                    `<span>Caught a mistake or want to contribute to the documentation? <a href="https://github.com/wix/react-native-navigation/tree/v2/docs" target="_blank">Edit documentation on Github!</a>.</span>`,
37
+                    '</footer>'
38
+                ].join('');
39
+
40
+                hook.afterEach(function (html) {
41
+                    return html + footer;
42
+                });
43
+            }
44
+        ]
45
+    };
46
+</script>
47
+<script src="//unpkg.com/docsify/lib/docsify.js"></script>
48
+<script src="//unpkg.com/docsify/lib/plugins/search.js"></script>
49
+<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
50
+<script src="//unpkg.com/docsify/lib/plugins/ga.js"></script>
51
+<script>
52
+  if (typeof navigator.serviceWorker !== 'undefined') {
53
+    navigator.serviceWorker.register('sw.js')
54
+  }
55
+</script>
56
+</html>

+ 76
- 0
docs/installation-android.md 파일 보기

@@ -0,0 +1,76 @@
1
+# Android Installation
2
+
3
+1. Install `react-native-navigation` latest stable version.
4
+
5
+	```sh
6
+	yarn add react-native-navigation@latest
7
+	```
8
+
9
+2. Add the following in `android/settings.gradle`.
10
+
11
+	```groovy
12
+	include ':react-native-navigation'
13
+	project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/')
14
+	```
15
+
16
+3. Update project dependencies in `android/app/build.gradle`.
17
+	```groovy
18
+	android {
19
+		compileSdkVersion 25
20
+		buildToolsVersion "25.0.1"
21
+		...
22
+	}
23
+
24
+	dependencies {
25
+		compile fileTree(dir: "libs", include: ["*.jar"])
26
+		compile "com.android.support:appcompat-v7:23.0.1"
27
+		compile "com.facebook.react:react-native:+"
28
+		compile project(':react-native-navigation')
29
+	}
30
+	```
31
+
32
+4. In `MainActivity.java` it should extend `com.reactnativenavigation.NavigationActivity` instead of `ReactActivity`.
33
+
34
+	This file can be located in `android/app/src/main/java/com/yourproject/`.
35
+
36
+	```java
37
+	import com.reactnativenavigation.NavigationActivity;
38
+
39
+	public class MainActivity extends NavigationActivity {
40
+
41
+	}
42
+	```
43
+
44
+	If you have any **react-native** related methods, you can safely delete them.
45
+
46
+5. In `MainApplication.java`, add the following
47
+	```java
48
+	import com.reactnativenavigation.NavigationApplication;
49
+
50
+	public class MainApplication extends NavigationApplication {
51
+
52
+		@Override
53
+		public boolean isDebug() {
54
+			// Make sure you are using BuildConfig from your own application
55
+			return BuildConfig.DEBUG;
56
+		}
57
+
58
+		protected List<ReactPackage> getPackages() {
59
+			// Add additional packages you require here
60
+			// No need to add RnnPackage and MainReactPackage
61
+			return Arrays.<ReactPackage>asList(
62
+				// eg. new VectorIconsPackage()
63
+			);
64
+		}
65
+	}
66
+	```
67
+
68
+	Make sure that `isDebug` methods is implemented.
69
+
70
+6. Update `AndroidManifest.xml` and set **android:name** value to `.MainApplication`
71
+	```xml
72
+	<application
73
+		android:name=".MainApplication"
74
+		...
75
+	/>
76
+	```

+ 24
- 0
docs/installation-ios.md 파일 보기

@@ -0,0 +1,24 @@
1
+# iOS Installation
2
+
3
+1. Install `react-native-navigation` latest stable version.
4
+
5
+    ```sh
6
+    yarn add react-native-navigation@latest
7
+    ```
8
+
9
+2. In Xcode, in Project Navigator (left pane), right-click on the `Libraries` > `Add files to [project name]`. Add `./node_modules/react-native-navigation/ios/ReactNativeNavigation.xcodeproj` ([screenshots](https://facebook.github.io/react-native/docs/linking-libraries-ios.html#step-1))
10
+
11
+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))
12
+
13
+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/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))
14
+
15
+5. In Xcode, under your project files, modify `AppDelegate.m`. add:
16
+
17
+`#import <ReactNativeNavigation/ReactNativeNavigation.h>`
18
+
19
+remove everything in the method didFinishLaunchingWithOptions and add:
20
+
21
+```
22
+NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
23
+[ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
24
+```

+ 83
- 0
docs/sw.js 파일 보기

@@ -0,0 +1,83 @@
1
+/* ===========================================================
2
+ * docsify sw.js
3
+ * ===========================================================
4
+ * Copyright 2016 @huxpro
5
+ * Licensed under Apache 2.0
6
+ * Register service worker.
7
+ * ========================================================== */
8
+
9
+const RUNTIME = 'docsify'
10
+const HOSTNAME_WHITELIST = [
11
+  self.location.hostname,
12
+  'fonts.gstatic.com',
13
+  'fonts.googleapis.com',
14
+  'unpkg.com'
15
+]
16
+
17
+// The Util Function to hack URLs of intercepted requests
18
+const getFixedUrl = (req) => {
19
+  var now = Date.now()
20
+  var url = new URL(req.url)
21
+
22
+  // 1. fixed http URL
23
+  // Just keep syncing with location.protocol
24
+  // fetch(httpURL) belongs to active mixed content.
25
+  // And fetch(httpRequest) is not supported yet.
26
+  url.protocol = self.location.protocol
27
+
28
+  // 2. add query for caching-busting.
29
+  // Github Pages served with Cache-Control: max-age=600
30
+  // max-age on mutable content is error-prone, with SW life of bugs can even extend.
31
+  // Until cache mode of Fetch API landed, we have to workaround cache-busting with query string.
32
+  // Cache-Control-Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=453190
33
+  if (url.hostname === self.location.hostname) {
34
+    url.search += (url.search ? '&' : '?') + 'cache-bust=' + now
35
+  }
36
+  return url.href
37
+}
38
+
39
+/**
40
+ *  @Lifecycle Activate
41
+ *  New one activated when old isnt being used.
42
+ *
43
+ *  waitUntil(): activating ====> activated
44
+ */
45
+self.addEventListener('activate', event => {
46
+  event.waitUntil(self.clients.claim())
47
+})
48
+
49
+/**
50
+ *  @Functional Fetch
51
+ *  All network requests are being intercepted here.
52
+ *
53
+ *  void respondWith(Promise<Response> r)
54
+ */
55
+self.addEventListener('fetch', event => {
56
+  // Skip some of cross-origin requests, like those for Google Analytics.
57
+  if (HOSTNAME_WHITELIST.indexOf(new URL(event.request.url).hostname) > -1) {
58
+    // Stale-while-revalidate
59
+    // similar to HTTP's stale-while-revalidate: https://www.mnot.net/blog/2007/12/12/stale
60
+    // Upgrade from Jake's to Surma's: https://gist.github.com/surma/eb441223daaedf880801ad80006389f1
61
+    const cached = caches.match(event.request)
62
+    const fixedUrl = getFixedUrl(event.request)
63
+    const fetched = fetch(fixedUrl, { cache: 'no-store' })
64
+    const fetchedCopy = fetched.then(resp => resp.clone())
65
+
66
+    // Call respondWith() with whatever we get first.
67
+    // If the fetch fails (e.g disconnected), wait for the cache.
68
+    // If there’s nothing in cache, wait for the fetch.
69
+    // If neither yields a response, return offline pages.
70
+    event.respondWith(
71
+      Promise.race([fetched.catch(_ => cached), cached])
72
+        .then(resp => resp || fetched)
73
+        .catch(_ => { /* eat any errors */ })
74
+    )
75
+
76
+    // Update the cache with the version we fetched (only for ok status)
77
+    event.waitUntil(
78
+      Promise.all([fetchedCopy, caches.open(RUNTIME)])
79
+        .then(([response, cache]) => response.ok && cache.put(event.request, response))
80
+        .catch(_ => { /* eat any errors */ })
81
+    )
82
+  }
83
+})

+ 159
- 0
docs/usage.md 파일 보기

@@ -0,0 +1,159 @@
1
+# Usage
2
+
3
+## Top Screen API
4
+
5
+### Navigation
6
+```js
7
+import Navigation from 'react-native-navigation';
8
+```
9
+### Events - On App Launched
10
+How to initiate your app.
11
+
12
+```js
13
+Navigation.events().onAppLaunched(() => {
14
+  Navigation.setRoot({
15
+    container: {
16
+      name: 'navigation.playground.WelcomeScreen'
17
+    }
18
+  });
19
+});
20
+```
21
+
22
+### registerContainer(screenID, generator)
23
+Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
24
+```js
25
+Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
26
+```
27
+
28
+### setRoot({params})
29
+Start a Single page app with two side menus:
30
+```js
31
+Navigation.setRoot({
32
+  container: {
33
+    name: 'navigation.playground.WelcomeScreen'
34
+  },
35
+  sideMenu: {
36
+    left: {
37
+      container: {
38
+        name: 'navigation.playground.TextScreen',
39
+        passProps: {
40
+          text: 'This is a left side menu screen'
41
+        }
42
+      }
43
+    },
44
+    right: {
45
+      container: {
46
+        name: 'navigation.playground.TextScreen',
47
+        passProps: {
48
+          text: 'This is a right side menu screen'
49
+        }
50
+      }
51
+    }
52
+  }
53
+});
54
+```
55
+Start a tab based app:
56
+```js
57
+Navigation.setRoot({
58
+  tabs: [
59
+    {
60
+      container: {
61
+        name: 'navigation.playground.TextScreen',
62
+        passProps: {
63
+          text: 'This is tab 1',
64
+          myFunction: () => 'Hello from a function!'
65
+        }
66
+      }
67
+    },
68
+    {
69
+      container: {
70
+        name: 'navigation.playground.TextScreen',
71
+        passProps: {
72
+          text: 'This is tab 2'
73
+        }
74
+      }
75
+    }
76
+  ]
77
+});
78
+```
79
+## Screen API
80
+
81
+### push(params)
82
+Push a new screen into this screen's navigation stack.
83
+```js
84
+Navigation.push(this.props.containerId, {
85
+  name: 'navigation.playground.PushedScreen',
86
+  passProps: {}
87
+});
88
+```
89
+### pop(containerId)
90
+Pop the top screen from this screen's navigation stack.
91
+```js
92
+Navigation.pop(this.props.containerId);
93
+```
94
+### popTo(params)
95
+```js
96
+Navigation.popTo(this.props.containerId, this.props.previousScreenIds[0]);
97
+```
98
+### popToRoot()
99
+Pop all the screens until the root from this screen's navigation stack
100
+```js
101
+Navigation.popToRoot(this.props.containerId);
102
+```
103
+### showModal(params = {})
104
+Show a screen as a modal.
105
+```js
106
+Navigation.showModal({
107
+  container: {
108
+    name: 'navigation.playground.ModalScreen',
109
+    passProps: {
110
+        key: 'value'
111
+    }
112
+  }
113
+});
114
+```
115
+### dismissModal(containerId)
116
+Dismiss modal.
117
+```js
118
+Navigation.dismissModal(this.props.containerId);
119
+```
120
+### dismissAllModals()
121
+Dismiss all the current modals at the same time.
122
+```js
123
+Navigation.dismissAllModals();
124
+```
125
+### Screen Lifecycle - didDisappear() and didAppear()
126
+
127
+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:
128
+
129
+```js
130
+class LifecycleScreen extends Component {
131
+  constructor(props) {
132
+    super(props);
133
+    this.state = {
134
+      text: 'nothing yet'
135
+    };
136
+  }
137
+
138
+  didAppear() {
139
+    this.setState({ text: 'didAppear' });
140
+  }
141
+
142
+  didDisappear() {
143
+    alert('didDisappear');
144
+  }
145
+
146
+  componentWillUnmount() {
147
+    alert('componentWillUnmount');
148
+  }
149
+
150
+  render() {
151
+    return (
152
+      <View style={styles.root}>
153
+        <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
154
+	      <Text style={styles.h1}>{this.state.text}</Text>
155
+      </View>
156
+    );
157
+  }
158
+}
159
+```