Procházet zdrojové kódy

chore(docs): Adds example for onShouldStartLoadWithRequest (#321)

Per #320, this adds an example for onShouldStartLoadWithRequest.
Jamon Holmgren před 5 roky
rodič
revize
d28071cf52
1 změnil soubory, kde provedl 25 přidání a 0 odebrání
  1. 25
    0
      docs/Reference.md

+ 25
- 0
docs/Reference.md Zobrazit soubor

@@ -268,6 +268,31 @@ On Android, is not called on the first load.
268 268
 | -------- | -------- |
269 269
 | function | No       |
270 270
 
271
+Example:
272
+
273
+```jsx
274
+<WebView
275
+  source={{ uri: "https://facebook.github.io/react-native" }}
276
+  onShouldStartLoadWithRequest={(request) => {
277
+    // Only allow navigating within this website
278
+    return request.url.startsWith("https://facebook.github.io/react-native")
279
+  }}
280
+/>
281
+```
282
+
283
+The `request` object includes these properties:
284
+
285
+```
286
+title
287
+url
288
+loading
289
+target
290
+canGoBack
291
+canGoForward
292
+lockIdentifier
293
+navigationType
294
+```
295
+
271 296
 ---
272 297
 
273 298
 ### `startInLoadingState`