浏览代码

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

Per #320, this adds an example for onShouldStartLoadWithRequest.
Jamon Holmgren 6 年前
父节点
当前提交
d28071cf52
共有 1 个文件被更改,包括 25 次插入0 次删除
  1. 25
    0
      docs/Reference.md

+ 25
- 0
docs/Reference.md 查看文件

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`