I have started a React Native project from scratch and configured Flow.
When I run npm run flow everything works fine except a small problem with the react-native module:
Cannot resolve module react-native.
I am using:
"react": "16.3.1",
"react-native": "0.55.3",
"flow-bin": "0.74.0"
My .flowconfig is:
[ignore]
.*/node_modules/.*
.*/.cache/.*
.*/test/.*
[include]
[libs]
[lints]
[options]
[strict]
Tried with "flow-typed": "2.4.0" but didn't work.
I found the following issue but there aren't any solutions :/
You need to add a type definition for react-native.
Create a folder called type-def-lib in your project root and inside create a file called react-native.js with these contents
declare module 'react-native' {
declare module.exports: any
}
Then in your .flowconfig add that folder under libs:
[libs]
./type-def-libs
Now yarn run flow should produce no errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With