hybrid-navigation 2.7.9 → 2.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/deeplink.html +376 -0
- package/docs/deeplink.pdf +0 -0
- package/docs/qa.md +2 -0
- package/lib/ReactRegistry.d.ts +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
<!DOCTYPE html><html><head>
|
|
2
|
+
<title>deeplink</title>
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
5
|
+
|
|
6
|
+
<link rel="stylesheet" href="file:////Users/listen/.vscode/extensions/shd101wyy.markdown-preview-enhanced-0.6.2/node_modules/@shd101wyy/mume/dependencies/katex/katex.min.css">
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
/**
|
|
18
|
+
* prism.js Github theme based on GitHub's theme.
|
|
19
|
+
* @author Sam Clarke
|
|
20
|
+
*/
|
|
21
|
+
code[class*="language-"],
|
|
22
|
+
pre[class*="language-"] {
|
|
23
|
+
color: #333;
|
|
24
|
+
background: none;
|
|
25
|
+
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
26
|
+
text-align: left;
|
|
27
|
+
white-space: pre;
|
|
28
|
+
word-spacing: normal;
|
|
29
|
+
word-break: normal;
|
|
30
|
+
word-wrap: normal;
|
|
31
|
+
line-height: 1.4;
|
|
32
|
+
|
|
33
|
+
-moz-tab-size: 8;
|
|
34
|
+
-o-tab-size: 8;
|
|
35
|
+
tab-size: 8;
|
|
36
|
+
|
|
37
|
+
-webkit-hyphens: none;
|
|
38
|
+
-moz-hyphens: none;
|
|
39
|
+
-ms-hyphens: none;
|
|
40
|
+
hyphens: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Code blocks */
|
|
44
|
+
pre[class*="language-"] {
|
|
45
|
+
padding: .8em;
|
|
46
|
+
overflow: auto;
|
|
47
|
+
/* border: 1px solid #ddd; */
|
|
48
|
+
border-radius: 3px;
|
|
49
|
+
/* background: #fff; */
|
|
50
|
+
background: #f5f5f5;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Inline code */
|
|
54
|
+
:not(pre) > code[class*="language-"] {
|
|
55
|
+
padding: .1em;
|
|
56
|
+
border-radius: .3em;
|
|
57
|
+
white-space: normal;
|
|
58
|
+
background: #f5f5f5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.token.comment,
|
|
62
|
+
.token.blockquote {
|
|
63
|
+
color: #969896;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.token.cdata {
|
|
67
|
+
color: #183691;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.token.doctype,
|
|
71
|
+
.token.punctuation,
|
|
72
|
+
.token.variable,
|
|
73
|
+
.token.macro.property {
|
|
74
|
+
color: #333;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.token.operator,
|
|
78
|
+
.token.important,
|
|
79
|
+
.token.keyword,
|
|
80
|
+
.token.rule,
|
|
81
|
+
.token.builtin {
|
|
82
|
+
color: #a71d5d;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.token.string,
|
|
86
|
+
.token.url,
|
|
87
|
+
.token.regex,
|
|
88
|
+
.token.attr-value {
|
|
89
|
+
color: #183691;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.token.property,
|
|
93
|
+
.token.number,
|
|
94
|
+
.token.boolean,
|
|
95
|
+
.token.entity,
|
|
96
|
+
.token.atrule,
|
|
97
|
+
.token.constant,
|
|
98
|
+
.token.symbol,
|
|
99
|
+
.token.command,
|
|
100
|
+
.token.code {
|
|
101
|
+
color: #0086b3;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.token.tag,
|
|
105
|
+
.token.selector,
|
|
106
|
+
.token.prolog {
|
|
107
|
+
color: #63a35c;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.token.function,
|
|
111
|
+
.token.namespace,
|
|
112
|
+
.token.pseudo-element,
|
|
113
|
+
.token.class,
|
|
114
|
+
.token.class-name,
|
|
115
|
+
.token.pseudo-class,
|
|
116
|
+
.token.id,
|
|
117
|
+
.token.url-reference .token.variable,
|
|
118
|
+
.token.attr-name {
|
|
119
|
+
color: #795da3;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.token.entity {
|
|
123
|
+
cursor: help;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.token.title,
|
|
127
|
+
.token.title .token.punctuation {
|
|
128
|
+
font-weight: bold;
|
|
129
|
+
color: #1d3e81;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.token.list {
|
|
133
|
+
color: #ed6a43;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.token.inserted {
|
|
137
|
+
background-color: #eaffea;
|
|
138
|
+
color: #55a532;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.token.deleted {
|
|
142
|
+
background-color: #ffecec;
|
|
143
|
+
color: #bd2c00;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.token.bold {
|
|
147
|
+
font-weight: bold;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.token.italic {
|
|
151
|
+
font-style: italic;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
/* JSON */
|
|
156
|
+
.language-json .token.property {
|
|
157
|
+
color: #183691;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.language-markup .token.tag .token.punctuation {
|
|
161
|
+
color: #333;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/* CSS */
|
|
165
|
+
code.language-css,
|
|
166
|
+
.language-css .token.function {
|
|
167
|
+
color: #0086b3;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/* YAML */
|
|
171
|
+
.language-yaml .token.atrule {
|
|
172
|
+
color: #63a35c;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
code.language-yaml {
|
|
176
|
+
color: #183691;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Ruby */
|
|
180
|
+
.language-ruby .token.function {
|
|
181
|
+
color: #333;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Markdown */
|
|
185
|
+
.language-markdown .token.url {
|
|
186
|
+
color: #795da3;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/* Makefile */
|
|
190
|
+
.language-makefile .token.symbol {
|
|
191
|
+
color: #795da3;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.language-makefile .token.variable {
|
|
195
|
+
color: #183691;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.language-makefile .token.builtin {
|
|
199
|
+
color: #0086b3;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Bash */
|
|
203
|
+
.language-bash .token.keyword {
|
|
204
|
+
color: #0086b3;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* highlight */
|
|
208
|
+
pre[data-line] {
|
|
209
|
+
position: relative;
|
|
210
|
+
padding: 1em 0 1em 3em;
|
|
211
|
+
}
|
|
212
|
+
pre[data-line] .line-highlight-wrapper {
|
|
213
|
+
position: absolute;
|
|
214
|
+
top: 0;
|
|
215
|
+
left: 0;
|
|
216
|
+
background-color: transparent;
|
|
217
|
+
display: block;
|
|
218
|
+
width: 100%;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
pre[data-line] .line-highlight {
|
|
222
|
+
position: absolute;
|
|
223
|
+
left: 0;
|
|
224
|
+
right: 0;
|
|
225
|
+
padding: inherit 0;
|
|
226
|
+
margin-top: 1em;
|
|
227
|
+
background: hsla(24, 20%, 50%,.08);
|
|
228
|
+
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
|
|
229
|
+
pointer-events: none;
|
|
230
|
+
line-height: inherit;
|
|
231
|
+
white-space: pre;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
pre[data-line] .line-highlight:before,
|
|
235
|
+
pre[data-line] .line-highlight[data-end]:after {
|
|
236
|
+
content: attr(data-start);
|
|
237
|
+
position: absolute;
|
|
238
|
+
top: .4em;
|
|
239
|
+
left: .6em;
|
|
240
|
+
min-width: 1em;
|
|
241
|
+
padding: 0 .5em;
|
|
242
|
+
background-color: hsla(24, 20%, 50%,.4);
|
|
243
|
+
color: hsl(24, 20%, 95%);
|
|
244
|
+
font: bold 65%/1.5 sans-serif;
|
|
245
|
+
text-align: center;
|
|
246
|
+
vertical-align: .3em;
|
|
247
|
+
border-radius: 999px;
|
|
248
|
+
text-shadow: none;
|
|
249
|
+
box-shadow: 0 1px white;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
pre[data-line] .line-highlight[data-end]:after {
|
|
253
|
+
content: attr(data-end);
|
|
254
|
+
top: auto;
|
|
255
|
+
bottom: .4em;
|
|
256
|
+
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
|
|
257
|
+
/* Please visit the URL below for more information: */
|
|
258
|
+
/* https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */
|
|
259
|
+
|
|
260
|
+
</style>
|
|
261
|
+
</head>
|
|
262
|
+
<body for="html-export">
|
|
263
|
+
<div class="mume markdown-preview ">
|
|
264
|
+
<h1 class="mume-header" id="deeplink">DeepLink</h1>
|
|
265
|
+
|
|
266
|
+
<p>0.5.0 版本开始支持 DeepLink.</p>
|
|
267
|
+
<h2 class="mume-header" id="%E6%B3%A8%E5%86%8C">注册</h2>
|
|
268
|
+
|
|
269
|
+
<p><a name="router-config" href></a></p>
|
|
270
|
+
<p>需要支持 DeepLink 的页面,在注册时需要传入第三个参数</p>
|
|
271
|
+
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token maybe-class-name">ReactRegistry</span><span class="token punctuation">.</span><span class="token method function property-access">registerComponent</span><span class="token punctuation">(</span><span class="token string">'TopBarStyle'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token maybe-class-name">TopBarStyle</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
|
|
272
|
+
path<span class="token operator">:</span> <span class="token string">'/topBarStyle/:who'</span><span class="token punctuation">,</span>
|
|
273
|
+
dependency<span class="token operator">:</span> <span class="token string">'TopBarMisc'</span><span class="token punctuation">,</span>
|
|
274
|
+
<span class="token punctuation">}</span><span class="token punctuation">)</span>
|
|
275
|
+
</pre><p>这个参数是个对象,一共有三个可选项</p>
|
|
276
|
+
<p>path 表示路径,其中冒号开头的片段表示参数,这些参数将会通过 props 传递给目标页面。</p>
|
|
277
|
+
<p>dependency 表示前置页面,譬如一个详情页可能会依赖一个列表页,当点击返回按钮时,会回到列表页。这个选项可以确定依赖链。看 example 中的例子:</p>
|
|
278
|
+
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token maybe-class-name">ReactRegistry</span><span class="token punctuation">.</span><span class="token method function property-access">registerComponent</span><span class="token punctuation">(</span><span class="token string">'Options'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token maybe-class-name">Options</span><span class="token punctuation">)</span>
|
|
279
|
+
<span class="token maybe-class-name">ReactRegistry</span><span class="token punctuation">.</span><span class="token method function property-access">registerComponent</span><span class="token punctuation">(</span><span class="token string">'TopBarMisc'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token maybe-class-name">TopBarMisc</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> dependency<span class="token operator">:</span> <span class="token string">'Options'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span>
|
|
280
|
+
<span class="token maybe-class-name">ReactRegistry</span><span class="token punctuation">.</span><span class="token method function property-access">registerComponent</span><span class="token punctuation">(</span><span class="token string">'TopBarStyle'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token maybe-class-name">TopBarStyle</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
|
|
281
|
+
path<span class="token operator">:</span> <span class="token string">'/topBarStyle/:who'</span><span class="token punctuation">,</span>
|
|
282
|
+
dependency<span class="token operator">:</span> <span class="token string">'TopBarMisc'</span><span class="token punctuation">,</span>
|
|
283
|
+
<span class="token punctuation">}</span><span class="token punctuation">)</span>
|
|
284
|
+
</pre><p>TopBarStyle 依赖 TopBarMisc, TopBarMisc 依赖 Options, 当我们通过 <code>hbd://topBarStyle/xxxx?greeting=yyyy</code> 这样的 url 打开 TopBarStyle 这个页面时,会检查 app 当前的路由图,以决定是否切换到 tab Options, 在打开 TopBarStyle 之前是否需要创建 TopBarMisc。</p>
|
|
285
|
+
<p>mode 表示跳转模式,present 表示使用 <code>navigator.present</code> 打开目标页面, <code>modal</code> 表示使用 <code>navigator.showModal</code> 打开页面,默认是通过 push 的方式打开。</p>
|
|
286
|
+
<blockquote>
|
|
287
|
+
<p>0.23.0 开始支持 queryString,queryString 不能注册在 path 中</p>
|
|
288
|
+
</blockquote>
|
|
289
|
+
<h2 class="mume-header" id="%E6%BF%80%E6%B4%BB">激活</h2>
|
|
290
|
+
|
|
291
|
+
<p>我们需要在一个稳定的页面(通常是主页面)激活 DeepLink 功能。</p>
|
|
292
|
+
<p>譬如 example 项目,在 Navigation.js 激活了路由功能</p>
|
|
293
|
+
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token keyword module keyword-import">import</span> <span class="token imports"><span class="token punctuation">{</span> <span class="token maybe-class-name">DeepLink</span> <span class="token punctuation">}</span></span> <span class="token keyword module keyword-from">from</span> <span class="token string">'hybrid-navigation'</span><span class="token punctuation">;</span>
|
|
294
|
+
|
|
295
|
+
<span class="token function">componentDidMount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
|
296
|
+
<span class="token keyword keyword-const">const</span> prefix <span class="token operator">=</span> <span class="token string">'hbd://'</span><span class="token punctuation">;</span>
|
|
297
|
+
<span class="token maybe-class-name">DeepLink</span><span class="token punctuation">.</span><span class="token method function property-access">activate</span><span class="token punctuation">(</span>prefix<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
298
|
+
<span class="token punctuation">}</span>
|
|
299
|
+
|
|
300
|
+
<span class="token function">componentWillUnmount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
|
301
|
+
<span class="token maybe-class-name">DeepLink</span><span class="token punctuation">.</span><span class="token method function property-access">deactivate</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
|
302
|
+
<span class="token punctuation">}</span>
|
|
303
|
+
</pre><p>也可以通过以下方式激活</p>
|
|
304
|
+
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token comment">// 激活 DeepLink,在 Navigator.setRoot 之前</span>
|
|
305
|
+
<span class="token maybe-class-name">Navigator</span><span class="token punctuation">.</span><span class="token method function property-access">setRootLayoutUpdateListener</span><span class="token punctuation">(</span>
|
|
306
|
+
<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
|
307
|
+
<span class="token maybe-class-name">DeepLink</span><span class="token punctuation">.</span><span class="token method function property-access">deactivate</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
|
|
308
|
+
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
309
|
+
<span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token arrow operator">=></span> <span class="token punctuation">{</span>
|
|
310
|
+
<span class="token keyword keyword-const">const</span> prefix <span class="token operator">=</span> <span class="token string">'hbd://'</span>
|
|
311
|
+
<span class="token maybe-class-name">DeepLink</span><span class="token punctuation">.</span><span class="token method function property-access">activate</span><span class="token punctuation">(</span>prefix<span class="token punctuation">)</span>
|
|
312
|
+
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
|
313
|
+
<span class="token punctuation">)</span>
|
|
314
|
+
|
|
315
|
+
<span class="token comment">// 设置 UI 层级</span>
|
|
316
|
+
<span class="token maybe-class-name">Navigator</span><span class="token punctuation">.</span><span class="token method function property-access">setRoot</span><span class="token punctuation">(</span>drawer<span class="token punctuation">,</span> <span class="token boolean">true</span><span class="token punctuation">)</span>
|
|
317
|
+
</pre><h2 class="mume-header" id="%E6%8B%A6%E6%88%AA">拦截</h2>
|
|
318
|
+
|
|
319
|
+
<p>有时我们需要拦截默认的跳转行为</p>
|
|
320
|
+
<p>router 对象为我们提供了注册和移除拦截器的一对方法</p>
|
|
321
|
+
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token keyword module keyword-import">import</span> <span class="token imports"><span class="token punctuation">{</span> router <span class="token punctuation">}</span></span> <span class="token keyword module keyword-from">from</span> <span class="token string">'hybrid-navigation'</span>
|
|
322
|
+
router<span class="token punctuation">.</span><span class="token method function property-access">addInterceptor</span><span class="token punctuation">(</span>func<span class="token punctuation">)</span>
|
|
323
|
+
router<span class="token punctuation">.</span><span class="token method function property-access">removeInterceptor</span><span class="token punctuation">(</span>func<span class="token punctuation">)</span>
|
|
324
|
+
</pre><p>func 是一个接收 path 为参数,返回 boolen 的函数,返回 true 表示拦截。</p>
|
|
325
|
+
<p>可以通过 <code>router.pathToRoute(path)</code> 来获取路由信息</p>
|
|
326
|
+
<h2 class="mume-header" id="ios-%E9%85%8D%E7%BD%AE">iOS 配置</h2>
|
|
327
|
+
|
|
328
|
+
<p>Let's configure the native iOS app to open based on the mychat:// URI scheme.</p>
|
|
329
|
+
<p>In SimpleApp/ios/SimpleApp/AppDelegate.m:</p>
|
|
330
|
+
<pre data-role="codeBlock" data-info="objc" class="language-objectivec"><span class="token comment">// Add the header at the top of the file:</span>
|
|
331
|
+
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">import</span> <span class="token expression"><span class="token operator"><</span>React<span class="token operator">/</span>RCTLinkingManager<span class="token punctuation">.</span>h<span class="token operator">></span></span></span>
|
|
332
|
+
|
|
333
|
+
<span class="token comment">// Add this above the `@end`:</span>
|
|
334
|
+
<span class="token operator">-</span> <span class="token punctuation">(</span>BOOL<span class="token punctuation">)</span>application<span class="token punctuation">:</span><span class="token punctuation">(</span>UIApplication <span class="token operator">*</span><span class="token punctuation">)</span>application openURL<span class="token punctuation">:</span><span class="token punctuation">(</span>NSURL <span class="token operator">*</span><span class="token punctuation">)</span>url
|
|
335
|
+
sourceApplication<span class="token punctuation">:</span><span class="token punctuation">(</span>NSString <span class="token operator">*</span><span class="token punctuation">)</span>sourceApplication annotation<span class="token punctuation">:</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span>annotation
|
|
336
|
+
<span class="token punctuation">{</span>
|
|
337
|
+
<span class="token keyword keyword-return">return</span> <span class="token punctuation">[</span>RCTLinkingManager application<span class="token punctuation">:</span>application openURL<span class="token punctuation">:</span>url
|
|
338
|
+
sourceApplication<span class="token punctuation">:</span>sourceApplication annotation<span class="token punctuation">:</span>annotation<span class="token punctuation">]</span><span class="token punctuation">;</span>
|
|
339
|
+
<span class="token punctuation">}</span>
|
|
340
|
+
</pre><p>In Xcode, open the project at SimpleApp/ios/SimpleApp.xcodeproj. Select the project in sidebar and navigate to the info tab. Scroll down to "URL Types" and add one. In the new URL type, set the identifier and the url scheme to your desired url scheme.</p>
|
|
341
|
+
<p><img src="https://todoit.oss-cn-shanghai.aliyuncs.com/todoit/deeplink-2021-10-19-15-37-05.png" alt="deeplink-2021-10-19-15-37-05"></p>
|
|
342
|
+
<h2 class="mume-header" id="android-%E9%85%8D%E7%BD%AE">Android 配置</h2>
|
|
343
|
+
|
|
344
|
+
<p>To configure the external linking in Android, you can create a new intent in the manifest.</p>
|
|
345
|
+
<p>In SimpleApp/android/app/src/main/AndroidManifest.xml, add the new intent-filter inside the MainActivity entry with a VIEW type action:</p>
|
|
346
|
+
<pre data-role="codeBlock" data-info="xml" class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>intent-filter</span><span class="token punctuation">></span></span>
|
|
347
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>action</span> <span class="token attr-name"><span class="token namespace">android:</span>name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>android.intent.action.VIEW<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
|
|
348
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>category</span> <span class="token attr-name"><span class="token namespace">android:</span>name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>android.intent.category.DEFAULT<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
|
|
349
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>category</span> <span class="token attr-name"><span class="token namespace">android:</span>name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>android.intent.category.BROWSABLE<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
|
|
350
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"><</span>data</span> <span class="token attr-name"><span class="token namespace">android:</span>scheme</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>mychat<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
|
|
351
|
+
<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>intent-filter</span><span class="token punctuation">></span></span>
|
|
352
|
+
</pre><blockquote>
|
|
353
|
+
<p>MainActivity 的 launchMode 需要设置为 singleTask</p>
|
|
354
|
+
</blockquote>
|
|
355
|
+
<h2 class="mume-header" id="%E6%B5%8B%E8%AF%95">测试</h2>
|
|
356
|
+
|
|
357
|
+
<p>具体可以参考 example 这个项目中相关配置</p>
|
|
358
|
+
<p>可以在终端中通过以下两个命令分别测试 iOS 和 Android 的效果</p>
|
|
359
|
+
<p>iOS:</p>
|
|
360
|
+
<pre data-role="codeBlock" data-info class="language-"><code>xcrun simctl openurl booted "hbd://topBarStyle/xxxx?greeting=yyyy"
|
|
361
|
+
</code></pre><p>Android:</p>
|
|
362
|
+
<pre data-role="codeBlock" data-info class="language-"><code>adb shell am start -W -a android.intent.action.VIEW -d "hbd://topBarStyle/xxxx?greeting=yyyy"
|
|
363
|
+
</code></pre>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
</body></html>
|
|
Binary file
|
package/docs/qa.md
CHANGED
package/lib/ReactRegistry.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface InjectedProps {
|
|
|
10
10
|
sceneId: string;
|
|
11
11
|
}
|
|
12
12
|
export declare const NavigationContext: React.Context<any>;
|
|
13
|
-
export declare type HOC = (WrappedComponent:
|
|
13
|
+
export declare type HOC = (WrappedComponent: ComponentType<any>) => ComponentType<any>;
|
|
14
14
|
export declare class ReactRegistry {
|
|
15
15
|
static registerEnded: boolean;
|
|
16
16
|
static startRegisterComponent(hoc?: HOC): void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hybrid-navigation",
|
|
3
3
|
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
-
"version": "2.7.
|
|
4
|
+
"version": "2.7.10",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
7
7
|
"navigation",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"jest": "^27.2.0",
|
|
55
55
|
"metro-react-native-babel-preset": "^0.68.0",
|
|
56
56
|
"react": "17.0.2",
|
|
57
|
-
"react-native": "^0.67.
|
|
57
|
+
"react-native": "^0.67.4",
|
|
58
58
|
"react-native-fast-image": "^8.5.11",
|
|
59
59
|
"react-native-iphone-x-helper": "^1.2.0",
|
|
60
60
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
|
@@ -63,7 +63,8 @@
|
|
|
63
63
|
"react-test-renderer": "17.0.2",
|
|
64
64
|
"redux": "^4.1.1",
|
|
65
65
|
"typescript": "^4.4.3",
|
|
66
|
-
"vuepress": "^2.0.0-beta.26"
|
|
66
|
+
"vuepress": "^2.0.0-beta.26",
|
|
67
|
+
"zustand": "^3.7.1"
|
|
67
68
|
},
|
|
68
69
|
"jest": {
|
|
69
70
|
"preset": "react-native",
|