mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-25 01:28:16 +00:00
10 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
|
f895564605
|
Revert "Move examples to https://github.com/react-navigation/examples"
This reverts commit 36775007b0de67b2cd2e4889554372b32b09fd03. |
||
|
36775007b0 | Move examples to https://github.com/react-navigation/examples | ||
|
3cff180224 |
Update to react-native@0.50 and flow-bin@0.56 (#2998)
* Update to React Native 0.50 * Type Promise used in PlatformHelpers.web.js * Move $FlowFixMe in CardStack.js The line number Flow is using for this error changed. The underlying problem has not, but I don't have time to fix it now unfortunately. * Type TouchableItem's children prop as React.Node This was my bad. `React.ChildrenArray` should only really be used in the case of having multiple of the same type of child. * Type HeaderTitle's children prop as React.Node Same as last commit. * Add assertion in StackRouter that StateUtils.indexOf returns valid index Flow doesn't realize that `StateUtils.indexOf` is guaranteed to return a valid index, so we use `invariant` to assert it. * Remove unused type DrawerNavigationState from TypeDefinition * Remove unused type parameter T in DrawerView * Type NavigationStateRoute as NavigationLeafRoute & NavigationState * Don't constrain generic action types to NavigationAction By constraining to subtypes of `NavigationAction`, we actually are requiring that any router satisfying our type constraints has to take all of the `NavigationAction` types. Instead, we want to say that it will only take some of them. Changing the types here to be inferred. * Fix types of NavigationScreenProp and withCachedChildNavigation 1. `NavigationScreenProp` needs to have its type parameter annotated with a `+` to actually indicate covariance on that type parameter, apparently 2. `withCachedChildNavigation` needs to thread through more-specific `NavigationState`s, and right now it just discards that specificity, which breaks `DrawerSidebar` because it needs a `NavigationStateRoute` * Ignore website/build from Flow * Fix type of DrawerItems activeItemKey prop - Even when specified, it can be `null` - Use a ternary expression instead of `x && x.param` approach * Get rid of NavigationRouter & NavigationNavigator parameterization on NavigationAction Since `NavigationRouter`'s `getStateForAction` functionality is a standard Redux reducer, it knows to forward on any actions it doesn't know how to deal with. We can widen the types of these functions to be `NavigationAction` without any negative consequence. * Explicitly specify null navigationOptions in createNavigator Not sure why, but Flow doesn't like us leaving it unspecified * Fix createNavigationContainer/createNavigator/StackNavigator types * Fix up flow types for TabNavigator and DrawerNavigator * Properly type defaultContentComponent * Fix more flow errors in createNavigationContainer * Replace NavigatorProps with NavigationNavigatorProps * Type SceneView's navigation prop as NavigationScreenProp<any> There is an unavoidable* type problem here. A `NavigationComponent` is either a navigator with a `NavigationStateRoute` or a scene with a `NavigationRoute`. The navigation prop it gets passed must match the component's `NavigationState`. However, there's no way for us to say that "`this.props.router.getComponentForRouteName` will have a `NavigationNavigator` iff the corresponding `childNavigationProps` is a `NavigationStateRoute`". The cleanest way to make this work is to throw an "any" specifically for the navigation prop's state type param. * We could probably avoid it with sufficient refactoring. If the routers were charged with keeping track of `childNavigationProps` instead of leaving it to the views, they could return the child navigation prop and child `NavigationComponent` in pairs whose types were coupled. * Pass in screenProps to NavigationComponent in NavigationPlayground's CustomTabs Flow wants `screenProps` to be passed in here for some reason... It cites `SceneView`, but that doesn't really make much sense to me. But this is some custom logic that most people aren't likely to run into, so I'm not gonna worry too much about it. * Patch mismatch with react-native-tab-view type for now * Use generic NavigationState in createNavigationContainer's _nav var We made the NavigationState generic while #1313 added a new instance variable. This updates the new instance variable to be generic. * Fix failing tests |
||
|
d1c434b54c |
Update to react-native@0.49 and flow-bin@0.53 (#2845)
* Update root package to react-native@0.49 and flow-bin@0.53
* Update NavigationPlayground package to react-native@0.49 and flow-bin@0.53
* Update ReduxExample package to react-native@0.49 and flow-bin@0.53
* flow-typed update (code-gen)
* Find-and-replace old types with new types
- `React.Element<*>` as the result of a render function is now `React.Node`
- `ReactClass<T>` as the type of a Component is now `React.ComponentType<typeof T>`
- `extends React.Component<DP, P, S>` is now `extends React.Component<P, S>`
- `React.Children<*>` as the type of a children prop is now `React.ChildrenArray<*>`
- Refs are now typed with `React.Ref`
There are also several tiny typo fixes in here.
* Avoid assuming state is NavigationRoute in addNavigationHelpers
For the root, top-level Navigator, the state is a simple `NavigationState` (with no route info) and we still use `addNavigationHelpers` for it. We can't assume `navigation.state.key` is accessible for this type, so we need to do runtime checks here.
* Fix type of NavigationScreenConfig
`navigationOptions` was incorrectly typed
* Give createNavigationContainer's State a type parameter
We want to be able to specifically type this guy so we can use specific NavigationState for things like the Drawer views without having to do runtime assertions about the state type
* Fix typing of NavigationAction
First of all, `NavigationAction` was being used as two different types, so I had to create the new `PossiblyDeprecatedNavigationAction` and add it as a type parameter everywhere. Second of all, generics and implied types were being used far more than they need to be, and they're hard to work with because Flow doesn't really explain things well when they go wrong.
* Make sure children scenes of CardStack have NavigationProp typed with NavigationRoute
CardStack's `NavigationScreenProp` is typed with `NavigationState`, but the children need `NavigationRoute`. Flow gets confused by the spread operator, even if the individual property is replaced later, so we need to explicitly list each property individually (just `dispatch`, actually).
* Allow prevTransitionProps parameter to be nullable
* Allow prevTransitionProps parameter to be nullable
* Narrow down a couple type parameters
* Move NavigationStateRoute cast to within Component.router check in createConfigGetter
* Update withCachedChildNavigation so it's typed correctly with React.ComponentType
* Add a $FlowFixMe for displayName
`React.StatelessFunctionalComponent` is missing `displayName` before Flow 0.54.0
See
|
||
|
b759d3136e |
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 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 |
||
|
19babadf38 |
Fix the NavigationPlayground example! (#2170)
* [Playground] Commit auto-changes to package.json, yarn.lock * [Playground] Rerun create-react-native-app Preserving rn-cli.js and transformer.js Still not quite working. * [Playground] Fix the Expo loading issue by removing projectRoots Now it looks in the right place to find its resources, including 'entryPoint'. * [Playground] Add postinstall script to clean up files Yarn copies in Yarn copies them when installing locally, causing lots of @providesModule collisions. * Update the Contributors guide to explain how to use the example app And recommend Yarn by default * [Playground] Remove now-obsolete rn-cli.config.js * [Playground] Upgrade expo and other dependencies * [Playground] Don't delete .git just in case |
||
|
ebf1e2e893
|
Update NavigationPlayground to 0.45.1, add stub react-nav flow definition | ||
|
1cd16bcf4a
|
Convert NavigationPlayground project to a CRNA project | ||
|
93976d358e |
Introducing flat options (#984)
* Initial commit * Remove HybridExample (#985) * Remove HybridExample * Remove last mention of HelloHybrid * Remove console log * Fix flow and example * Fix routers api docs * Keep options in single place * chore * Fix styling * Organise miscs * Better flow type for screen options * Flow test website and add more types to options * navigationOptions instead of prevOptions makes more sense * Fixes * Fix up docs * Fix * Update route decl * Provide error when removed API is used * Remove lock * Add validators * Make StacksOverTabs config valid again * Do not return * Fix redbox |
||
|
c37ad8a0a9 | Initial public release of React Navigation |