From bc4825ee9d49d7c8044bd08ec3ca49050435e17c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Wed, 21 Aug 2019 19:00:41 -0700 Subject: [PATCH] Fix typing for ProgressBarAndroid 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 --- .../Components/ActivityIndicator/ActivityIndicator.js | 1 + .../ProgressBarAndroid/ProgressBarAndroid.android.js | 2 +- .../__tests__/ProgressBarAndroid-test.js | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index df6cd3c5cc1..2eed90d8de1 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -109,6 +109,7 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => { // $FlowFixMe Flow doesn't know when this is the android component ) : ( + // $FlowFixMe Flow doesn't know when this is the iOS component )} diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index 7f80aeb3392..cb1d0dbc065 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -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); diff --git a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js index ccce645eb49..c2463d96d44 100644 --- a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js +++ b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js @@ -22,14 +22,14 @@ const render = require('../../../../jest/renderer'); describe('', () => { it('should render as when mocked', () => { const instance = render.create( - , + , ); expect(instance).toMatchSnapshot(); }); it('should shallow render as when mocked', () => { const output = render.shallow( - , + , ); expect(output).toMatchSnapshot(); }); @@ -38,7 +38,7 @@ describe('', () => { jest.dontMock('../ProgressBarAndroid'); const output = render.shallow( - , + , ); expect(output).toMatchSnapshot(); }); @@ -47,7 +47,7 @@ describe('', () => { jest.dontMock('../ProgressBarAndroid'); const instance = render.create( - , + , ); expect(instance).toMatchSnapshot(); });