Kaynağa Gözat

deep-links payload on docs (#1152)

Carlos Roberto 7 yıl önce
ebeveyn
işleme
4848cf6e50
1 değiştirilmiş dosya ile 7 ekleme ve 3 silme
  1. 7
    3
      docs/deep-links.md

+ 7
- 3
docs/deep-links.md Dosyayı Görüntüle

@@ -7,7 +7,8 @@ Another use-case for deep links is when one screen wants to control what happens
7 7
 ```js
8 8
 onContactSelected(contactID) {
9 9
   this.props.navigator.handleDeepLink({
10
-    link: 'chats/' + contactID
10
+    link: 'chats/' + contactID,
11
+    payload: '' // (optional) Extra payload with deep link
11 12
   });
12 13
 }
13 14
 ```
@@ -28,7 +29,10 @@ export default class SecondTabScreen extends Component {
28 29
   onNavigatorEvent(event) {
29 30
     // handle a deep link
30 31
     if (event.type == 'DeepLink') {
31
-      const parts = event.link.split('/');
32
+
33
+      const parts = event.link.split('/'); // Link parts
34
+      const payload = event.payload;       // (optional) The payload
35
+
32 36
       if (parts[0] == 'tab2') {
33 37
         // handle the link somehow, usually run a this.props.navigator command
34 38
       }
@@ -38,4 +42,4 @@ export default class SecondTabScreen extends Component {
38 42
 
39 43
 #### Deep link string format
40 44
 
41
-There is no specification for the format of deep links. Since you're implementing the parsing logic in your handlers, you can use any format you wish.
45
+There is no specification for the format of deep links. Since you're implementing the parsing logic in your handlers, you can use any format you wish.