Преглед изворни кода

Adds example for onShouldStartLoadWithRequest

Jamon Holmgren пре 6 година
родитељ
комит
f7fb0e8c02
No account linked to committer's email address
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`