Skip to content

Commit 67ef5d6

Browse files
chrisbobbegnprice
authored andcommitted
expo-web-browser libdef: Move to .js.flow files
1 parent 691112c commit 67ef5d6

File tree

5 files changed

+146
-143
lines changed

5 files changed

+146
-143
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ types/react-intl.js.flow
99
types/@react-native-community/netinfo/**
1010
types/react-native-safe-area-context/**
1111
types/@sentry/react-native.js.flow
12+
types/expo-web-browser/**
1213

1314
# These are type-tests, made up of code that gets type-checked but
1415
# never actually run. They're naturally full of dead code which

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ types/react-intl.js.flow
99
types/@react-native-community/netinfo/**
1010
types/react-native-safe-area-context/**
1111
types/@sentry/react-native.js.flow
12+
types/expo-web-browser/**
1213

1314
# Third-party code: react-native. We leave this code in the style we
1415
# received it in.

flow-typed/expo-web-browser_vx.x.x.js

Lines changed: 0 additions & 143 deletions
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* Types for the NPM module `expo-web-browser/build/WebBrowser.types`.
3+
*
4+
* @flow strict-local
5+
*/
6+
7+
export type RedirectEvent = {
8+
url: string,
9+
...
10+
};
11+
export type WebBrowserWindowFeatures = {
12+
[key: string]: number | boolean | string,
13+
...,
14+
};
15+
export type WebBrowserOpenOptions = {
16+
/**
17+
* Color of the toolbar in either #AARRGGBB or #RRGGBB format.
18+
*/
19+
toolbarColor?: string,
20+
browserPackage?: string,
21+
22+
/**
23+
* Whether the toolbar should be hiding when a user scrolls the website.
24+
*/
25+
enableBarCollapsing?: boolean,
26+
27+
/**
28+
* Android only
29+
*/
30+
/**
31+
* Color of the secondary toolbar in either #AARRGGBB or #RRGGBB format.
32+
*/
33+
secondaryToolbarColor?: string,
34+
35+
/**
36+
* Whether the browser should show the title of website on the toolbar.
37+
*/
38+
showTitle?: boolean,
39+
enableDefaultShareMenuItem?: boolean,
40+
41+
/**
42+
* Whether browsed website should be shown as separate entry in Android recents/multitasking view.
43+
* Default: `false`
44+
*/
45+
showInRecents?: boolean,
46+
47+
/**
48+
* iOS only
49+
*/
50+
controlsColor?: string,
51+
dismissButtonStyle?: 'done' | 'close' | 'cancel',
52+
readerMode?: boolean,
53+
54+
/**
55+
* **Web:** name to assign to the popup window.
56+
*/
57+
windowName?: string,
58+
59+
/**
60+
* **Web:** features to use with `window.open()`
61+
*/
62+
windowFeatures?: string | WebBrowserWindowFeatures,
63+
...
64+
};
65+
export type WebBrowserAuthSessionResult = WebBrowserRedirectResult | WebBrowserResult;
66+
export type WebBrowserCustomTabsResults = {
67+
defaultBrowserPackage?: string,
68+
preferredBrowserPackage?: string,
69+
browserPackages: string[],
70+
servicePackages: string[],
71+
...
72+
};
73+
declare export var WebBrowserResultType: {|
74+
+CANCEL: 'cancel', // "cancel"
75+
+DISMISS: 'dismiss', // "dismiss"
76+
+OPENED: 'opened', // "opened"
77+
+LOCKED: 'locked', // "locked"
78+
|};
79+
export type WebBrowserResult = {
80+
type: $Values<typeof WebBrowserResultType>,
81+
...
82+
};
83+
export type WebBrowserRedirectResult = {
84+
type: 'success',
85+
url: string,
86+
...
87+
};
88+
export type ServiceActionResult = {
89+
servicePackage?: string,
90+
...
91+
};
92+
export type WebBrowserMayInitWithUrlResult = ServiceActionResult;
93+
export type WebBrowserWarmUpResult = ServiceActionResult;
94+
export type WebBrowserCoolDownResult = ServiceActionResult;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/**
2+
* Types for the NPM package `expo-web-browser`.
3+
*
4+
* @flow strict-local
5+
*/
6+
7+
import type {
8+
WebBrowserAuthSessionResult,
9+
WebBrowserCoolDownResult,
10+
WebBrowserCustomTabsResults,
11+
WebBrowserMayInitWithUrlResult,
12+
WebBrowserOpenOptions,
13+
WebBrowserRedirectResult,
14+
WebBrowserResult,
15+
WebBrowserWarmUpResult,
16+
WebBrowserWindowFeatures,
17+
} from './WebBrowser.types';
18+
19+
export * from './WebBrowser.types'
20+
declare export function getCustomTabsSupportingBrowsersAsync(): Promise<WebBrowserCustomTabsResults>;
21+
declare export function warmUpAsync(browserPackage?: string): Promise<WebBrowserWarmUpResult>;
22+
declare export function mayInitWithUrlAsync(
23+
url: string,
24+
browserPackage?: string,
25+
): Promise<WebBrowserMayInitWithUrlResult>;
26+
declare export function coolDownAsync(browserPackage?: string): Promise<WebBrowserCoolDownResult>;
27+
declare export function openBrowserAsync(
28+
url: string,
29+
browserParams?: WebBrowserOpenOptions,
30+
): Promise<WebBrowserResult>;
31+
declare export function dismissBrowser(): void;
32+
declare export function openAuthSessionAsync(
33+
url: string,
34+
redirectUrl: string,
35+
browserParams?: WebBrowserOpenOptions,
36+
): Promise<WebBrowserAuthSessionResult>;
37+
declare export function dismissAuthSession(): void;
38+
39+
/**
40+
* Attempts to complete an auth session in the browser.
41+
* @param options
42+
*/
43+
declare export function maybeCompleteAuthSession(options?: {
44+
skipRedirectCheck?: boolean,
45+
...
46+
}): {
47+
type: 'success' | 'failed',
48+
message: string,
49+
...
50+
};

0 commit comments

Comments
 (0)