Skip to content

Commit f038f7e

Browse files
committed
fix(react): fix all react driver flow errors.
1 parent 3d698b8 commit f038f7e

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/drivers/react.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@ import { CONTEXT } from '../constants';
1010
declare class ReactClassType {}
1111

1212
// eslint-disable-next-line flowtype/require-exact-type
13-
declare class __ReactComponent {}
13+
declare class __ReactComponent {
14+
state: mixed,
15+
props: mixed,
16+
setState : (newStateOrFn : mixed) => void
17+
}
1418

1519
type ReactElementType = {|
1620

1721
|};
1822

1923
type ReactType = {|
20-
Component : __ReactComponent,
24+
Component : typeof __ReactComponent,
2125
createClass : ({| render : () => ReactElementType, componentDidMount : () => void, componentDidUpdate : () => void |}) => (typeof ReactClassType),
2226
createElement : (string, ?{ [string] : mixed }, ...children : $ReadOnlyArray<ReactElementType>) => ReactElementType
2327
|};
2428

2529
type ReactDomType = {|
26-
findDOMNode : (typeof ReactClassType) => HTMLElement
30+
findDOMNode : (__ReactComponent) => HTMLElement
2731
|};
2832

2933
type ReactLibraryType = {|
@@ -35,7 +39,7 @@ type ReactLibraryType = {|
3539
/**
3640
* Util to check if component is currently mounted
3741
*/
38-
function isMounted(component : typeof ReactClassType, ReactDOM : ReactDomType) : boolean {
42+
function isMounted(component : __ReactComponent, ReactDOM : ReactDomType) : boolean {
3943
try {
4044
return Boolean(ReactDOM.findDOMNode(component));
4145
}
@@ -45,19 +49,16 @@ function isMounted(component : typeof ReactClassType, ReactDOM : ReactDomType) :
4549
}
4650
}
4751

52+
export const react : ComponentDriverType<*, ReactLibraryType, Class<__ReactComponent>> = {
4853

49-
export const react : ComponentDriverType<*, ReactLibraryType, typeof ReactClassType> = {
50-
51-
register: (tag, propsDef, init, { React, ReactDOM }) => {
54+
register: (tag, propsDef, init, { React, ReactDOM }): Class<__ReactComponent> => {
5255

53-
// $FlowFixMe
54-
return class extends React.Component {
56+
return class ZoidReactComponent extends React.Component {
5557
render() : ReactElementType {
5658
return React.createElement('div', null);
5759
}
5860

5961
componentDidMount() {
60-
// $FlowFixMe
6162
const el = ReactDOM.findDOMNode(this);
6263
const parent = init(extend({}, this.props));
6364
parent.render(el, CONTEXT.IFRAME)

0 commit comments

Comments
 (0)