Skip to content

Commit

Permalink
Remove flow (react-navigation#3350)
Browse files Browse the repository at this point in the history
* Remove flow types from src

* Finish removing Flow

* Clear out flow-typed, some flow mentions in docs, website flow usage, and some other config
  • Loading branch information
brentvatne authored and ericvicenti committed Jan 25, 2018
1 parent 276249c commit ecfa38b
Show file tree
Hide file tree
Showing 119 changed files with 1,969 additions and 15,863 deletions.
25 changes: 9 additions & 16 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,26 @@
"env": {
// For RN example development
"development": {
"presets": ["react-native"],
"plugins": [
"transform-flow-strip-types"
]
"presets": ["react-native"]
},
// For Jest
"test": {
"presets": ["react-native"],
"plugins": [
"transform-flow-strip-types"
]
"presets": ["react-native"]
},
// For publishing to NPM for RN
"publish-rn": {
"presets": ["react-native-syntax"],
"plugins": [
"transform-flow-strip-types"
]
"presets": ["react-native-syntax"]
},
// For publishing to NPM for web
"publish-web": {
"presets": ["es2015", "stage-1", "react"],
"plugins": [
"transform-flow-strip-types",
["transform-define", {
"__DEV__": false
}]
[
"transform-define",
{
"__DEV__": false
}
]
]
}
}
Expand Down
2 changes: 0 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
coverage
flow-typed
flow
node_modules
lib*
build
Expand Down
23 changes: 0 additions & 23 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
{
"extends": [
"plugin:flowtype/recommended",
"plugin:react/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"prettier",
"prettier/flowtype",
"prettier/react"
],
"parser": "babel-eslint",
"plugins": [
"react",
"flowtype",
"prettier"
],
"env": {
Expand Down Expand Up @@ -46,28 +43,8 @@
"react/prop-types": "off",
"react/require-default-props": "off",
"react/no-unused-prop-types": "off",

"flowtype/boolean-style": [
"error",
"boolean"
],
"flowtype/no-weak-types": "off",
"flowtype/require-parameter-type": "off",
"flowtype/require-return-type": [
"off",
"always",
{
"annotateUndefined": "never"
}
],
"flowtype/require-valid-file-annotation": "error",
"flowtype/use-flow-type": "warn",
"flowtype/valid-syntax": "warn"
},
"settings": {
"flowtype": {
"onlyFilesWithFlowAnnotation": true
}
},
"parserOptions": {
"ecmaVersion": 6,
Expand Down
64 changes: 0 additions & 64 deletions .flowconfig

This file was deleted.

2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Demonstrate the code is solid. Example: The exact commands you ran and their out

Make sure you test on both platforms if your change affects both platforms.

The code must pass tests and shouldn't add more Flow errors.
The code must pass tests.

**Code formatting**

Expand Down
6 changes: 2 additions & 4 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,10 @@ yarn install

### Code Review Guidelines

Look around. Match the style of the reset of the codebase. This project uses ESLint and Flow to ensure consistency throughout the project. You can check your project by running
Look around. Match the style of the reset of the codebase. This project uses ESLint to ensure consistency throughout the project. You can check your project by running

```bash
yarn run eslint
yarn run flow-check
```

If any errors occur you'll either have to manually fix them or you can attempt to automatically fix them by running `yarn run format`.
Expand Down Expand Up @@ -173,11 +172,10 @@ If you've made any changes to the `docs` directory you'll need to run `yarn run

### Run Tests and Type-Checking

React Navigation has tests implemented in [Jest](https://facebook.github.io/jest/) and type-checking is managed by [Flow](https://flow.org/). To run either of these, from the React Navigation directory, run either of the following commands (after installing the `node_modules`) to run tests or type-checking.
React Navigation has tests implemented in [Jest](https://facebook.github.io/jest/). To run either of these, from the React Navigation directory, run either of the following commands (after installing the `node_modules`) to run tests or type-checking.

```bash
yarn run jest
yarn run flow-check
```

These commands will be run by our CI and are required to pass before any contributtions are merged.
34 changes: 0 additions & 34 deletions docs/api/views/Transitioner.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ _configureTransition(transitionProps, prevTransitionProps) {
}
```
#### Flow definition
```js
configureTransition: (
transitionProps: NavigationTransitionProps,
prevTransitionProps: ?NavigationTransitionProps,
) => NavigationTransitionSpec,
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current navigation state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous navigation state and props
Expand All @@ -91,16 +82,6 @@ An object with `state` that represents the navigation state, with `routes` and a
}
```
#### Flow definition
```js
export type NavigationState = {
index: number,
routes: Array<NavigationRoute>,
};
```
For more information about the `NavigationRoute` type, check out its [flow definition](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L32).
### `render` function
Invoked from `Transitioner.render()`. This function performs the actual rendering delegated from `Transitioner`. In this function, we can use the information included in the `transitionProps` and `prevTransitionProps` parameters to render scenes, create animations and handle gestures.
Expand All @@ -110,8 +91,6 @@ There are a few important properties of the `transitionProps` and `prevTransitio
- `position: NavigationAnimatedValue` - the progressive index of the transitioner's navigation state
- `progress: NavigationAnimatedValue` - the value that represents the progress of the transition when navigation state changes from one to another. Its numeric value will range from 0 to 1.
For the complete list of properties of `NavigationTransitionProps`, check out its [flow definition](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273).
#### Examples
`transitionProps.scenes` is the list of all available scenes. It is up to the implementor to determine how to lay them out on the screen. For example, we can render the scenes as a stack of cards like so:
Expand Down Expand Up @@ -151,11 +130,6 @@ The above code creates a cross fade animation during transition.
For a comprehensive tutorial on how to create custom transitions, see this [blog post](http://www.reactnativediary.com/2016/12/20/navigation-experimental-custom-transition-1.html).
#### Flow definition
```js
render: (transitionProps: NavigationTransitionProps, prevTransitionProps: ?NavigationTransitionProps) => React.Node,
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous state and props
Expand All @@ -168,10 +142,6 @@ Invoked when the transition animation is about to start.
If you return a promise from `onTransitionStart`, the transition animation will begin after the promise is resolved.
#### Flow definition
```js
onTransitionStart: (transitionProps: NavigationTransitionProps, prevTransitionProps: ?NavigationTransitionProps) => (Promise | void),
```
#### Parameters
- `transitionProps`: the current [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the current state and props
- `prevTransitionProps`: the previous [NavigationTransitionProps](https://github.com/react-community/react-navigation/blob/master/src/TypeDefinition.js#L273) created from the previous state and props
Expand All @@ -184,10 +154,6 @@ Invoked once the transition animation completes.
If you return a promise from `onTransitionEnd`, any queued transition animations will begin after the promise is resolved.
#### Flow definition
```js
onTransitionEnd: () => void
```
#### Parameters
- none.
Expand Down
108 changes: 0 additions & 108 deletions flow-typed/npm/babel-cli_vx.x.x.js

This file was deleted.

Loading

0 comments on commit ecfa38b

Please sign in to comment.