Skip to content

Commit

Permalink
Export NavigationContext and ScrollView in flow types (#6152)
Browse files Browse the repository at this point in the history
These two types are missing entirely from the flow definition, while they're incomplete they at least prevent flow from complaining that they're not defined at all.

I decided against copying the `ScrollView` types from `react-native` as they're really quite complex and likely to fall out-of-sync with the implementation in `react-native`. So instead I'd recommend overriding the types when  consuming using something like:

```js

import {ScrollView as NativeScrollView} from 'react-native';
import {ScrollView as NavigationScrollView} from 'react-navigation';

const ScrollView: React.ComponentType<typeof NativeScrollView>) = NavigationScrollView;
```
  • Loading branch information
levibuzolic authored and brentvatne committed Aug 9, 2019
1 parent 2b6ad6a commit c636f5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

- Add missing Flow type exports for `ScrollView` and `NavigationContext`

## [3.11.1]

## Fixes
Expand Down Expand Up @@ -245,7 +247,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Fix drawer accessibility label when drawer label is not a string


## [3.0.5] - [2018-12-03](https://github.com/react-navigation/react-navigation/releases/tag/3.0.5)

## Fixes
Expand All @@ -268,7 +269,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Accessibility labels on drawer items (https://github.com/react-navigation/react-navigation-drawer/pull/30)


## [3.0.3] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.3)

## Fixes
Expand Down
4 changes: 4 additions & 0 deletions flow/react-navigation.js
Expand Up @@ -1303,4 +1303,8 @@ declare module 'react-navigation' {
navigation: NavigationScreenProp<State>,
screenProps?: {}
): Options;

declare export var NavigationContext: React$Context<{}>;

declare export var ScrollView: React$ComponentType<{}>;
}

0 comments on commit c636f5a

Please sign in to comment.