Skip to content

Commit

Permalink
Define type signature for react-native-implementation
Browse files Browse the repository at this point in the history
Summary: Explicitly define the types of the getters in `react-native-implementation` so we can enable Flow's types-first mode for that file.

Reviewed By: cpojer

Differential Revision: D16937607

fbshipit-source-id: 2e4cf483043a53c5407254ffa2b3211d40211019
  • Loading branch information
rubennorte authored and facebook-github-bot committed Aug 22, 2019
1 parent bc4825e commit d2213c7
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 90 deletions.
3 changes: 3 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(si
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_ios\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

experimental.well_formed_exports=true
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
Expand Down
3 changes: 3 additions & 0 deletions .flowconfig.android
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(<VERSION>\\)? *\\(si
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(<VERSION>\\)? *\\(site=[a-z,_]*react_native\\(_android\\)?_\\(oss\\|fb\\)[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

experimental.well_formed_exports=true
experimental.well_formed_exports.whitelist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
Expand Down
5 changes: 2 additions & 3 deletions Libraries/Components/SafeAreaView/SafeAreaView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ const Platform = require('../../Utilities/Platform');
const React = require('react');
const View = require('../View/View');

import type {NativeComponent} from '../../Renderer/shims/ReactNative';
import type {ViewProps} from '../View/ViewPropTypes';

type Props = $ReadOnly<{|
...ViewProps,
emulateUnlessSupported?: boolean,
|}>;

let exported: Class<React$Component<Props>> | Class<NativeComponent<Props>>;
let exported: Class<React$Component<Props>>;

/**
* Renders nested content and automatically applies paddings reflect the portion
Expand Down Expand Up @@ -62,7 +61,7 @@ if (Platform.OS === 'android') {

const SafeAreaViewRef = React.forwardRef(SafeAreaView);
SafeAreaViewRef.displayName = 'SafeAreaView';
exported = ((SafeAreaViewRef: any): Class<NativeComponent<Props>>);
exported = ((SafeAreaViewRef: any): Class<React.Component<Props>>);
}

module.exports = exported;
Loading

0 comments on commit d2213c7

Please sign in to comment.