浏览代码

Adds example for onShouldStartLoadWithRequest

Jamon Holmgren 6 年前
父节点
当前提交
f7fb0e8c02
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 24 次插入0 次删除
  1. 24
    0
      docs/Reference.md

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

@@ -264,6 +264,30 @@ Function that allows custom handling of any web view requests. Return `true` fro
264 264
 | -------- | -------- | -------- |
265 265
 | function | No       | iOS      |
266 266
 
267
+Example:
268
+
269
+```jsx
270
+<WebView
271
+  source={{ uri: "https://infinite.red" }}
272
+  onShouldStartLoadWithRequest={(request) => {
273
+    // Only allow navigating within this website
274
+    return request.url.startsWith("https://infinite.red")
275
+  }}
276
+/>
277
+```
278
+
279
+The `request` object includes these properties:
280
+
281
+```
282
+title
283
+url
284
+target
285
+canGoBack
286
+canGoForward
287
+lockIdentifier
288
+navigationType
289
+```
290
+
267 291
 ---
268 292
 
269 293
 ### `startInLoadingState`