Surfacing Flow issues around invalid props

Reviewed By: yungsters

Differential Revision: D7977386

fbshipit-source-id: a6df2d75e0caa55a84f9c9c6860f622942955dfc
This commit is contained in:
Eli White 2018-05-12 10:25:05 -07:00 committed by Facebook Github Bot
parent 65c336f38f
commit 7ba7acdee7
5 changed files with 8 additions and 9 deletions

View File

@ -237,6 +237,7 @@ const ScrollView = createReactClass({
* - `false`, deprecated, use 'never' instead
* - `true`, deprecated, use 'always' instead
*/
// $FlowFixMe
keyboardShouldPersistTaps: PropTypes.oneOf([
'always',
'never',
@ -521,9 +522,11 @@ const ScrollView = createReactClass({
UNSAFE_componentWillMount: function() {
this._scrollAnimatedValue = new AnimatedImplementation.Value(
// $FlowFixMe
this.props.contentOffset ? this.props.contentOffset.y : 0,
);
this._scrollAnimatedValue.setOffset(
// $FlowFixMe
this.props.contentInset ? this.props.contentInset.top : 0,
);
this._stickyHeaderRefs = new Map();

View File

@ -146,7 +146,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
/>
);
}
_listRef: ListView;
_listRef: ?ListView;
_captureRef = ref => {
this._listRef = ref;
};

View File

@ -12,14 +12,12 @@
const PropTypes = require('prop-types');
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
const EdgeInsetsPropType = (createStrictShapeTypeChecker({
const EdgeInsetsPropType = PropTypes.shape({
top: PropTypes.number,
left: PropTypes.number,
bottom: PropTypes.number,
right: PropTypes.number,
}): ReactPropsCheckType & ReactPropsChainableTypeChecker);
});
export type EdgeInsetsProp = {|
+top: number,

View File

@ -12,9 +12,7 @@
const PropTypes = require('prop-types');
const createStrictShapeTypeChecker = require('createStrictShapeTypeChecker');
const PointPropType = createStrictShapeTypeChecker({
const PointPropType = PropTypes.shape({
x: PropTypes.number,
y: PropTypes.number,
});

View File

@ -80,7 +80,7 @@ exports.examples = [
title: string,
additionalStyles: typeof StyleSheet,
) {
let _scrollView: ScrollView;
let _scrollView: ?ScrollView;
return (
<View style={additionalStyles}>
<Text style={styles.text}>{title}</Text>