Skip to content

Commit

Permalink
Fix typing for ProgressBarAndroid
Browse files Browse the repository at this point in the history
Summary: `ProgressBarAndroid` exported the wrong type and Flow wasn't catching some issues with it because they were hidden by a `$FlowFixMe` annotation. This exports the right type and fixes the bad usages.

Differential Revision: D16938853

fbshipit-source-id: 7ea4bbf379a010a76dc68ccb405e1f890d7e590a
  • Loading branch information
rubennorte authored and facebook-github-bot committed Aug 22, 2019
1 parent 17381f1 commit bc4825e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
// $FlowFixMe Flow doesn't know when this is the android component
<PlatformActivityIndicator {...nativeProps} {...androidProps} />
) : (
// $FlowFixMe Flow doesn't know when this is the iOS component
<PlatformActivityIndicator {...nativeProps} />
)}
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ ProgressBarAndroidToExport.defaultProps = {
/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
* error found when Flow v0.89 was deployed. To see the error, delete this
* comment and run Flow. */
module.exports = (ProgressBarAndroidToExport: ProgressBarAndroidNativeComponent);
module.exports = (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ const render = require('../../../../jest/renderer');
describe('<ProgressBarAndroid />', () => {
it('should render as <ProgressBarAndroid> when mocked', () => {
const instance = render.create(
<ProgressBarAndroid styleAttr="Horizontal" />,
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
expect(instance).toMatchSnapshot();
});

it('should shallow render as <ForwardRef(ProgressBarAndroid)> when mocked', () => {
const output = render.shallow(
<ProgressBarAndroid styleAttr="Horizontal" />,
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
expect(output).toMatchSnapshot();
});
Expand All @@ -38,7 +38,7 @@ describe('<ProgressBarAndroid />', () => {
jest.dontMock('../ProgressBarAndroid');

const output = render.shallow(
<ProgressBarAndroid styleAttr="Horizontal" />,
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
expect(output).toMatchSnapshot();
});
Expand All @@ -47,7 +47,7 @@ describe('<ProgressBarAndroid />', () => {
jest.dontMock('../ProgressBarAndroid');

const instance = render.create(
<ProgressBarAndroid styleAttr="Horizontal" />,
<ProgressBarAndroid styleAttr="Horizontal" indeterminate={true} />,
);
expect(instance).toMatchSnapshot();
});
Expand Down

0 comments on commit bc4825e

Please sign in to comment.