Closed
Description
Description
it looks like there are lots of nice flow typing already inlined for many react native apis/components. but my flow typechecker is not able to access them in my project.
I'm guessing Flow is not able to leverage the existing types in the source, possibly due to this file using getters (flow cant resolve types from getters?) :
Reproduction Steps and Sample Code
Here's an example that isn't working:
// @flow
import { StatusBar } from 'react-native';
const fn = () => {
StatusBar.setBarStyle('this-is-not-in-enum');
};
The call to StatusBar.setBarStyle should generate a flow error based on the flow types in the react-native source code. You can see that code in https://github.com/facebook/react-native/blob/0.42-stable/Libraries/Components/StatusBar/StatusBar.js#L201
My .flowconfig:
[ignore]
; We fork some components by platform
.*/*[.]android.js
; Ignore templates for 'react-native init'
.*/local-cli/templates/.*
; Ignore the website subdir
<PROJECT_ROOT>/website/.*
; 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
.*/Libraries/react-native/ReactNative.js
[include]
[libs]
Libraries/react-native/react-native-interface.js
flow/
[options]
emoji=true
module.system=haste
experimental.strict_type_args=true
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'
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(3[0-8]\\|[1-2][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(3[0-8]\\|1[0-9]\\|[1-2][0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native_oss[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
unsafe.enable_getters_and_setters=true
[version]
^0.38.0
Additional Information
- React Native version: 0.42.3
- Platform: n/a
- Development Operating System: osx
- Dev tools: flow 0.38.0
p.s. SO issue here: http://stackoverflow.com/questions/43126131/how-to-use-react-native-flow-types