Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in flow #18133

Closed
trsh opened this issue Feb 28, 2018 · 12 comments
Closed

Errors in flow #18133

trsh opened this issue Feb 28, 2018 · 12 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@trsh
Copy link

trsh commented Feb 28, 2018

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes, kind of.

Environment

Environment:
OS: Windows 10
Node: 8.9.4
Yarn: Not Found
npm: 5.5.1
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3

Steps to Reproduce

Create a new project create-react-native-app. Update react-native to 0.53.3 in package json. Add flow-bin 0.66.0. Clear node_modules. Clear npm cache. Do npm install. Add & run npm run flow.

Expected Behavior

Errors from my code, and 3rd party libraries.

Actual Behavior

Errors all over the place from react-native, metro. etc.

Error ----------------------------------------------- node_modules/react-native/Libraries/CameraRoll/CameraRoll.js:120:5

`ReactPropsChainableTypeChecker` [1] is not a React propType.

   node_modules/react-native/Libraries/CameraRoll/CameraRoll.js:120:5
            v-----------------------------
   120|     createStrictShapeTypeChecker({
   121|       node: createStrictShapeTypeChecker({
   122|         type: PropTypes.string.isRequired,
   123|         group_name: PropTypes.string.isRequired,
   124|         image: createStrictShapeTypeChecker({
   125|           uri: PropTypes.string.isRequired,
   126|           height: PropTypes.number.isRequired,
   127|           width: PropTypes.number.isRequired,
   128|           isStored: PropTypes.bool,
   129|           playableDuration: PropTypes.number.isRequired,
   130|         }).isRequired,
   131|         timestamp: PropTypes.number.isRequired,
   132|         location: createStrictShapeTypeChecker({
   133|           latitude: PropTypes.number,
   134|           longitude: PropTypes.number,
   135|           altitude: PropTypes.number,
   136|           heading: PropTypes.number,
   137|           speed: PropTypes.number,
   138|         }),
   139|       }).isRequired,
   140|     }),
            -^

References:
   node_modules/react-native/Libraries/Utilities/createStrictShapeTypeChecker.js:19:4
    19| ): ReactPropsChainableTypeChecker {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [1]


Error ------------------------------------------------------ node_modules/react-native/Libraries/Lists/FlatList.js:632:9

Cannot create `MetroListView` element because:
 - null or undefined [1] is incompatible with boolean [2] in property `refreshing`.
 - null or undefined [3] is incompatible with boolean [2] in property `refreshing`.
 - read-only array type [4] is incompatible with array type [5] in property `items`.

   node_modules/react-native/Libraries/Lists/FlatList.js:632:9
                v-------------
   632|         <MetroListView
   633|           {...this.props}
   634|           items={this.props.data}
   635|           ref={this._captureRef}
   636|         />
                -^

References:
   node_modules/react-native/Libraries/Lists/FlatList.js:190:16
   190|   refreshing?: ?boolean,
                       ^^^^^^^^ [1]
   node_modules/react-native/Libraries/Lists/MetroListView.js:46:16
    46|   refreshing?: boolean,
                       ^^^^^^^ [2]
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:179:16
   179|   refreshing?: ?boolean,
                       ^^^^^^^^ [3]
   node_modules/react-native/Libraries/Lists/FlatList.js:73:10
    73|   data: ?$ReadOnlyArray<ItemT>,
                 ^^^^^^^^^^^^^^^^^^^^^ [4]
   node_modules/react-native/Libraries/Lists/MetroListView.js:34:12
    34|   items?: ?Array<Item>, // By default, an Item is assumed to be {key: string}
                   ^^^^^^^^^^^ [5]


Error -------------------------------------------------- node_modules/react-native/Libraries/Lists/SectionList.js:331:12

Cannot create `List` element because:
 - null or undefined [1] is incompatible with boolean [2] in property `refreshing`.
 - null or undefined [3] is incompatible with boolean [2] in property `refreshing`.
 - null or undefined [4] is incompatible with boolean [2] in property `refreshing`.
 - undefined [5] is incompatible with `renderItemType` [6] in property `renderItem`.

   node_modules/react-native/Libraries/Lists/SectionList.js:331:12
   331|     return <List {...this.props} ref={this._captureRef} />;
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

References:
   node_modules/react-native/Libraries/Lists/SectionList.js:165:16
   165|   refreshing?: ?boolean,
                       ^^^^^^^^ [1]
   node_modules/react-native/Libraries/Lists/MetroListView.js:46:16
    46|   refreshing?: boolean,
                       ^^^^^^^ [2]
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:179:16
   179|   refreshing?: ?boolean,
                       ^^^^^^^^ [3]
   node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js:119:16
   119|   refreshing?: ?boolean,
                       ^^^^^^^^ [4]
   node_modules/react-native/Libraries/Lists/VirtualizedSectionList.js:68:16
                       v-------
    68|   renderItem?: (info: {
    69|     item: Item,
    70|     index: number,
    71|     section: SectionT,
    72|     separators: {
    73|       highlight: () => void,
    74|       unhighlight: () => void,
    75|       updateProps: (select: 'leading' | 'trailing', newProps: Object) => void,
    76|     },
    77|   }) => ?React.Element<any>,
          ------------------------^ [5]
   node_modules/react-native/Libraries/Lists/VirtualizedList.js:57:15
    57|   renderItem: renderItemType,
                      ^^^^^^^^^^^^^^ [6]
@FLGMwt
Copy link
Contributor

FLGMwt commented Feb 28, 2018

I just encountered this and realized it was because installed latest flow-bin (0.66.0), then updated the .flowconfig version (currently 0.63.0) to match it. I got the same List and CameraRoll type errors. I reverted both my package.json flow-bin and .flowconfig versions to 0.63.0 and the type errors no longer occurred.

Not a "fix", but since RN scaffolded the .flowconfig version, I'm personally okay letting RN dictate the flow version. (and I assume a future RN version will 1) uptick flow and 2) fix these few type errors)

@hramos
Copy link
Contributor

hramos commented Mar 1, 2018

We run Flow as part of our CI, and it's currently not raising any of these issues, at least not on master. See the Flow step at https://circleci.com/gh/facebook/react-native/35835

@aubsw
Copy link

aubsw commented Mar 1, 2018

I'm seeing the issue with renderItemType when using a SectionList RN 0.51 with flow 0.66 (obviously a different version of flow than what ships with RN 0.51)

possibly related:

type RequiredProps = {
// TODO: Conflicts with the optional `renderItem` in
// `VirtualizedSectionList`'s props.
renderItem: $FlowFixMe<renderItemType>,
/**

@hramos
Copy link
Contributor

hramos commented Mar 2, 2018

FWIW, Flow checks did not fail in the most recent CI run for the 0.51-stable branch: https://circleci.com/gh/facebook/react-native/26635

@hramos
Copy link
Contributor

hramos commented Mar 2, 2018

Flow checks are not failing in 0.53-stable either: https://circleci.com/gh/facebook/react-native/34560

@EdwardDrapkin
Copy link

EdwardDrapkin commented Mar 2, 2018

I get the same errors on RN 0.54, but they're fixed in master. Can the changes get backported to 54 so we don't have to wait a month for fixes in 55?

@hramos
Copy link
Contributor

hramos commented Mar 5, 2018

I'm afraid not. FWIW, 0.54-stable does not show this issue: https://circleci.com/gh/facebook/react-native/tree/0.54-stable

@hramos hramos closed this as completed Mar 5, 2018
@trsh
Copy link
Author

trsh commented Mar 8, 2018

@FLGMwt switching back to Flow 0.63.0 worked for me also. So a mix of RN 0.53.3 and 0.63.0 works. Haven't tested newer versions.

@rumax
Copy link
Contributor

rumax commented Mar 11, 2018

@hramos The issue is closed, but is it flow or eact-native bug? I could not find such bug in flow repo. Moreover is there any official react-native documentation that states that we should use only flow 0.54?

@trsh
Copy link
Author

trsh commented Mar 12, 2018

@rumax if you use older RN, use older Flow. But I don't think this mapping is documented. :/

@awaseem
Copy link

awaseem commented Apr 24, 2018

I was also getting this issue when upgrading to RN 0.55.3 using flow version 0.67.1. I solved the problem by actually copying there flow suppressing comments within there .flowconfig into my projects .flowconfig. These were the lines I copied from RN's .flowconfig to mine:

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*[react_native_oss|react_native_fb][a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*[react_native_oss|react_native_fb][a-z,_]*\\)?)\\)?:? #[0-9]+

assuming you have those suppress types ($FlowFixMe, $FlowIssue) already defined which looks like the following:

suppress_type=$FlowIssue
suppress_type=$FlowFixMe

Hope that helps!

@ericketts
Copy link

I'm afraid not. FWIW, 0.54-stable does not show this issue: https://circleci.com/gh/facebook/react-native/tree/0.54-stable

because they $FlowIgnored everything that was erroring 😂

@facebook facebook locked as resolved and limited conversation to collaborators Mar 5, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants