Skip to content

Commit

Permalink
Add flow config
Browse files Browse the repository at this point in the history
  • Loading branch information
FonDorn committed Mar 2, 2019
1 parent 2fc8d7f commit cfa15a1
Show file tree
Hide file tree
Showing 5 changed files with 4,402 additions and 16 deletions.
74 changes: 74 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[ignore]
; We fork some components by platform
.*/node_modules/react-native/.*/*[.]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]
emoji=true

esproposal.optional_chaining=enable
esproposal.nullish_coalescing=enable

module.system=haste
module.system.haste.use_name_reducers=true
# 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>/node_modules/react-native/Libraries/Animated/src/polyfills/.*
module.system.haste.paths.whitelist=<PROJECT_ROOT>/node_modules/react-native/Libraries/.*

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'
# Support the library import in examples
module.name_mapper='^\@react-native-community/viewpager$' -> '<PROJECT_ROOT>/js/index.js'

module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
module.file_ext=.native.js
module.file_ext=.android.js
module.file_ext=.ios.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.86.0
15 changes: 3 additions & 12 deletions js/MaskedView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@
*/

import React from 'react';
import { View, ViewPropTypes, StyleSheet, requireNativeComponent } from 'react-native';
import { View, StyleSheet, requireNativeComponent } from 'react-native';

const RNCMaskedView = requireNativeComponent('RNCMaskedView');

type Props = $ReadOnly<{|
...ViewPropTypes,

children: React.Node,
/**
* Should be a React element to be rendered and applied as the
* mask for the child element.
*/
maskElement: React.Element<any>,
|}>;
import { MaskedViewProps } from './MaskedViewTypes';

/**
* Renders the child view with a mask specified in the `maskElement` prop.
Expand Down Expand Up @@ -61,7 +52,7 @@ type Props = $ReadOnly<{|
* transparent pixels block that content.
*
*/
class MaskedViewIOS extends React.Component<Props> {
class MaskedViewIOS extends React.Component<MaskedViewProps> {
_hasWarnedInvalidRenderMask = false;

render() {
Expand Down
13 changes: 13 additions & 0 deletions js/MaskedViewTypes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { ViewPropTypes } from 'react-native';

export type MaskedViewProps = $ReadOnly<{|
...ViewPropTypes.ViewProps,

children: React.Node,
/**
* Should be a React element to be rendered and applied as the
* mask for the child element.
*/
maskElement: React.Element<any>,
|}>;
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,23 @@
"masked view"
],
"scripts": {
"test:flow": "flow check"
},
"peerDependencies": {
"react": "^16.0",
"react-native": "^0.57"
},
"dependencies": {
},
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.2.2",
"react-native": ">=0.57 <0.59"
"react-native": ">=0.57 <0.59",
"flow-bin": "^0.86.0"
},
"repository": {
"type": "git",
"url": "https://github.com/react-native-community/react-native-masked-view.git"
"url": "git+https://github.com/react-native-community/react-native-masked-view.git"
},
"bugs": {
"url": "https://github.com/react-native-community/react-native-masked-view/issues"
}
}

0 comments on commit cfa15a1

Please sign in to comment.