diff --git a/.flowconfig b/.flowconfig index 662652c1a76..7e73a16a3d1 100644 --- a/.flowconfig +++ b/.flowconfig @@ -53,6 +53,7 @@ node_modules/react-native/flow/ flow-typed/@sentry/react-native_v1.x.x.js flow-typed/@react-native-community/async-storage_v1.x.x.js flow-typed/react-native-webview_v7.x.x.js +flow-typed/react-native-url-polyfill_vx.x.x.js [strict] diff --git a/flow-typed/react-native-url-polyfill_vx.x.x.js b/flow-typed/react-native-url-polyfill_vx.x.x.js new file mode 100644 index 00000000000..e8ba67ed49c --- /dev/null +++ b/flow-typed/react-native-url-polyfill_vx.x.x.js @@ -0,0 +1,75 @@ +declare module 'react-native-url-polyfill/js/URL' { + import type { URLSearchParams } from 'react-native-url-polyfill/js/URLSearchParams'; + + // https://github.com/facebook/flow/blob/v0.98.0/lib/dom.js#L3765-L3783 + declare export class URL { + static createObjectURL(blob: Blob): string; + static createObjectURL(mediaSource: MediaSource): string; + static createFor(blob: Blob): string; + static revokeObjectURL(url: string): void; + constructor(url: string, base?: string | URL): void; + hash: string; + host: string; + hostname: string; + href: string; + origin: string; // readonly + password: string; + pathname: string; + port: string; + protocol: string; + search: string; + searchParams: URLSearchParams; // readonly + username: string; + } +} + +declare module 'react-native-url-polyfill/js/URLSearchParams' { + // https://github.com/facebook/flow/blob/v0.98.0/lib/bom.js#L1000-L1013 + declare export class URLSearchParams { + @@iterator(): Iterator<[string, string]>; + constructor( + query?: string | URLSearchParams | Array<[string, string]> | { [string]: string }, + ): void; + append(name: string, value: string): void; + delete(name: string): void; + entries(): Iterator<[string, string]>; + forEach((value: string, name: string, params: URLSearchParams) => any, thisArg?: any): void; + get(name: string): null | string; + getAll(name: string): Array; + has(name: string): boolean; + keys(): Iterator; + set(name: string, value: string): void; + values(): Iterator; + } +} + +// Filename aliases +declare module 'react-native-url-polyfill/index' { + declare module.exports: $Exports<'react-native-url-polyfill'>; +} +declare module 'react-native-url-polyfill/index.js' { + declare module.exports: $Exports<'react-native-url-polyfill'>; +} +declare module 'react-native-url-polyfill/js/URL.js' { + declare module.exports: $Exports<'react-native-url-polyfill/js/URL'>; +} +declare module 'react-native-url-polyfill/js/URLSearchParams.js' { + declare module.exports: $Exports<'react-native-url-polyfill/js/URLSearchParams'>; +} + +/** + * This is an autogenerated libdef stub for: + * + * 'react-native-url-polyfill' + * + * Fill this stub out by replacing all the `any` types. + * + * Once filled out, we encourage you to share your work with the + * community by sending a pull request to: + * https://github.com/flowtype/flow-typed + */ + +declare module 'react-native-url-polyfill' { + declare export * from 'react-native-url-polyfill/js/URL' + declare export * from 'react-native-url-polyfill/js/URLSearchParams' +} diff --git a/package.json b/package.json index ca71fcdd9fe..3eadd9dcc81 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "react-native-sound": "^0.11.0", "react-native-text-input-reset": "^1.0.2", "react-native-unimodules": "0.6.0", + "react-native-url-polyfill": "1.2.0-rc.0", "react-native-vector-icons": "^6.6.0", "react-native-webview": "8.0.4", "react-navigation": "^2.18.3", diff --git a/yarn.lock b/yarn.lock index 394bcf40a98..82941e16cf9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2096,7 +2096,7 @@ base-64@0.1.0, base-64@^0.1.0: resolved "https://registry.yarnpkg.com/base-64/-/base-64-0.1.0.tgz#780a99c84e7d600260361511c4877613bf24f6bb" integrity sha1-eAqZyE59YAJgNhURxId2E78k9rs= -base64-js@^1.1.2, base64-js@^1.2.3: +base64-js@^1.0.2, base64-js@^1.1.2, base64-js@^1.2.3: version "1.3.1" resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.3.1.tgz#58ece8cb75dd07e71ed08c736abc5fac4dbf8df1" integrity sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g== @@ -2272,6 +2272,14 @@ buffer-indexof-polyfill@~1.0.0: resolved "https://registry.yarnpkg.com/buffer-indexof-polyfill/-/buffer-indexof-polyfill-1.0.1.tgz#a9fb806ce8145d5428510ce72f278bb363a638bf" integrity sha1-qfuAbOgUXVQoUQznLyeLs2OmOL8= +buffer@^5.4.3: + version "5.6.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.6.0.tgz#a31749dc7d81d84db08abf937b6b8c4033f62786" + integrity sha512-/gDYp/UtU0eA1ys8bOs9J6a+E/KWIY+DZ+Q2WESNUA0jFRsJOc0SNUO6xJ5SGA1xueg3NL65W6s+NY5l9cunuw== + dependencies: + base64-js "^1.0.2" + ieee754 "^1.1.4" + buffers@~0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/buffers/-/buffers-0.1.1.tgz#b24579c3bed4d6d396aeee6d9a8ae7f5482ab7bb" @@ -4619,6 +4627,11 @@ iconv-lite@0.4.24, iconv-lite@^0.4.17, iconv-lite@^0.4.24, iconv-lite@^0.4.4, ic dependencies: safer-buffer ">= 2.1.2 < 3" +ieee754@^1.1.4: + version "1.1.13" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.13.tgz#ec168558e95aa181fd87d37f55c32bbcb6708b84" + integrity sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg== + ignore-walk@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.1.tgz#a83e62e7d272ac0e3b551aaa82831a19b69f82f8" @@ -8031,6 +8044,13 @@ react-native-unimodules@0.6.0: unimodules-sensors-interface "~4.0.0" unimodules-task-manager-interface "~4.0.0" +react-native-url-polyfill@1.2.0-rc.0: + version "1.2.0-rc.0" + resolved "https://registry.yarnpkg.com/react-native-url-polyfill/-/react-native-url-polyfill-1.2.0-rc.0.tgz#0fbad0c8b9bcdb6bf1865a7eb557f609911ad8a5" + integrity sha512-qn5RwlUS+MnFFbZ6Sii0PyW2Szwx5z02OBv7HyIiOExH1jledSBVhx5YHGz5U5iG03E8t+1qo62c7gWCvYVprQ== + dependencies: + whatwg-url-without-unicode "8.0.0-2" + react-native-vector-icons@^6.6.0: version "6.6.0" resolved "https://registry.yarnpkg.com/react-native-vector-icons/-/react-native-vector-icons-6.6.0.tgz#66cf004918eb05d90778d64bd42077c1800d481b" @@ -10146,6 +10166,11 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== +webidl-conversions@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" + integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== + whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" @@ -10163,6 +10188,14 @@ whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== +whatwg-url-without-unicode@8.0.0-2: + version "8.0.0-2" + resolved "https://registry.yarnpkg.com/whatwg-url-without-unicode/-/whatwg-url-without-unicode-8.0.0-2.tgz#c251148656a828bb06e2aa8da76fa798cb090f13" + integrity sha512-4ee8FO/DAV9t3spslPQbsGpVHWvkW2BjF73NuO3wShoz9L7UysTft1W+d7fsTjVOFbLYP0qjFvtsGU3b4xRP0w== + dependencies: + buffer "^5.4.3" + webidl-conversions "^5.0.0" + whatwg-url@^6.4.1: version "6.5.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8"