Ver código fonte

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

Per #320, this adds an example for onShouldStartLoadWithRequest.
Jamon Holmgren 5 anos atrás
pai
commit
d28071cf52
1 arquivos alterados com 25 adições e 0 exclusões
  1. 25
    0
      docs/Reference.md

+ 25
- 0
docs/Reference.md Ver arquivo

268
 | -------- | -------- |
268
 | -------- | -------- |
269
 | function | No       |
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
 ### `startInLoadingState`
298
 ### `startInLoadingState`