New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strengthening Flow Types for Core Components #22100

Closed
TheSavior opened this Issue Nov 4, 2018 · 47 comments

Comments

@TheSavior
Copy link
Member

TheSavior commented Nov 4, 2018

We want to tighten the Flow types of the props for our core components. We need the help of the community to comb through these files and improve these types.

Right now a lot of props are typed using any, Function, or Object.

These types can cause flow to silently skip over portions of your code, which would have otherwise caused type errors.
- From eslint-plugin-flowtype

Many of these types are used to validate what we send to native. If JS defines a function that expects a string but Native calls it with a number, applications can crash.

We'd like to fix that by removing all references to any, Function, or Object. While we ideally want to remove all references of these files from the codebase, there are a lot, so we should prioritize the ones that are used in the props type definitions for components. 😄

If your are able to remove all of these weak types from the file, try to change @flow at the top of the file to @flow strict-local. That should ensure that weak types can't come back to these files in the future.

Step 1, Step 2, and Step 3 helped prepare our components for this step.

How to submit quality PRs

Since many of these weak types are used at the boundary between JS and native, you will likely need to read through the native code for these components to see how these props are being used. Unfortunately, Flow will likely pass with invalid types. Paying close attention to what iOS and Android expects will be helpful to ensure the types are accurate.

I also urge those that submit PRs for this to help out with reviewing the PRs for this issue from other contributors. Code review is a great opportunity to learn and improve your own code as well as make sure everyone is on the same page and consistent. If you find tips that would have helped you investigate and improve the types, commenting on this issue with those tips would be appreciated. Help each other. ❤️

Also note that since you are improving these types you will likely help catch a bunch of bugs at Facebook (and elsewhere) where code isn't handling the types correctly. This means that PRs will likely take longer to land then the other issues like this we have asked for help on. This is a good thing, it is direct impact on the stability of React Native projects and catching bugs.

The files

The following is a list of files that I'd like to address first. If you want to take one of these files please comment on this issue with the file name so that others don't work on it as well and waste work. There are plenty of files to go around. 😄

Also, TextProps.js and ViewPropTypes.js are probably the files with the most changes necessary. I don't really expect those to be done by one person. Feel free to type a few and send a PR. Once that PR is landed someone else can take it on and type a few more.

  • Libraries/Text/TextProps.js
  • Libraries/Components/CheckBox/CheckBox.android.js
  • Libraries/Components/DatePicker/DatePickerIOS.ios.js
  • Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js
  • Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js
  • Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
  • Libraries/Components/Keyboard/Keyboard.js
  • Libraries/Components/Picker/Picker.js
  • Libraries/Components/Picker/PickerAndroid.android.js
  • Libraries/Components/Picker/PickerIOS.ios.js
  • Libraries/Components/RefreshControl/RefreshControl.js
  • Libraries/Components/ScrollResponder.js
  • Libraries/Components/ScrollView/mocks/ScrollViewMock.js
  • Libraries/Components/ScrollView/ScrollView.js
  • Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js
  • Libraries/Components/Slider/Slider.js
  • Libraries/Components/StaticContainer.react.js
  • Libraries/Components/StatusBar/StatusBar.js
  • Libraries/Components/TextInput/TextInput.js
  • Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js
  • Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js
  • Libraries/Components/Touchable/TouchableBounce.js
  • Libraries/Components/Touchable/TouchableHighlight.js
  • Libraries/Components/Touchable/TouchableNativeFeedback.android.js
  • Libraries/Components/Touchable/TouchableOpacity.js
  • Libraries/Components/Touchable/TouchableWithoutFeedback.js
  • Libraries/Components/View/ViewPropTypes.js
  • Libraries/Components/ViewPager/ViewPagerAndroid.android.js
All the warnings for these files:
Libraries/Text/TextProps.js
    109:23  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
    110:22  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
    111:25  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
    112:27  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
    113:36  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
    114:32  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/CheckBox/CheckBox.android.js
  121:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/DatePicker/DatePickerIOS.ios.js
  27:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js
  18:29  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  68:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  68:47  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js
  14:23  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  14:40  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js
  155:32  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Keyboard/Keyboard.js
  124:58  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Picker/Picker.js
  35:11  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  66:19  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  73:31  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Picker/PickerAndroid.android.js
  37:19  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  40:31  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Picker/PickerIOS.ios.js
  30:15  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  37:11  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  65:31  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  66:18  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  76:12  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/RefreshControl/RefreshControl.js
  90:16  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/ScrollResponder.js
  116:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  412:49  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    
  537:17  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    

Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js
  15:19  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/ScrollView/InternalScrollViewType.js
  29:25  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  30:24  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  31:23  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  34:17  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/ScrollView/ScrollView.js
  224:20  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  407:28  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  411:26  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  417:15  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  421:24  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  426:22  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  436:26  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  595:35  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  609:34  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      
  613:33  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      
  738:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  765:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  774:39  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   

Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js
  36:20  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  37:15  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  45:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   

Libraries/Components/Slider/Slider.js
   27:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  121:20  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  128:24  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/StaticContainer.react.js
  30:47  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  31:36  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/StatusBar/StatusBar.js
  110:21  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  111:18  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  112:4   warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  127:34  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    
  127:40  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    

Libraries/Components/TextInput/TextInput.js
   58:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  187:13  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  188:14  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  189:15  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  190:19  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  191:26  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  192:18  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  193:19  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  194:24  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  195:22  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  196:17  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  197:15  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  795:22  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  900:32  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      

Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js
  55:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  55:47  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/TimePickerAndroid/TimePickerAndroid.ios.js
  14:23  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  14:40  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  
Libraries/Components/Touchable/TouchableBounce.js
   27:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
   39:28  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   40:31  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   98:17  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  150:37  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   

Libraries/Components/Touchable/TouchableHighlight.js
  42:27  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  52:21  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  53:21  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Touchable/TouchableNativeFeedback.android.js
  41:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Touchable/TouchableOpacity.js
  28:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  34:27  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/Touchable/TouchableWithoutFeedback.js
   45:32  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      
   47:13  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      
   48:7   warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort      
   61:13  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   62:14  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   63:15  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   64:18  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   65:14  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   66:16  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   67:17  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  180:57  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  209:37  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   

Libraries/Components/View/ViewPropTypes.js
   35:28  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   43:25  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   64:17  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   68:20  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   69:27  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   70:17  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   71:24  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   72:18  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   73:25  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   74:19  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   75:26  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
   93:31  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  104:38  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  115:23  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  125:22  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  136:24  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  146:25  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  148:23  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  149:21  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  162:27  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  173:36  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  183:32  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  194:39  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  198:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  199:30  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   

Libraries/Components/ViewPager/ViewPagerAndroid.android.js
  26:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort   
  50:19  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  60:31  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  68:21  warning  The `Function` type is too generic and could lead to hard to debug errors. Please use only as a last resort 

Libraries/Components/WebView/WebView.ios.js
   57:11  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    
   58:9   warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    
   59:16  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    
   62:14  warning  The `Object` type is too generic and could lead to hard to debug errors. Please use only as a last resort 
  659:26  warning  The `any` type is too generic and could lead to hard to debug errors. Please use only as a last resort    

@nd-02110114

This comment has been minimized.

Copy link
Contributor

nd-02110114 commented Nov 4, 2018

I'll take Libraries/Components/DatePicker/DatePickerIOS.ios.js

@exced

This comment has been minimized.

Copy link
Contributor

exced commented Nov 4, 2018

I'll start with Libraries/Components/ScrollView/__mocks__/ScrollViewMock.js

@TheSavior

This comment has been minimized.

Copy link
Member Author

TheSavior commented Nov 4, 2018

Silly bot.

@exced

This comment has been minimized.

Copy link
Contributor

exced commented Nov 4, 2018

I'll take Libraries/Components/RefreshControl/RefreshControl.js

@nd-02110114

This comment has been minimized.

Copy link
Contributor

nd-02110114 commented Nov 4, 2018

I'll take Libraries/Components/DatePicker/DatePickerAndroid.ios.js , Libraries/Components/DatePickerAndroid/DatePickerAndroid. android.js

@nd-02110114 nd-02110114 referenced this issue Nov 4, 2018

Closed

Turn Flow strict mode on for DatePickerIOS #22105

3 of 3 tasks complete
@empyrical

This comment has been minimized.

Copy link
Collaborator

empyrical commented Nov 4, 2018

If anyone needs help with figuring out the callback/return types of native components feel free to ask here, and we can help out! 👍

facebook-github-bot added a commit that referenced this issue Nov 4, 2018

Flow strict ScrollViewMock (#22103)
Summary:
Related to #22100

Turn Flow strict mode on for ScrollViewMock.
This file used to declare jest var as `any` but jest module is already typed in root flow folder.

Note: I had to use a quick fix for polyfillPromise. See here #22101

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [ScrollViewMock.js] - Flow strict mode
Pull Request resolved: #22103

Differential Revision: D12918380

Pulled By: TheSavior

fbshipit-source-id: cd3aba47b1a43e76a7da09e15cc2d9cfcdf7f56d
@nd-02110114

This comment has been minimized.

Copy link
Contributor

nd-02110114 commented Nov 4, 2018

I'll take Libraries/Components/Keyboard/Keyboard.js, Libraries/Components/Picker/Picker.js

@exced

This comment has been minimized.

Copy link
Contributor

exced commented Nov 4, 2018

@empyrical How would you type requireNativeComponent ?

@TheSavior

This comment has been minimized.

Copy link
Member Author

TheSavior commented Nov 4, 2018

Don’t worry about requireNativeComponent. We have another project internally working to remove that function and instead provide an accurate type.

@sopranolinist

This comment has been minimized.

Copy link

sopranolinist commented Nov 4, 2018

@TheSavior I don't see Object on line 121 or anywhere else in CheckBox.android.js. What I do see is any on line 81 but it's in reference to requireNativeComponent, which you said above we shouldn't worry about.

@TheSavior

This comment has been minimized.

Copy link
Member Author

TheSavior commented Nov 4, 2018

Whoops. Looks like another PR from @empyrical landed after I made that list which solved that line in Checkbox. Sorry for the churn. I'll mark that off the list.

@exced

This comment has been minimized.

Copy link
Contributor

exced commented Nov 4, 2018

I'll take Libraries/Components/StaticContainer.react.js

@cpojer

This comment has been minimized.

Copy link
Contributor

cpojer commented Jan 29, 2019

And we are done with the last PR by @danibonilha. Thanks everyone for helping out with this effort to make our flow types stricter!

@cpojer cpojer closed this Jan 29, 2019

🎁 Open Sourcing Internals automation moved this from In progress to Done Jan 29, 2019

matt-oakes pushed a commit to matt-oakes/react-native that referenced this issue Feb 7, 2019

Flow strict-local in TimePickerAndroid.android.ios.js (facebook#22714)
Summary:
Related to facebook#22100

Enhance TimePickerAndroid flow types.
Turn Flow strict mode on for Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.ios.js.

All flow tests succeed.

[General] [Changed] - Enhance Flow types definitions
Pull Request resolved: facebook#22714

Differential Revision: D13817142

Pulled By: cpojer

fbshipit-source-id: 9d0f0b0629966a60d77b73ba8a6bba4e1a4e2337

matt-oakes pushed a commit to matt-oakes/react-native that referenced this issue Feb 7, 2019

- create missing AndroidDrawable flow types in ViewPropTypes.js. (fac…
…ebook#23192)

Summary:
Related to facebook#22100

Enhance last ViewPropTypes flow types.

- [x] yarn run prettier
- [x] yarn run flow-check-ios
- [x] yarn run flow-check-android

[GENERAL] [ENHANCEMENT] [ViewPropTypes.js] - Enhance Flow types definitions
Pull Request resolved: facebook#23192

Differential Revision: D13858907

Pulled By: cpojer

fbshipit-source-id: 3633eb019eca2076bb68393b09d06555876f2c48

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict ScrollViewMock (facebook#22103)
Summary:
Related to facebook#22100

Turn Flow strict mode on for ScrollViewMock.
This file used to declare jest var as `any` but jest module is already typed in root flow folder.

Note: I had to use a quick fix for polyfillPromise. See here facebook#22101

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [ScrollViewMock.js] - Flow strict mode
Pull Request resolved: facebook#22103

Differential Revision: D12918380

Pulled By: TheSavior

fbshipit-source-id: cd3aba47b1a43e76a7da09e15cc2d9cfcdf7f56d

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Turn Flow strict mode on for DatePickerIOS (facebook#22105)
Summary:
Related to facebook#22100

Turn Flow strict mode on for DatePickerIOS.

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

This error was happend facebook#22101 facebook#22048

[GENERAL] [ENHANCEMENT] [Components/DatePicker/DatePickerIOS.ios.js] - Flow strict mode
Pull Request resolved: facebook#22105

Differential Revision: D12920939

Pulled By: TheSavior

fbshipit-source-id: aae5ca04d656abb1cf34168e12e44dd50f0a603c

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Turn Flow strict mode on for KeyBoard (facebook#22114)
Summary:
Related to facebook#22100

Turn Flow strict mode on for KeyBoard

- [x] npm run prettier
- [ ] npm run flow-check-ios
- [ ] npm run flow-check-android

This error was happend facebook#22101 facebook#22048

[GENERAL] [ENHANCEMENT] [Components/Keyboard/Keyboard.js] - Flow strict mode
Pull Request resolved: facebook#22114

Differential Revision: D12920947

Pulled By: TheSavior

fbshipit-source-id: 8d72019efd4d30032ce4784764e5deb9c60e7b01

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow type RefreshControl (facebook#22119)
Summary:
Related to facebook#22100

Enhance Flow types for RefreshControl specifying `onRefresh` props type.
There are still 2 `any` left using `requireNativeComponent` that need to be addressed to turn Flow to strict mode.

I went through `RCTRefreshControl` and `AndroidSwipeRefreshLayout` classes to understand where this method came from.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [RefreshControl.js] - Flow onRefresh type
Pull Request resolved: facebook#22119

Differential Revision: D12919764

Pulled By: TheSavior

fbshipit-source-id: 9ba675be8dbce77d77972acb904fc13c68524831

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict StaticContainer (facebook#22121)
Summary:
Related to facebook#22100

Turn on Flow strict mode for StaticContainer.react
This component needed proper Props type definition. I went through the only component (`TabBarItemIOS.ios`) using this to try to know the most appropriate props.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [StaticContainer.react.js] - Flow strict mode
Pull Request resolved: facebook#22121

Differential Revision: D12929646

Pulled By: TheSavior

fbshipit-source-id: 8826aa7bc83c854efdd71cdb4fba3d7ca98f2fce

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict DrawerLayout (facebook#22152)
Summary:
Issue in focus: facebook#22100

The only occurrence of `Object` was replaced with the appropriate flow type
A Lint error was encountered in `deepFreezeAndThrowOnMutationInDev-test.js` when running `npm run lint` and was fixed by running `yarn prettier`
Pull Request resolved: facebook#22152

Differential Revision: D12930872

Pulled By: RSNara

fbshipit-source-id: f9706ed2e49d9ccedfa331594c886d2d3b615db5

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict in ViewPagerAndroid.android.js (facebook#22134)
Summary:
Related to facebook#22100

Turn Flow strict mode on for Libraries/Components/ViewPager/ViewPagerAndroid.android.js

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android

[GENERAL] [ENHANCEMENT] [Libraries/Components/ViewPager/ViewPagerAndroid.android.js] - Flow strict mode
Pull Request resolved: facebook#22134

Differential Revision: D12930719

Pulled By: TheSavior

fbshipit-source-id: 9519f31b7af27f0497e42fd51f18c19be3692823

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict Slider (facebook#22127)
Summary:
Related to facebook#22100

Turn on Flow strict mode for Slider.
Enhanced event type and props callbacks type defs for Slider.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [Slider.js] - Flow strict mode
Pull Request resolved: facebook#22127

Differential Revision: D12946817

Pulled By: TheSavior

fbshipit-source-id: 631391f70c04fddf0bfa6fec92f5cb769a555547

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict TouchableOpacity (facebook#22146)
Summary:
Related to facebook#22100

Enhance Flow types for TouchableOpacity specifying Touchable event types and TvParallaxPropertiesType.
I had to export TvParallaxPropertiesType from TVViewPropTypes file.
There are still 1 any left using requireNativeComponent and a dependency to `Touchable` that need to be addressed to turn Flow to strict mode.

I guess `Touchable` is a lot more work since there's no flow annotation and it's still good old Mixin.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TouchableOpacity.js] - Flow types
[GENERAL] [ENHANCEMENT] [TVViewPropTypes.js] - Export type
Pull Request resolved: facebook#22146

Reviewed By: TheSavior

Differential Revision: D12927044

Pulled By: RSNara

fbshipit-source-id: c63d805699dd58e2fbc4fd1df4ee0c9f87e2336a

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict TouchableBounce (facebook#22197)
Summary:
Related to facebook#22100

Enhance TouchableBounce with press event types, callback and hitslop types.

There is still some work to do in order to turn flow to strict mode. (requireNativeComponent and render function)

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TouchableBounce.js] - Flow types
Pull Request resolved: facebook#22197

Reviewed By: TheSavior

Differential Revision: D13032452

Pulled By: RSNara

fbshipit-source-id: b21140722ce924698aa15323602e2e3fc663dbb6

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict TextProps (facebook#22122)
Summary:
Related to facebook#22100

Turn on Flow strict mode for TextProps.
I used ResponseHandlers type definition defined in Text.js.

I wanted to move ResponseHandlers type to TextProps and reuse it inside the file.
I know I could use $Shape<> to maybe keys but how do I elegantly maybe every values ?
Unless having a straightforward solution, I found it clearer to copy paste these types.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TextProps.js] - Flow strict mode
Pull Request resolved: facebook#22122

Reviewed By: TheSavior

Differential Revision: D13055759

Pulled By: RSNara

fbshipit-source-id: 230b43c7c94d7f82f5727ad11541b0cb98bc5e3a

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict TextInput (facebook#22250)
Summary:
Related to facebook#22100

Enhance TextInput with callback event types.
This is a first draft and I will need more help on this one. Flow checks are successful now but I am not sure types are accurate though.
Moreover I find my separation approach kind of dirty for callback event types.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TextInput.js] - Flow types
[GENERAL] [ENHANCEMENT] [TextInputExample.android.js] - Fixing Flow types
[GENERAL] [ENHANCEMENT] [TextInputExample.ios.js] - Fixing Flow types
[GENERAL] [ENHANCEMENT] [XHRExampleFetch.js] - Fixing Flow types
Pull Request resolved: facebook#22250

Reviewed By: TheSavior

Differential Revision: D13104820

Pulled By: RSNara

fbshipit-source-id: 3fbb98d0ec2b62be676f71ae1053933d9c78485e

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict TouchableHighlight (facebook#22173)
Summary:
Related to facebook#22100

Enhance Flow types for TouchableOpacity specifying underlay functions and TvParallaxPropertiesType.
I had to export and enhance TvParallaxPropertiesType from TVViewPropTypes file. This does not break this other PR also using this exported type. facebook#22146

There is still some work to do in order to turn flow to strict mode.

- All flow tests succeed.

[GENERAL] [ENHANCEMENT] [TouchableHighlight.js] - Flow types
[GENERAL] [ENHANCEMENT] [TVViewPropTypes.js] - Export and enhance type
Pull Request resolved: facebook#22173

Differential Revision: D13033441

Pulled By: RSNara

fbshipit-source-id: 26a38970923dc7e6c02c03da5d08483a3f1fbd36

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict ScrollResponder (facebook#22181)
Summary:
Related to facebook#22100

Enhance Flow types for Libraries/Components/ScrollResponder.js
Pull Request resolved: facebook#22181

Reviewed By: TheSavior

Differential Revision: D13032699

Pulled By: RSNara

fbshipit-source-id: ca0ce178a96008a71016d033ee1154ad807d6599

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict-local in TimePickerAndroid.android.js (facebook#22188)
Summary:
Related to facebook#22100 . I had this issue before(facebook#22154 & facebook#22172).

Turn Flow strict mode on for Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js.

- [x] npm run prettier
- [x] npm run flow
- [x] npm run flow-check-ios
- [x] npm run flow-check-android
- [x] npm run lint
- [x] npm run test
- [x] ./scripts/run-android-local-unit-tests.sh

[GENERAL][ENHANCEMENT][TimePickerAndroid.android.js] - apply flow strict-local
Pull Request resolved: facebook#22188

Reviewed By: TheSavior

Differential Revision: D12972356

Pulled By: RSNara

fbshipit-source-id: 838604a791dfdc86bacf8b49f6c399920a3f57bc

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict StatusBar (facebook#22282)
Summary:
Related to facebook#22100

`Libraries/Components/StatusBar/StatusBar.js`
Enhance StatusBar with mergePropsStack and _defaultProps.

- [x] npm run prettier
- [x] npm run flow
- [x] npm run flow-check-ios
- [x] npm run flow-check-android
- [x] npm run lint
- [x] npm run test
- [x] ./scripts/run-android-local-unit-tests.sh

[GENERAL][ENHANCEMENT][StatusBar.js] - apply flow strict-local
Pull Request resolved: facebook#22282

Reviewed By: TheSavior

Differential Revision: D13103971

Pulled By: RSNara

fbshipit-source-id: 27f69c6df3a8a7792fcd595c0ff362943ccab8ca

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow TouchableNativeFeedback.android.js (facebook#22176)
Summary:
Related to facebook#22100

Turn Flow strict mode on for Libraries/Components/Touchable/TouchableNativeFeedback.android.js.
Pull Request resolved: facebook#22176

Reviewed By: TheSavior

Differential Revision: D13033239

Pulled By: RSNara

fbshipit-source-id: 57e89ce16040e6238e01e0437327db943a5f2581

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict in Picker.js, PickerIOS.ios.js, PickerAndroid.android.js (f…
…acebook#22128)

Summary:
Related to facebook#22100

Turn Flow strict mode on for Picker

- [x] npm run prettier
- [x] npm run flow-check-ios
- [x] npm run flow-check-android
Pull Request resolved: facebook#22128

Differential Revision: D12946781

Pulled By: mmmulani

fbshipit-source-id: 4d3cb884dd8bf57a43ef8aec4491359e9874d182

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow TouchableWithoutFeedback (facebook#22479)
Summary:
Related to facebook#22100

Enhance TouchableWithoutFeedback with press and target event types.
There are still work to do to update `UNSAFE_componentWillReceiveProps` and `touchableGetHitSlop` to make Flow not complain about `DeprecatedEdgeInsetsPropType` inexact type.
Pull Request resolved: facebook#22479

Reviewed By: RSNara

Differential Revision: D13310764

Pulled By: TheSavior

fbshipit-source-id: 9002e542378491fb800c8e81c63f4fbe125b563c

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow ViewPropTypes (facebook#22504)
Summary:
Related to facebook#22100

Enhance ViewPropTypes flow types.
- I had some troubles with a TODO left for `onResponderGrant` hence the return type.
- I wasn't able to properly type `nativeBackgroundAndroid` and `nativeForegroundAndroid` at the moment.
Pull Request resolved: facebook#22504

Reviewed By: cpojer

Differential Revision: D13334024

Pulled By: TheSavior

fbshipit-source-id: cada236e0d716ae78cb663172e5315cf11c6406a

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict in DatePickerAndroid.android.js, DatePickerAndroid.ios.js (
…facebook#22106)

Summary:
Related to facebook#22100

Turn Flow strict mode on for DatePickerAndroid

- [x] npm run prettier
- [ ] npm run flow-check-ios
- [ ] npm run flow-check-android

This error was happend facebook#22101 facebook#22048

[GENERAL] [ENHANCEMENT] [Components/DatePickerAndroid/DatePickerAndroid.android.js] - Flow strict mode
[GENERAL] [ENHANCEMENT] [Components/DatePickerAndroid/DatePickerAndroid.ios.js] - Flow strict mode
Pull Request resolved: facebook#22106

Reviewed By: TheSavior

Differential Revision: D12919276

Pulled By: RSNara

fbshipit-source-id: 79672b2894435ca3c9988fefee3685700a8d8936

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

Flow strict-local in TimePickerAndroid.android.ios.js (facebook#22714)
Summary:
Related to facebook#22100

Enhance TimePickerAndroid flow types.
Turn Flow strict mode on for Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.ios.js.

All flow tests succeed.

[General] [Changed] - Enhance Flow types definitions
Pull Request resolved: facebook#22714

Differential Revision: D13817142

Pulled By: cpojer

fbshipit-source-id: 9d0f0b0629966a60d77b73ba8a6bba4e1a4e2337

JunielKatarn added a commit to JunielKatarn/react-native that referenced this issue Feb 11, 2019

- create missing AndroidDrawable flow types in ViewPropTypes.js. (fac…
…ebook#23192)

Summary:
Related to facebook#22100

Enhance last ViewPropTypes flow types.

- [x] yarn run prettier
- [x] yarn run flow-check-ios
- [x] yarn run flow-check-android

[GENERAL] [ENHANCEMENT] [ViewPropTypes.js] - Enhance Flow types definitions
Pull Request resolved: facebook#23192

Differential Revision: D13858907

Pulled By: cpojer

fbshipit-source-id: 3633eb019eca2076bb68393b09d06555876f2c48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment