Fix Flow types (and update RN version) (#2619)

* Fix .flowconfig to stop ignoring modules and properly include React Native libraries

Currently, there are numerous ignored libraries that are hiding type errors. Actually, they're causing type errors too. This sort of thing only patches over actual problems, so we have to revert them to get a config we can build upon.

* Update react-native/flow-bin dependencies

We want to have Flow types working with the latest packages.

* Update flow-typed libraries (auto-generated)

* Fix typing of navigation prop used by withNavigation HOC

The current typing is clearly a typo, as it is circular. `NavigationScreenProp` should be used to type the navigation prop

* Fix typing of easing function

What's funny is that I fixed this before in d71ed75133. @skevy reintroduced the mistyped function in 9436d03fe8, which didn't trigger any Flow errors because .flowconfig was ignoring the entire react-native package

* Correct typing of View and Text style prop

The current code thinks it can import these, but this isn't true, and was being hidden because the .flowconfig ignored the whole react-native package. There's no easy to type Text and View at the current moment, as far as I can tell. Importing the highly generic `StyleObj` seems like the best bet, and is what I have being using in my projects.

* Import NavigationScreenComponent using full path

* Updating yarn.lock files

* Get rid of library overrides in flow-typed/react-native.js and flow/react-navigation.js

* Add @flow to src/react-navigation.js and make last three params to createNavigator optional

* Make screenProps and navigationOptions optional in NavigationNavigatorProps

* yarn run format

* Readd react-navigation/node_modules ignore to NavigationPlayground's .flowconfig

Realized this line I removed in the first commit is necessary when using npm link/yarn link, which is what the CircleCI build does

* Make all DrawerViewConfig's params optional

Some of these params are marked as optional because they have defaults. However, the only place `DrawerViewConfig` is used is as the input the function that then applies the defaults

* Make all props in NavigationNavigatorProps optional

`NavigationNavigatorProps` is used to type the props of the component that is output by the `StackNavigator`, `TabNavigator`, etc. component factories. This component does not need to have any props specified.

* Make second param to `DrawerNavigator` factory optional

`DrawerNavigator`, just like `TabNavigator` and `StackNavigator`, can be called with just a single argument (ie. omitting the config)

* Upgrade to RN 0.48.4 to address https://github.com/facebook/react-native/issues/15810
This commit is contained in:
Ashoat Tevosyan
2017-09-25 12:29:34 -04:00
committed by Matt Hamil
parent 17c910fb5d
commit b759d3136e
72 changed files with 11362 additions and 8299 deletions

View File

@@ -1,39 +0,0 @@
/**
* React Navigation Flow library defintion
*/
declare module 'react-navigation' {
declare var createNavigationContainer: any;
declare var StateUtils: any;
declare var addNavigationHelpers: any;
declare var NavigationActions: any;
declare var createNavigator: any;
declare var StackNavigator: any;
declare var TabNavigator: any;
declare var DrawerNavigator: any;
declare var StackRouter: any;
declare var TabRouter: any;
declare var Transitioner: any;
declare var CardStackTransitioner: any;
declare var CardStack: any;
declare var Card: any;
declare var Header: any;
declare var HeaderTitle: any;
declare var HeaderBackButton: any;
declare var DrawerView: any;
declare var DrawerItems: any;
declare var TabView: any;
declare var TabBarTop: any;
declare var TabBarBottom: any;
declare var withNavigation: any;
}