* Export getNavigationActionCreators
`react-navigation-redux-helpers` generally needs to duplicate whatever `createNavigationCreator` does. As of `react-navigation@2.0`, that includes using `getNavigationActionCreators` to construct the top-level `NavigationScreenProp`.
This PR isn't strictly needed, as it's possible to import from the file directly. But that's a brittle approach, and not particularly discoverable for anybody attempting to use a "non-stateful" navigator with their state management library of choice.
* Further refinements after writing the new helper
* Final refinement of NavigationScreenProp's relationship with _DefaultActionCreators
* Resolve merge conflicts
* [flow] Remove "any" type from NavigationComponent
"any" cripples the typechecker, so it's best to avoid. It was introduced in #3392, but I don't think the intention was to keep it there.
* [flow] Remove `any` type from `createNavigator` return
And use objects with spread sub-types instead of unions for `React$ComponentType` type param
* don’t use private global
* add missing method ‘getParam’ to navigation screen prop
* correct return type for ‘withNavigation’
* add usage of `getParam` method
Adds a new state persistence mechanisms to all of the navigators via createNavigationContainer
There are two new props that you can provide to a navigation container: `storageKey` and `renderLoading`.
`storageKey` is the string key to be used with AsyncStorage while saving and persisting navigation state. To disable persistence, set to null.
`renderLoading` allows you to render something while the navigator re-hydrates its state and loads its initial URL. By default this returns null, but Expo users will want to render a <AppLoading /> component for smooth app launches
There is also functionality in this PR to observe errors that come from re-hydrating state, and gracefully recover by dispatching an init action.
Also this revises the init action to *reset* the navigation state, rather than preserve the previous state.
* Added possibility to provide custom header back button's image, introduced API changes: removed old prop "headerBackImage", added new prop "backImage".
* Code style fixes.
* Renamed showcase file to for more clarity; updated the prop's name as well.
* Removed listeners code from showcase screens.
* Add dismiss action, made possible by getParentState
* Add dismiss to flow interface
* Don't dispatch an action on dismiss helper if no parent state
* carefullyGetParent instead of getParentState
1. Remove `NavigationComponent` from `NavigationScreenRouteConfig`. The only context `NavigationScreenRouteConfig` is used in is as an intersection with an object, and as such the only relevant portions of `NavigationScreenRouteConfig` are the object parts.
2. Add static `HEIGHT` variable to `Header` type.
3. In `NavigationContainerProps`, make `onNavigationStateChange` property value nullable.
PS: if in the future you guys would prefer that I separate these sort of PRs into their constituent parts, let me know.
* Add activeLabelStyle and inactiveLabelStyle
Adding activeLabelStyle, so that active items can be customized more.
My use case: Change font of the active item to bold.
Also, added inactiveLabelStyle which can be used for a similar purpose.
* prettier fix
* Update react-navigation.js
* prettier fix
* Update jest snapshot for DrawerNavigator - for adding a new style property to the styles array
Should be nullable, since it is initially called as `null` in `src/createNavigationContainer.js` (and in `react-navigation-redux-helpers`, where it is causing a Flow error)
* use initialRouteName as key when initializing StackRouter
* fix null headerLeft
* merge back
* fixed tests
* use config flag
* fixed snapshots
* implemented requested changes
* Lazy initialization of tabs and move contents off-screen when not active
* Make subview clipping and lazy both configurable
* Record snapshots again
* Update type definition
* Remove unused log
* Add Flow libdef
* Move libdef to flow folder in root
* Update libdef with some refinements discovered while writing test
Mostly refining navigator config types. In the past when we tried it we got in-repo Flow errors. With a libdef we can now assert it as true!
* Get rid of all imports in libdef and refine some types
* 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 d71ed75133b97e33a8a683eda334b3005107d379. @skevy reintroduced the mistyped function in 9436d03fe8fface09001a5a40ce0aa8a01ad9e7e, 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