react-native: Tons of errors in flow after upgrade to latest RC
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 27.08 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 9.11.1 - ~/.nvs/default/bin/node
Yarn: 1.6.0 - ~/.nvs/default/bin/yarn
npm: 5.8.0 - ~/.nvs/default/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.1, macOS 10.13, tvOS 11.1, watchOS 4.1
Android SDK:
Build Tools: 23.0.1, 25.0.3, 26.0.2, 26.0.3, 27.0.3
API Levels: 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.0 AI-171.4443003
Xcode: 9.1/9B55 - /usr/bin/xcodebuild
npmPackages:
react: 16.3.2 => 16.3.2
react-native: ^0.56.0-rc.2 => 0.56.0-rc.2
npmGlobalPackages:
react-native-git-upgrade: 0.2.7
Description
Tons of flow errors about being unable to find stuff like StatusBar, View, Text, etc.
Error --------------------------- node_modules/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js:13:30
Cannot resolve module `EventEmitter`.
13| const EventEmitter = require('EventEmitter');
^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js:14:39
Cannot resolve module `RCTDeviceEventEmitter`.
14| const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
^^^^^^^^^^^^^^^^^^^^^^^
Error ------------------------------------------ node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.js:13:30
Cannot resolve module `AnimatedNode`.
13| const AnimatedNode = require('AnimatedNode');
^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:19:20
Cannot resolve module `AccessibilityInfo`.
19| return require('AccessibilityInfo');
^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:22:20
Cannot resolve module `ActivityIndicator`.
22| return require('ActivityIndicator');
^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:25:20
Cannot resolve module `ReactNativeART`.
25| return require('ReactNativeART');
^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:28:20
Cannot resolve module `Button`.
28| return require('Button');
^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:31:20
Cannot resolve module `CheckBox`.
31| return require('CheckBox');
^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:34:20
Cannot resolve module `DatePickerIOS`.
34| return require('DatePickerIOS');
^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:37:20
Cannot resolve module `DrawerLayoutAndroid`.
37| return require('DrawerLayoutAndroid');
^^^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:40:20
Cannot resolve module `FlatList`.
40| return require('FlatList');
^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:43:20
Cannot resolve module `Image`.
43| return require('Image');
^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:46:20
Cannot resolve module `ImageBackground`.
46| return require('ImageBackground');
^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:49:20
Cannot resolve module `ImageEditor`.
49| return require('ImageEditor');
^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:52:20
Cannot resolve module `ImageStore`.
52| return require('ImageStore');
^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:55:20
Cannot resolve module `InputAccessoryView`.
55| return require('InputAccessoryView');
^^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:58:20
Cannot resolve module `KeyboardAvoidingView`.
58| return require('KeyboardAvoidingView');
^^^^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:61:20
Cannot resolve module `ListView`.
61| return require('ListView');
^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:64:20
Cannot resolve module `MaskedViewIOS`.
64| return require('MaskedViewIOS');
^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:67:20
Cannot resolve module `Modal`.
67| return require('Modal');
^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:70:20
Cannot resolve module `NavigatorIOS`.
70| return require('NavigatorIOS');
^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:73:20
Cannot resolve module `Picker`.
73| return require('Picker');
^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:76:20
Cannot resolve module `PickerIOS`.
76| return require('PickerIOS');
^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:79:20
Cannot resolve module `ProgressBarAndroid`.
79| return require('ProgressBarAndroid');
^^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:82:20
Cannot resolve module `ProgressViewIOS`.
82| return require('ProgressViewIOS');
^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:85:20
Cannot resolve module `SafeAreaView`.
85| return require('SafeAreaView');
^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:88:20
Cannot resolve module `ScrollView`.
88| return require('ScrollView');
^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:91:20
Cannot resolve module `SectionList`.
91| return require('SectionList');
^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:94:20
Cannot resolve module `SegmentedControlIOS`.
94| return require('SegmentedControlIOS');
^^^^^^^^^^^^^^^^^^^^^
Error ---------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:97:20
Cannot resolve module `Slider`.
97| return require('Slider');
^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:100:20
Cannot resolve module `SnapshotViewIOS`.
100| return require('SnapshotViewIOS');
^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:103:20
Cannot resolve module `Switch`.
103| return require('Switch');
^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:106:20
Cannot resolve module `RefreshControl`.
106| return require('RefreshControl');
^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:109:20
Cannot resolve module `StatusBar`.
109| return require('StatusBar');
^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:112:20
Cannot resolve module `SwipeableFlatList`.
112| return require('SwipeableFlatList');
^^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:115:20
Cannot resolve module `SwipeableListView`.
115| return require('SwipeableListView');
^^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:118:20
Cannot resolve module `TabBarIOS`.
118| return require('TabBarIOS');
^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:121:20
Cannot resolve module `Text`.
121| return require('Text');
^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:124:20
Cannot resolve module `TextInput`.
124| return require('TextInput');
^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:127:20
Cannot resolve module `ToastAndroid`.
127| return require('ToastAndroid');
^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:130:20
Cannot resolve module `ToolbarAndroid`.
130| return require('ToolbarAndroid');
^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:133:20
Cannot resolve module `Touchable`.
133| return require('Touchable');
^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:136:20
Cannot resolve module `TouchableHighlight`.
136| return require('TouchableHighlight');
^^^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:139:20
Cannot resolve module `TouchableNativeFeedback`.
139| return require('TouchableNativeFeedback');
^^^^^^^^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:142:20
Cannot resolve module `TouchableOpacity`.
142| return require('TouchableOpacity');
^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:145:20
Cannot resolve module `TouchableWithoutFeedback`.
145| return require('TouchableWithoutFeedback');
^^^^^^^^^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:148:20
Cannot resolve module `View`.
148| return require('View');
^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:151:20
Cannot resolve module `ViewPagerAndroid`.
151| return require('ViewPagerAndroid');
^^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:154:20
Cannot resolve module `VirtualizedList`.
154| return require('VirtualizedList');
^^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:157:20
Cannot resolve module `WebView`.
157| return require('WebView');
^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:162:20
Cannot resolve module `ActionSheetIOS`.
162| return require('ActionSheetIOS');
^^^^^^^^^^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:165:20
Cannot resolve module `Alert`.
165| return require('Alert');
^^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:168:20
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:121:20
Cannot resolve module `Text`.
121| return require('Text');
^^^^^^
Error --------------------------- node_modules/react-native/Libraries/react-native/react-native-implementation.js:124:20
Cannot resolve module `TextInput`.
124| return require('TextInput');
^^^^^^^^^^^
My .flowconfig:
[ignore]
<PROJECT_ROOT>/ios/.*
<PROJECT_ROOT>/android/.*
<PROJECT_ROOT>/build/.*
<PROJECT_ROOT>/config/.*
.*bower.json
.*/node_modules/.*/test/.*
.*/node_modules/editions/.*
.*/node_modules/react-native-firebase/.*
.*/node_modules/react-native-gesture-responder/.*
.*/node_modules/react-native-keyboard-aware-scroll-view/.*
; We fork some components by platform
.*/*[.]android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
; Ignore polyfills
.*/Libraries/polyfills/.*
; Ignore metro
.*/node_modules/metro/.*
[include]
[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/
node_modules/react-native/flow-github/
[options]
suppress_comment=\\(.\\|\n\\)*@FlowIgnore
module.ignore_non_literal_requires=true
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=./src
emoji=true
module.system=haste
module.system.haste.use_name_reducers=true
# keep the following in sync with server/haste/hasteImpl.js
# get basename
module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1'
# strip .js or .js.flow suffix
module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1'
# strip .ios suffix
module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1'
module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1'
module.system.haste.paths.blacklist=.*/__tests__/.*
module.system.haste.paths.blacklist=.*/__mocks__/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/Libraries/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/RNTester/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/IntegrationTests/.*
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/Animated/src/polyfills/.*
munge_underscores=true
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError
[version]
^0.74.0
I also tried with the .flowconfig
from master and no dice.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (2 by maintainers)
@EvHaus ignoring this leads to suppressing these errors, however after that Flow canβt resolve
react-native
module.Lucky You! π I had to specify the following in my
[untyped]
section:βflow-binβ: β0.90.0β, create-react-native-app version: 2.0.2
In addition to the above, I also had to add this to
[untyped]
:.*/node_modules/react-native/Libraries/react-native/react-native-implementation.js
Any solution? I am getting this on completely fresh installation with latest react-native
Iβm still having these issues even after upgrading to the latest
.flowconfig
as attached and the latest version ofreact-native
I had to add:
RN 0.56 / Flow 0.75 switched to needing to use
module.system.haste.name_reducers
(see this part) of the flowconfig. So an up to date flowconfig should solve these errors in most cases.But a further problem was this new option not being properly supported on Windows. A PR has just been merged which should fix this: https://github.com/facebook/flow/pull/7419 coming to the next Flow release.
@trubi Iβve added the following to my
.flowconfig
for now:The
[untyped]
option is not documented yet but there is an issue for it waiting for someone to add to docs. This comment explains how it differs from[ignore]
.Using htis flowconfig wound up fixing it: https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/_flowconfig