Skip to content

Commit 7a4c84f

Browse files
chrisbobbegnprice
authored andcommitted
react-native-webview libdef: Use React$Element with required type argument
This fixes one of the things Flow glosses over and would catch when we migrate this to a .js.flow file, with an error like this: Cannot use `React.Element` [1] without 1 type argument. [missing-type-arg] Without having a particular type in mind to pass, just use the highest, most general type allowed. See definition [1]: /** * Type of a React element. React elements are commonly created using JSX * literals, which desugar to React.createElement calls (see below). */ declare type React$Element<+ElementType: React$ElementType> = {| +type: ElementType, +props: React$ElementProps<ElementType>, +key: React$Key | null, +ref: any, |}; [1] https://github.com/facebook/flow/blob/v0.141.0/lib/react.js#L174-L183
1 parent 1cacdbf commit 7a4c84f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

flow-typed/react-native-webview_v11.x.x.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ declare module 'react-native-webview/@@react-native' {
7373
* @platform ios
7474
*/
7575
takeSnapshot: (
76-
view?: 'window' | React$Element<> | number,
76+
view?: 'window' | React$Element<React$ElementType> | number,
7777
options?: {|
7878
width?: number,
7979
height?: number,
@@ -1175,12 +1175,12 @@ declare module 'react-native-webview' {
11751175
errorDomain: string | void,
11761176
errorCode: number,
11771177
errorDesc: string,
1178-
) => React$Element,
1178+
) => React$Element<React$ElementType>,
11791179

11801180
/**
11811181
* Function that returns a loading indicator.
11821182
*/
1183-
renderLoading?: () => React$Element,
1183+
renderLoading?: () => React$Element<React$ElementType>,
11841184

11851185
/**
11861186
* Function that is invoked when the `WebView` scrolls.

0 commit comments

Comments
 (0)