Backslash36
Backslash36

Reputation: 805

Where are the React Flow types defined?

In the Flow documentation, the React Type Reference article mentions various Flow types exported by the React module.

When digging into React's code, I cannot find any of those type definitions. Therefore, I do not understand how Flow can effectively parse them.

What am I missing here ?

Upvotes: 1

Views: 1155

Answers (3)

Mihey Mik
Mihey Mik

Reputation: 1852

As I understand this - Flow supports React types natively. All react types are inside the Flow source code.

Upvotes: 0

Tr1et
Tr1et

Reputation: 895

The definitions can be viewed in React type definitions

There is also a handy cheat sheet here for quick reference.

Upvotes: 1

Mohhamad Hasham
Mohhamad Hasham

Reputation: 2032

You can find some detailed discussion here:

https://medium.com/flow-type/even-better-support-for-react-in-flow-25b0a3485627

For React native you can do:

// @flow

import { StyleSheet } from 'react-native';

type Props = {
    style?: StyleSheet.Styles | Array<StyleSheet.Styles>
};

Upvotes: 0

Related Questions