@exodus/react-native-webview 11.26.1-exodus.26 → 11.26.1-exodus.28
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/.all-contributorsrc +185 -0
- package/.circleci/config.yml +66 -0
- package/.eslintignore +2 -0
- package/.eslintrc.js +94 -0
- package/.flowconfig +88 -0
- package/.flowconfig.android +88 -0
- package/.gitattributes +12 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/bug-report.md +42 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +30 -0
- package/.github/workflows/android-ci.yml +35 -0
- package/.github/workflows/detox.yml +20 -0
- package/.github/workflows/ios-ci.yml +31 -0
- package/.github/workflows/scripts/install-vs-features.ps1 +108 -0
- package/.github/workflows/stale.yml +17 -0
- package/.gitignore +62 -0
- package/.prettierrc.js +10 -0
- package/.releaserc +15 -0
- package/.vscode/settings.json +9 -0
- package/android/.gradle/8.9/checksums/checksums.lock +0 -0
- package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.9/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java +1 -0
- package/apple/RNCWebView.m +10 -2
- package/babel.config.js +11 -0
- package/bin/setup +26 -0
- package/docs/Contributing.md +102 -0
- package/docs/Custom-Android.md +222 -0
- package/docs/Custom-iOS.md +236 -0
- package/docs/Debugging.md +101 -0
- package/docs/Getting-Started.md +142 -0
- package/docs/Guide.md +613 -0
- package/docs/Reference.md +1639 -0
- package/example/.gitignore +14 -0
- package/example/.watchmanconfig +1 -0
- package/example/App.tsx +262 -0
- package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
- package/example/android/.gradle/7.3.3/checksums/md5-checksums.bin +0 -0
- package/example/android/.gradle/7.3.3/checksums/sha1-checksums.bin +0 -0
- package/example/android/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/example/android/.gradle/7.3.3/dependencies-accessors/gc.properties +0 -0
- package/example/android/.gradle/7.3.3/executionHistory/executionHistory.lock +0 -0
- package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
- package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
- package/example/android/.gradle/7.3.3/gc.properties +0 -0
- package/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/example/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/example/android/.gradle/vcs-1/gc.properties +0 -0
- package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4.json +14 -0
- package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4.log +1 -0
- package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4_key.json +18 -0
- package/example/android/app/build/intermediates/cxx/create_cxx_tasks_21_timing.txt +62 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59.json +11 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59.log +128 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59_key.json +7 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q.json +11 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q.log +72 -0
- package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q_key.json +8 -0
- package/example/android/build.gradle +15 -0
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/example/android/gradle.properties +34 -0
- package/example/android/gradlew +234 -0
- package/example/android/gradlew.bat +89 -0
- package/example/android/settings.gradle +12 -0
- package/example/app.json +20 -0
- package/example/assets/test.html +9 -0
- package/example/babel.config.js +3 -0
- package/example/examples/Alerts.tsx +72 -0
- package/example/examples/ApplePay.tsx +23 -0
- package/example/examples/Background.tsx +54 -0
- package/example/examples/Downloads.tsx +57 -0
- package/example/examples/Injection.tsx +161 -0
- package/example/examples/LocalPageLoad.tsx +16 -0
- package/example/examples/Messaging.tsx +63 -0
- package/example/examples/NativeWebpage.tsx +22 -0
- package/example/examples/Scrolling.tsx +68 -0
- package/example/examples/Uploads.tsx +69 -0
- package/example/index.js +9 -0
- package/example/ios/Podfile +8 -0
- package/example/ios/Podfile.lock +445 -0
- package/jest-setups/jest.setup.js +8 -0
- package/jest.config.js +184 -0
- package/lib/WebView.android.d.ts.map +1 -0
- package/lib/WebView.d.ts.map +1 -0
- package/lib/WebView.ios.d.ts.map +1 -0
- package/lib/WebView.styles.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.android.d.ts.map +1 -0
- package/lib/WebViewNativeComponent.ios.d.ts.map +1 -0
- package/lib/WebViewShared.d.ts +1 -1
- package/lib/WebViewShared.d.ts.map +1 -0
- package/lib/WebViewShared.js +1 -3
- package/lib/WebViewTypes.d.ts.map +1 -0
- package/lib/index.d.ts.map +1 -0
- package/metro.config.js +57 -0
- package/package.json +2 -2
- package/src/WebView.android.tsx +255 -0
- package/src/WebView.ios.tsx +227 -0
- package/src/WebView.styles.ts +44 -0
- package/src/WebView.tsx +18 -0
- package/src/WebViewNativeComponent.android.ts +8 -0
- package/src/WebViewNativeComponent.ios.ts +8 -0
- package/src/WebViewShared.tsx +318 -0
- package/src/WebViewTypes.ts +941 -0
- package/src/__tests__/WebViewShared-test.js +292 -0
- package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +13 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +24 -0
- package/yarn.lock +13397 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { Linking } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
defaultOriginWhitelist,
|
|
5
|
+
defaultDeeplinkWhitelist,
|
|
6
|
+
createOnShouldStartLoadWithRequest,
|
|
7
|
+
} from '../WebViewShared';
|
|
8
|
+
|
|
9
|
+
Linking.openURL.mockResolvedValue(undefined);
|
|
10
|
+
Linking.canOpenURL.mockResolvedValue(true);
|
|
11
|
+
|
|
12
|
+
// The tests that call createOnShouldStartLoadWithRequest will cause a promise
|
|
13
|
+
// to get kicked off (by calling the mocked `Linking.canOpenURL`) that the tests
|
|
14
|
+
// _need_ to get run to completion _before_ doing any `expect`ing. The reason
|
|
15
|
+
// is: once that promise is resolved another function should get run which will
|
|
16
|
+
// call `Linking.openURL`, and we want to test that.
|
|
17
|
+
//
|
|
18
|
+
// Normally we would probably do something like `await
|
|
19
|
+
// createShouldStartLoadWithRequest(...)` in the tests, but that doesn't work
|
|
20
|
+
// here because the promise that gets kicked off is not returned (because
|
|
21
|
+
// non-test code doesn't need to know about it).
|
|
22
|
+
//
|
|
23
|
+
// The tests thus need a way to "flush any pending promises" (to make sure
|
|
24
|
+
// pending promises run to completion) before doing any `expect`ing. `jest`
|
|
25
|
+
// doesn't provide a way to do this out of the box, but we can use this function
|
|
26
|
+
// to do it.
|
|
27
|
+
//
|
|
28
|
+
// See this issue for more discussion: https://github.com/facebook/jest/issues/2157
|
|
29
|
+
function flushPromises() {
|
|
30
|
+
return new Promise(resolve => setImmediate(resolve));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
describe('WebViewShared', () => {
|
|
35
|
+
test('exports defaultOriginWhitelist', () => {
|
|
36
|
+
expect(defaultOriginWhitelist).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('exports defaultDeeplinkWhitelist', () => {
|
|
40
|
+
expect(defaultDeeplinkWhitelist).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('createOnShouldStartLoadWithRequest', () => {
|
|
44
|
+
const alwaysTrueOnShouldStartLoadWithRequest = (nativeEvent) => {
|
|
45
|
+
return true;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const alwaysFalseOnShouldStartLoadWithRequest = (nativeEvent) => {
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const loadRequest = jest.fn();
|
|
53
|
+
|
|
54
|
+
test('loadRequest is called without onShouldStartLoadWithRequest override', async () => {
|
|
55
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
56
|
+
loadRequest,
|
|
57
|
+
defaultOriginWhitelist,
|
|
58
|
+
defaultDeeplinkWhitelist,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
|
|
62
|
+
|
|
63
|
+
await flushPromises();
|
|
64
|
+
|
|
65
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
66
|
+
expect(loadRequest).toHaveBeenCalledWith(true, 'https://www.example.com/', 1);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
test('Linking.openURL is called without onShouldStartLoadWithRequest override', async () => {
|
|
70
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
71
|
+
loadRequest,
|
|
72
|
+
defaultOriginWhitelist,
|
|
73
|
+
['invalid:'],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', isTopFrame: true, lockIdentifier: 2 } });
|
|
77
|
+
|
|
78
|
+
await flushPromises();
|
|
79
|
+
|
|
80
|
+
expect(Linking.openURL).toHaveBeenCalledWith('invalid://example.com/');
|
|
81
|
+
expect(loadRequest).toHaveBeenCalledWith(false, 'invalid://example.com/', 2);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('loadRequest with true onShouldStartLoadWithRequest override is called', async () => {
|
|
85
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
86
|
+
loadRequest,
|
|
87
|
+
defaultOriginWhitelist,
|
|
88
|
+
defaultDeeplinkWhitelist,
|
|
89
|
+
alwaysTrueOnShouldStartLoadWithRequest,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
|
|
93
|
+
|
|
94
|
+
await flushPromises();
|
|
95
|
+
|
|
96
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
97
|
+
expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('Linking.openURL with true onShouldStartLoadWithRequest override is called for links not passing the whitelist', async () => {
|
|
101
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
102
|
+
loadRequest,
|
|
103
|
+
defaultOriginWhitelist,
|
|
104
|
+
['invalid:'],
|
|
105
|
+
alwaysTrueOnShouldStartLoadWithRequest,
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', isTopFrame: true, lockIdentifier: 1 } });
|
|
109
|
+
|
|
110
|
+
await flushPromises();
|
|
111
|
+
|
|
112
|
+
expect(Linking.openURL).toHaveBeenLastCalledWith('invalid://example.com/');
|
|
113
|
+
// We don't expect the URL to have been loaded in the WebView because it
|
|
114
|
+
// is not in the origin whitelist
|
|
115
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'invalid://example.com/', 1);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('Linking.openURL with limited whitelist', async () => {
|
|
119
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
120
|
+
loadRequest,
|
|
121
|
+
['https://*'],
|
|
122
|
+
['bitcoin:'],
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const good = 'bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=50&label=Luke-Jr&message=Donation%20for%20project%20xyz'
|
|
126
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: good, isTopFrame: true, lockIdentifier: 1 } });
|
|
127
|
+
|
|
128
|
+
await flushPromises();
|
|
129
|
+
|
|
130
|
+
expect(Linking.openURL).toHaveBeenCalledWith(good)
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test.each([
|
|
134
|
+
'javascript:alert(1)',
|
|
135
|
+
'jAvAsCrIpT:alert(1)',
|
|
136
|
+
'file:///Users/user/Documents/projects/index.html',
|
|
137
|
+
'fIlE:///Users/user/Documents/projects/index.html',
|
|
138
|
+
'http://google.com',
|
|
139
|
+
'hTtP://google.com'
|
|
140
|
+
])('Linking.openURL with default blocklist %s', async (bad) => {
|
|
141
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
142
|
+
loadRequest,
|
|
143
|
+
['https://*'],
|
|
144
|
+
['bitcoin:'],
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
|
|
148
|
+
|
|
149
|
+
await flushPromises();
|
|
150
|
+
|
|
151
|
+
expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test.each([
|
|
155
|
+
'',
|
|
156
|
+
[''],
|
|
157
|
+
'*'
|
|
158
|
+
])('Linking.openURL with empty allow list should not allow passing', async (badList) => {
|
|
159
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
160
|
+
loadRequest,
|
|
161
|
+
[],
|
|
162
|
+
[badList],
|
|
163
|
+
);
|
|
164
|
+
const bad = 'bitcoin:'
|
|
165
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
|
|
166
|
+
|
|
167
|
+
await flushPromises();
|
|
168
|
+
|
|
169
|
+
expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('Linking.openURL with hardcoded blocklist should take priority over whitelist', async () => {
|
|
173
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
174
|
+
loadRequest,
|
|
175
|
+
[],
|
|
176
|
+
['javascript:'],
|
|
177
|
+
);
|
|
178
|
+
const bad = 'javascript:alert(1)'
|
|
179
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
|
|
180
|
+
|
|
181
|
+
await flushPromises();
|
|
182
|
+
|
|
183
|
+
expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test('loadRequest with false onShouldStartLoadWithRequest override is called', async () => {
|
|
187
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
188
|
+
loadRequest,
|
|
189
|
+
defaultOriginWhitelist,
|
|
190
|
+
defaultDeeplinkWhitelist,
|
|
191
|
+
alwaysFalseOnShouldStartLoadWithRequest,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
|
|
195
|
+
|
|
196
|
+
await flushPromises();
|
|
197
|
+
|
|
198
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
199
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'https://www.example.com/', 1);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test('loadRequest with limited whitelist', async () => {
|
|
203
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
204
|
+
loadRequest,
|
|
205
|
+
['https://*'],
|
|
206
|
+
['git+https:', 'fakehttps:'],
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
|
|
210
|
+
|
|
211
|
+
await flushPromises();
|
|
212
|
+
|
|
213
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
214
|
+
expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
|
|
215
|
+
|
|
216
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'http://insecure.com/', isTopFrame: true, lockIdentifier: 2 } });
|
|
217
|
+
|
|
218
|
+
await flushPromises();
|
|
219
|
+
|
|
220
|
+
expect(Linking.openURL).not.toHaveBeenLastCalledWith('http://insecure.com/');
|
|
221
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'http://insecure.com/', 2);
|
|
222
|
+
|
|
223
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'git+https://insecure.com/', isTopFrame: true, lockIdentifier: 3 } });
|
|
224
|
+
|
|
225
|
+
await flushPromises();
|
|
226
|
+
|
|
227
|
+
expect(Linking.openURL).toHaveBeenLastCalledWith('git+https://insecure.com/');
|
|
228
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'git+https://insecure.com/', 3);
|
|
229
|
+
|
|
230
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'fakehttps://insecure.com/', isTopFrame: true, lockIdentifier: 4 } });
|
|
231
|
+
|
|
232
|
+
await flushPromises();
|
|
233
|
+
|
|
234
|
+
expect(Linking.openURL).toHaveBeenLastCalledWith('fakehttps://insecure.com/');
|
|
235
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'fakehttps://insecure.com/', 4);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
test('loadRequest allows for valid URIs', async () => {
|
|
239
|
+
const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
|
|
240
|
+
loadRequest,
|
|
241
|
+
['plus+https://*', 'DOT.https://*', 'dash-https://*', '0invalid://*', '+invalid://*'],
|
|
242
|
+
['0invalid:', '+invalid:', 'fake+plus+https:'],
|
|
243
|
+
);
|
|
244
|
+
|
|
245
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'plus+https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
|
|
246
|
+
|
|
247
|
+
await flushPromises();
|
|
248
|
+
|
|
249
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
250
|
+
// (new URL('plus+https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
|
|
251
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'plus+https://www.example.com/', 1);
|
|
252
|
+
|
|
253
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'DOT.https://www.example.com/', isTopFrame: true, lockIdentifier: 2 } });
|
|
254
|
+
|
|
255
|
+
await flushPromises();
|
|
256
|
+
|
|
257
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
258
|
+
// (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
|
|
259
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'DOT.https://www.example.com/', 2);
|
|
260
|
+
|
|
261
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'dash-https://www.example.com/', isTopFrame: true, lockIdentifier: 3 } });
|
|
262
|
+
|
|
263
|
+
await flushPromises();
|
|
264
|
+
|
|
265
|
+
expect(Linking.openURL).toHaveBeenCalledTimes(0);
|
|
266
|
+
// (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
|
|
267
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'dash-https://www.example.com/', 3);
|
|
268
|
+
|
|
269
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: '0invalid://www.example.com/', isTopFrame: true, lockIdentifier: 4 } });
|
|
270
|
+
|
|
271
|
+
await flushPromises();
|
|
272
|
+
|
|
273
|
+
expect(Linking.openURL).not.toHaveBeenLastCalledWith('0invalid://www.example.com/');
|
|
274
|
+
// (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
|
|
275
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, '0invalid://www.example.com/', 4);
|
|
276
|
+
|
|
277
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: '+invalid://www.example.com/', isTopFrame: true, lockIdentifier: 5 } });
|
|
278
|
+
|
|
279
|
+
await flushPromises();
|
|
280
|
+
|
|
281
|
+
expect(Linking.openURL).not.toHaveBeenLastCalledWith('+invalid://www.example.com/');
|
|
282
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, '+invalid://www.example.com/', 5);
|
|
283
|
+
|
|
284
|
+
onShouldStartLoadWithRequest({ nativeEvent: { url: 'FAKE+plus+https://www.example.com/', isTopFrame: true, lockIdentifier: 6 } });
|
|
285
|
+
|
|
286
|
+
await flushPromises();
|
|
287
|
+
|
|
288
|
+
expect(Linking.openURL).toHaveBeenLastCalledWith('FAKE+plus+https://www.example.com/');
|
|
289
|
+
expect(loadRequest).toHaveBeenLastCalledWith(false, 'FAKE+plus+https://www.example.com/', 6);
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
});
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["src/*"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./src/",
|
|
5
|
+
"jsx": "react-native",
|
|
6
|
+
"module": "esnext",
|
|
7
|
+
"moduleResolution": "node",
|
|
8
|
+
"target": "es2019",
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"outDir": "lib",
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"esModuleInterop": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"noImplicitReturns": true,
|
|
17
|
+
"noUnusedLocals": true,
|
|
18
|
+
"noUnusedParameters": true,
|
|
19
|
+
"pretty": true,
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"skipLibCheck": true,
|
|
22
|
+
"strict": true
|
|
23
|
+
}
|
|
24
|
+
}
|