mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-27 09:08:37 +08:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b176d3581 | ||
|
|
475c390fea | ||
|
|
ef83e73a95 | ||
|
|
ccb1f612d8 | ||
|
|
2931badefc | ||
|
|
e31d63a6f4 | ||
|
|
43cc9a6874 | ||
|
|
9a3eb3a6ac | ||
|
|
683892e8ab | ||
|
|
4278291650 | ||
|
|
19470a1e02 | ||
|
|
5b60a2ee03 | ||
|
|
ace2cd0c6c | ||
|
|
f2d16abf75 | ||
|
|
2e34cb1e38 | ||
|
|
188bd33442 | ||
|
|
94d6ccada4 | ||
|
|
246f4b0e15 | ||
|
|
c828050ba1 | ||
|
|
5eaec68860 | ||
|
|
6142f06bbd | ||
|
|
d342812102 | ||
|
|
5c13cea6c9 | ||
|
|
2433071930 | ||
|
|
dd03234e2d | ||
|
|
3bd15d3f8b | ||
|
|
2b27bcd134 | ||
|
|
3aee211c73 | ||
|
|
531686ea8e | ||
|
|
951afa5fb1 | ||
|
|
61e71ee09f | ||
|
|
d9e1a5ee25 | ||
|
|
e3d2ce12c3 | ||
|
|
d1ec360902 | ||
|
|
8c5eba700d | ||
|
|
d6232860c5 | ||
|
|
e7028ce75a | ||
|
|
523cf17f8e | ||
|
|
11458a9f73 | ||
|
|
2744c53843 | ||
|
|
4e7f9f07ee | ||
|
|
97016c4498 | ||
|
|
b83c4bb379 | ||
|
|
136db984ee | ||
|
|
de6921061e |
@@ -1,5 +1,4 @@
|
||||
coverage/
|
||||
flow/
|
||||
node_modules/
|
||||
lib/
|
||||
build/
|
||||
|
||||
39
.github/ISSUE_TEMPLATE.md
vendored
39
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,39 +0,0 @@
|
||||
## The issue tracker is reserved for bug reports only.
|
||||
|
||||
If you have a question, feature request, or an idea for improving the library or its related tools, please try one of the following resources:
|
||||
|
||||
- [Read the documentation](https://reactnavigation.org/)
|
||||
- [Post an issue to the website repository if you'd like to see a documentation change](http://github.com/react-navigation/website)
|
||||
- [Post a feature request to Canny](https://react-navigation.canny.io/feature-requests)
|
||||
- [Write a RFC if you have ideas for how to implement a feature request](https://github.com/react-navigation/rfcs)
|
||||
- [Get help on Discord chat (#react-navigation on Reactiflux)](https://discord.gg/4xEK3nD) or [on StackOverflow](https://stackoverflow.com/questions/tagged/react-navigation)
|
||||
- Search for your issue - it may have already been answered or even fixed in the development branch. However, if you find that an old, closed issue still persists in the latest version, you should open a new issue.
|
||||
|
||||
Bugs with react-navigation must be reproducible *without any external libraries that operate on it*. This means that if you are attempting to use Redux or MobX with it and you think you have found a bug, you must be able to reproduce it without Redux or MobX in this report. Redux related issues belong in [react-navigation-redux-helpers](https://github.com/react-navigation/react-navigation-redux-helpers), and we do not have any first-class integration with MobX at the moment.
|
||||
|
||||
---
|
||||
|
||||
### Current Behavior
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot if it makes sense.
|
||||
|
||||
### Expected Behavior
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot if it makes sense.
|
||||
|
||||
### How to reproduce
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
|
||||
### Your Environment
|
||||
|
||||
| software | version
|
||||
| ---------------- | -------
|
||||
| react-navigation |
|
||||
| react-native |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
36
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
name: Miscellaneous
|
||||
about: Report an issue which is regarding the core API of React Navigation.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ---------------- | ------- |
|
||||
| iOS or Android |
|
||||
| react-navigation |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
38
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
38
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Stack Navigator
|
||||
url: https://github.com/react-navigation/stack/issues/new
|
||||
about: Submit a bug report for Stack Navigator (react-navigation-stack).
|
||||
- name: Drawer Navigator
|
||||
url: https://github.com/react-navigation/drawer/issues/new
|
||||
about: Submit a bug report for Drawer Navigator (react-navigation-drawer).
|
||||
- name: Tab Navigator
|
||||
url: https://github.com/react-navigation/tabs/issues/new
|
||||
about: Submit a bug report for Bottom Tab Navigator and Material Top Tab Navigator (react-navigation-tabs).
|
||||
- name: Material Bottom Tab Navigator
|
||||
url: https://github.com/react-navigation/material-bottom-tabs/issues/new
|
||||
about: Submit a bug report for Material Bottom Tab Navigator (react-navigation-material-bottom-tabs).
|
||||
- name: Animated Switch Navigator
|
||||
url: https://github.com/react-navigation/animated-switch/issues/new
|
||||
about: Submit a bug report for Animated Switch Navigator (react-navigation-animated-switch).
|
||||
- name: React Navigation 5
|
||||
url: https://github.com/react-navigation/navigation-ex/issues/new/choose
|
||||
about: Submit a bug report for React Navigation 5.
|
||||
- name: Common mistakes
|
||||
url: https://reactnavigation.org/docs/en/common-mistakes.html
|
||||
about: Read about common mistakes and how to fix them.
|
||||
- name: Documentation
|
||||
url: https://reactnavigation.org
|
||||
about: Read the official documentation.
|
||||
- name: Feature requests
|
||||
url: https://react-navigation.canny.io/feature-requests
|
||||
about: Post a feature request on Canny.
|
||||
- name: StackOverflow
|
||||
url: https://stackoverflow.com/questions/tagged/react-navigation
|
||||
about: Ask and answer questions using the react-navigation label.
|
||||
- name: Reactiflux
|
||||
url: https://www.reactiflux.com/
|
||||
about: Chat with other community members in the react-navigation channel.
|
||||
- name: Write an RFC
|
||||
url: https://github.com/react-navigation/rfcs
|
||||
about: Write a RFC if you have ideas for how to implement a feature request.
|
||||
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
12
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,10 +1,10 @@
|
||||
Please provide enough information so that others can review your pull request:
|
||||
|
||||
## Motivation
|
||||
**Motivation**
|
||||
|
||||
Explain the **motivation** for making this change. What existing problem does the pull request solve?
|
||||
|
||||
## Test plan
|
||||
**Test plan**
|
||||
|
||||
Demonstrate the code is solid. Example: the exact commands you ran and their output, screenshots / videos if the pull request changes UI.
|
||||
|
||||
@@ -12,10 +12,6 @@ Make sure you test on both platforms if your change affects both platforms.
|
||||
|
||||
The code must pass tests.
|
||||
|
||||
## Code formatting
|
||||
**Code formatting**
|
||||
|
||||
Look around. Match the style of the rest of the codebase. Run `yarn format` before committing.
|
||||
|
||||
## Changelog
|
||||
|
||||
Add an entry under the "Unreleased" heading in [CHANGELOG.md](https://github.com/react-navigation/react-navigation/blob/master/CHANGELOG.md#unreleased) which explains your change.
|
||||
Look around. Match the style of the rest of the codebase. Run `yarn lint --fix` before committing.
|
||||
|
||||
16
.github/workflows/stale.yml
vendored
Normal file
16
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: "Close stale issues and pull requests"
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
stale-issue-message: 'Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.'
|
||||
stale-pr-message: 'Hello 👋, this pull request has been open for more than 2 months with no activity on it. If you think this is still necessary with the latest version, please comment and ping a maintainer to get this reviewed, otherwise it will be closed automatically in 7 days.'
|
||||
exempt-issue-label: 'Keep opened'
|
||||
exempt-pr-label: 'Keep opened'
|
||||
336
CHANGELOG.md
336
CHANGELOG.md
@@ -1,336 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Add missing Flow type exports for `ScrollView` and `NavigationContext`
|
||||
|
||||
## [3.11.1]
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix `navigationOptions` type from `NavigationScreenProp<NavigationRoute>` to `NavigationScreenConfig<Options>`.
|
||||
- Fix missing `isFirstRouteInParent` type in typescript and flow.
|
||||
- Add missing `backTitleVisible` for typescript, `disabled` and `backTitleVisible` for flow definitions in type `HeaderBackButtonProps`
|
||||
- Add missing `keyboardHidesTabBar` for TypeScript to `TabViewConfig.tabBarOptions`
|
||||
- Add missing `unmountInactiveRoutes` for TypeScript to `DrawerNavigatorConfig`
|
||||
|
||||
## [3.11.0]
|
||||
|
||||
## New Features
|
||||
|
||||
- Export `SwitchActions`
|
||||
|
||||
## [3.10.2]
|
||||
|
||||
## Fixes
|
||||
|
||||
- Update Flow types - Add `cardShadowEnabled` and `cardOverlayEnabled` to NavigationStackViewConfig
|
||||
- Upgrade react-navigation-tabs [#5914](https://github.com/react-navigation/react-navigation/issues/5914)
|
||||
|
||||
## [3.10.0] - [2019-05-16](https://github.com/react-navigation/react-navigation/releases/tag/3.10.0)
|
||||
|
||||
## Removed
|
||||
|
||||
- `persistenceKey` no longer automatically saves and restores navigation state using AsyncStorage. Typically this would be a breaking change that would require a major version bump, but because this has always been marked as experimental in the documentation and it is unlikely to impact production apps, we are rolling it in a minor release. `persistenceKey` has been replaced with `persistNavigationState` and `loadNavigationState`. See the diff in docs: https://github.com/react-navigation/react-navigation.github.io/pull/425/files?short_path=b668b1a#diff-b668b1a4201e40b1378036dc012100fe
|
||||
|
||||
## Changed
|
||||
|
||||
- Removed animations from stack on web
|
||||
- Ensure that headerMode is float by default on web
|
||||
|
||||
## Fixes
|
||||
|
||||
- Prevent transitionConfig's useNativeDriver value being overwritten. (https://github.com/react-navigation/stack/commit/8b2af7d94209d4658abd8d799bc78744a1004b4e)
|
||||
- Update typescript with headerLeftContainerStyle and headerRightContainerStyle
|
||||
- Update typescript - Add `safeAreaInset` to `BottomTabBarProps`
|
||||
- Update typescript - `TabBarTop` is now `MaterialTopTabBar`
|
||||
- Update typescript - Remove `SwitchNavigator`, `TabNavigator` and `StackNavigator`. Added exports for `SceneView` and `SwitchRouter`
|
||||
- Update typescript - `getLabel` is now `getLabelText` in BottomTabProps and TopTabProps
|
||||
- Silence deprecated lifecycle warning in Stack Transitioner
|
||||
|
||||
## [3.9.0] - [2019-04-23](https://github.com/react-navigation/react-navigation/releases/tag/3.9.0)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Remove `createTabNavigator` from type definitions
|
||||
- Add missing types for `DrawerNavigatorConfig`
|
||||
- Use `preserveFocus` action param rather than matching on specific action types to determine if index needs to be updated if child router changes (https://github.com/react-navigation/react-navigation-core/pull/56)
|
||||
|
||||
## [3.8.1] - [2019-04-12](https://github.com/react-navigation/react-navigation/releases/tag/3.8.1)
|
||||
|
||||
## Changed
|
||||
|
||||
- Add missing type for `enableURLHandling` to TypeScript definition (#5803)
|
||||
- Update Flow types (#5806)
|
||||
|
||||
## [3.8.0] - [2019-04-12](https://github.com/react-navigation/react-navigation/releases/tag/3.8.0)
|
||||
|
||||
## Fixes
|
||||
|
||||
- `onRefresh` on exported lists `FlatList` and `SectionList` works as expected now (no need to add `refreshControl` prop explicitly)
|
||||
- On Android, the exported `ScrollView` is now same as the React Native ScrollView (but with scroll-to-top behavior added), whereas on iOS we still use react-native-gesture-handler ScrollView. We can change Android back to react-native-gesture-handler ScrollView when https://github.com/kmagiera/react-native-gesture-handler/issues/560 is resolved.
|
||||
- Look for `scrollResponderScrollTo` function in our ScrollView, in react-native 0.59 the interface appears to have changed for FlatList such that this is needed. (react-navigation-native#20)
|
||||
|
||||
## Changed
|
||||
|
||||
- Stack header style improvements for web (react-navigation-stack#104)
|
||||
|
||||
## [3.7.1] - [2019-04-10](https://github.com/react-navigation/react-navigation/releases/tag/3.7.1)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Update Flow types (#5800 and #5801)
|
||||
- More open `navigationOptions` types for bottom tab navigator config (#5796)
|
||||
- Fix hit slop for bottom tab bar (react-navigation-tabs#110)
|
||||
|
||||
## Added
|
||||
|
||||
- Add accessibility role and state to bottom bar (react-navigation-tabs#90)
|
||||
- Hide tab bar when keyboard is shown (react-navigation-tabs#112)
|
||||
- Specify default values for getAccessibilityX on tabs (react-navigation-tabs##116)
|
||||
- Add a isFirstRouteInParent method to navigation object (react-navigation-core#51)
|
||||
|
||||
## [3.6.1] - [2019-04-02](https://github.com/react-navigation/react-navigation/releases/tag/3.6.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Move event subscriptions to constructor in `withNavigationFocus` to ensure initial `didFocus` event is received.
|
||||
|
||||
## [3.6.0] - [2019-03-31](https://github.com/react-navigation/react-navigation/releases/tag/3.6.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Export TabBarIconProps, TabBarLabelProps, DrawerIconProps, DrawerLabelProps, ScreenProps and InitialLayout.
|
||||
- Add `disabled` prop to HeaderBackButton
|
||||
- Add `StackViewTransitionConfigs.NoAnimation`
|
||||
- Add `drawerContainerStyle` to navigator config for drawer navigator
|
||||
|
||||
## [3.5.1] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.1)
|
||||
|
||||
## Added
|
||||
|
||||
- Export StackGestureContext and DrawerGestureContext
|
||||
- Add missing type for withOrientation
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix header HeaderBackButton title TypeScript type
|
||||
|
||||
## [3.5.0] - [2019-03-19](https://github.com/react-navigation/react-navigation/releases/tag/3.5.0)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fixed types for `BottomTabBar`
|
||||
- export `NavigationContext` type
|
||||
|
||||
## Changed
|
||||
|
||||
- Make 'react-native-gesture-handler' a peer dependency rather than a hard dependency
|
||||
|
||||
## [3.4.1] - [2019-03-16](https://github.com/react-navigation/react-navigation/releases/tag/3.4.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix missing TypeScript definitions file in release package
|
||||
|
||||
## [3.4.0] - [2019-03-15](https://github.com/react-navigation/react-navigation/releases/tag/3.4.0)
|
||||
|
||||
## Added
|
||||
|
||||
- TypeScript type definition now included in the project.
|
||||
- Better support for react-native-web in core and stack.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Default key to null in stack reset action (https://github.com/react-navigation/react-navigation-core/commit/59238160d86284a3353d53af10688fcf3f36004f)
|
||||
- Fix header back button label and title label scaling. Defaults to false. (https://github.com/react-navigation/react-navigation-stack/commit/c1f1dff465e9eebe274a08e274cf10570045fa23)
|
||||
|
||||
## Changed
|
||||
|
||||
- Remove react-lifecycles-compat from @react-navigation/core
|
||||
- NavigationPlayground uses TypeScript
|
||||
|
||||
## [3.3.2] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.2)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Updated Flow types (https://github.com/react-navigation/react-navigation/commit/d3040e52b39bc8e91ffc1354d9c5f8c096baf597)
|
||||
|
||||
## [3.3.1] - [2019-02-25](https://github.com/react-navigation/react-navigation/releases/tag/3.3.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- SafeAreaView bottom inset on iPhone XR and XS fixed. (https://github.com/react-navigation/react-navigation/issues/5625)
|
||||
|
||||
## [3.3.0] - [2019-02-16](https://github.com/react-navigation/react-navigation/releases/tag/3.3.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Pass through `drawerOpenProgress` to drawer content component (https://github.com/react-navigation/react-navigation-drawer/pull/40)
|
||||
|
||||
## [3.2.3] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.3)
|
||||
|
||||
## Fixed
|
||||
|
||||
- `await` the result of `onTransitionStart` before starting the transition (https://github.com/react-navigation/react-navigation-stack/pull/79)
|
||||
|
||||
## [3.2.2]
|
||||
|
||||
- Oops, I skipped it. Nothing here.
|
||||
|
||||
## [3.2.1] - [2019-02-09](https://github.com/react-navigation/react-navigation/releases/tag/3.2.1)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Remove accidental console.log
|
||||
|
||||
## [3.2.0] - [2019-02-08](https://github.com/react-navigation/react-navigation/releases/tag/3.2.0)
|
||||
|
||||
## Added
|
||||
|
||||
- Add support for `backBehavior: history'` and `backBehavior: 'order'` to any navigator based on SwitchRouter (eg: tab navigators). (https://github.com/react-navigation/react-navigation-core/pull/31)
|
||||
|
||||
## [3.1.5] - [2019-02-06](https://github.com/react-navigation/react-navigation/releases/tag/3.1.5)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Revert "Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)"
|
||||
|
||||
## [3.1.4] - [2019-02-05](https://github.com/react-navigation/react-navigation/releases/tag/3.1.4)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Fix references to onGestureFinish in StackViewLayout, should be onGestureEnd
|
||||
|
||||
## [3.1.3] - [2019-02-04](https://github.com/react-navigation/react-navigation/releases/tag/3.1.3)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Stack navigator properly dismisses and restores keyboard when gesture starts and is cancelled
|
||||
- Transparent header measurement fix (https://github.com/react-navigation/react-navigation-stack/pull/71)
|
||||
|
||||
## [3.1.2] - [2019-02-01](https://github.com/react-navigation/react-navigation/releases/tag/3.1.2)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Update flow definition for `withNavigation` and `withNavigationFocus` to support `defaultProps`
|
||||
- Prevent onRef callback be called twice on withNavigationFocus components (https://github.com/react-navigation/react-navigation-core/pull/30)
|
||||
- Bump react-navigation-drawer version to improve performance - if you use Expo, you will need expo@^32.0.3 to update!
|
||||
|
||||
## [3.0.9] - [2018-12-19](https://github.com/react-navigation/react-navigation/releases/tag/3.0.9)
|
||||
|
||||
## Fixed
|
||||
|
||||
- Intermittent flicker when changing tabs while using react-native-screens fixed by not changing opacity (https://github.com/react-navigation/react-navigation-tabs/pull/80)
|
||||
- Prevent fading the previous screen on push/pop on Android (https://github.com/react-navigation/react-navigation-stack/pull/73)
|
||||
|
||||
## [3.0.8] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.8)
|
||||
|
||||
## Changed
|
||||
|
||||
- Lock create-react-context to 0.2.2
|
||||
|
||||
## [3.0.7] - [2018-12-08](https://github.com/react-navigation/react-navigation/releases/tag/3.0.7)
|
||||
|
||||
## Changed
|
||||
|
||||
- Optimize stack gesture to avoid a setState and reduce unnecessary Animated node creation (https://github.com/react-navigation/react-navigation-stack/pull/70)
|
||||
|
||||
## [3.0.6] - [2018-12-06](https://github.com/react-navigation/react-navigation/releases/tag/3.0.6)
|
||||
|
||||
## Fixes
|
||||
|
||||
- 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
|
||||
|
||||
- Fix crash in rare case where onNavigationStateChange on container leads to setState and container has screenProps (https://github.com/react-navigation/react-navigation/issues/5301)
|
||||
- Expose underlaying ScrollView methods to NavigationAwareScrollable (https://github.com/react-navigation/react-navigation-native/pull/8)
|
||||
|
||||
## [3.0.4] - [2018-11-30](https://github.com/react-navigation/react-navigation/releases/tag/3.0.4)
|
||||
|
||||
## Changed
|
||||
|
||||
- Lock dependencies to exact versions
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix crash when screenInterpolator is null (https://github.com/react-navigation/react-navigation-stack/issues/64)
|
||||
- Fix renderPager override (https://github.com/react-navigation/react-navigation-tabs/pull/70)
|
||||
|
||||
## Added
|
||||
|
||||
- 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
|
||||
|
||||
- Fix bug where if you navigate immediately when the navigator is first mounted the stack could get in an invalid state.
|
||||
- Transparent stack card factors in header height now, even though you probably won't want to use this.
|
||||
- Fix bug where shadow was still rendered on transparent stack
|
||||
- Fix gestureResponseDistance custom values being ignored for modal stack
|
||||
|
||||
## [3.0.2] - [2018-11-27](https://github.com/react-navigation/react-navigation/releases/tag/3.0.2)
|
||||
|
||||
## Fixes
|
||||
|
||||
- Fix `drawerLockMode` on drawer navigator
|
||||
- Fix RTL support in drawer navigator
|
||||
|
||||
## [3.0.1] - [2018-11-26](https://github.com/react-navigation/react-navigation/releases/tag/3.0.1)
|
||||
|
||||
## Fixes
|
||||
|
||||
- fix NavigationTestUtils.js deprecated file import.
|
||||
- Update `getParam` flow typings to check `key` and `fallback` arguments, as well as return the correct type automatically.
|
||||
- Fix regression in backgroundColor on cardStyle for stack navigator.
|
||||
|
||||
## [3.0.0] - [2018-11-17](https://github.com/react-navigation/react-navigation/releases/tag/3.0.0)
|
||||
|
||||
- Changes between the latest 2.x release and 3.0.0 are listed on the blog at https://reactnavigation.org/blog/2018/11/17/react-navigation-3.0.html
|
||||
|
||||
# [Previous major versions]
|
||||
|
||||
- [2.x](https://github.com/react-navigation/react-navigation/blob/2.x/CHANGELOG.md)
|
||||
|
||||
[Unreleased]: Fixed NavigationStackScreenOptions types by adding headerTitleContainerStyle
|
||||
[Unreleased]: https://github.com/react-navigation/react-navigation/compare/3.10.0...HEAD
|
||||
[3.10.0]: https://github.com/react-navigation/react-navigation/compare/3.10.0...3.9.0
|
||||
[3.9.0]: https://github.com/react-navigation/react-navigation/compare/3.8.1...3.9.0
|
||||
[3.8.1]: https://github.com/react-navigation/react-navigation/compare/3.8.0...3.8.1
|
||||
[3.8.0]: https://github.com/react-navigation/react-navigation/compare/3.7.1...3.8.0
|
||||
[3.7.1]: https://github.com/react-navigation/react-navigation/compare/3.6.1...3.7.1
|
||||
[3.6.1]: https://github.com/react-navigation/react-navigation/compare/3.6.0...3.6.1
|
||||
[3.6.0]: https://github.com/react-navigation/react-navigation/compare/3.5.1...3.6.0
|
||||
[3.5.1]: https://github.com/react-navigation/react-navigation/compare/3.5.0...3.5.1
|
||||
[3.5.0]: https://github.com/react-navigation/react-navigation/compare/3.4.1...3.5.0
|
||||
[3.4.1]: https://github.com/react-navigation/react-navigation/compare/3.4.0...3.4.1
|
||||
[3.4.0]: https://github.com/react-navigation/react-navigation/compare/3.3.2...3.4.0
|
||||
[3.3.2]: https://github.com/react-navigation/react-navigation/compare/3.3.1...3.3.2
|
||||
[3.3.1]: https://github.com/react-navigation/react-navigation/compare/3.3.0...3.3.1
|
||||
[3.3.0]: https://github.com/react-navigation/react-navigation/compare/3.2.3...3.3.0
|
||||
[3.2.3]: https://github.com/react-navigation/react-navigation/compare/3.2.1...3.2.3
|
||||
[3.2.1]: https://github.com/react-navigation/react-navigation/compare/3.2.0...3.2.1
|
||||
[3.2.0]: https://github.com/react-navigation/react-navigation/compare/3.1.5...3.2.0
|
||||
[3.1.5]: https://github.com/react-navigation/react-navigation/compare/3.1.4...3.1.5
|
||||
[3.1.4]: https://github.com/react-navigation/react-navigation/compare/3.1.3...3.1.4
|
||||
[3.1.3]: https://github.com/react-navigation/react-navigation/compare/3.1.2...3.1.3
|
||||
[3.1.2]: https://github.com/react-navigation/react-navigation/compare/3.0.9...3.1.2
|
||||
[3.0.9]: https://github.com/react-navigation/react-navigation/compare/3.0.8...3.0.9
|
||||
[3.0.8]: https://github.com/react-navigation/react-navigation/compare/3.0.7...3.0.8
|
||||
[3.0.7]: https://github.com/react-navigation/react-navigation/compare/3.0.6...3.0.7
|
||||
[3.0.6]: https://github.com/react-navigation/react-navigation/compare/3.0.5...3.0.6
|
||||
[3.0.5]: https://github.com/react-navigation/react-navigation/compare/3.0.4...3.0.5
|
||||
[3.0.4]: https://github.com/react-navigation/react-navigation/compare/3.0.3...3.0.4
|
||||
[3.0.3]: https://github.com/react-navigation/react-navigation/compare/3.0.2...3.0.3
|
||||
[3.0.2]: https://github.com/react-navigation/react-navigation/compare/3.0.1...3.0.2
|
||||
[3.0.1]: https://github.com/react-navigation/react-navigation/compare/3.0.0...3.0.1
|
||||
[3.0.0]: https://github.com/react-navigation/react-navigation/compare/2.x...3.0.0
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://badge.fury.io/js/react-navigation) [](https://circleci.com/gh/react-navigation/react-navigation/tree/master) [](https://reactnavigation.org/docs/contributing.html)
|
||||
|
||||
React Navigation is born from the React Native community's need for an extensible yet easy-to-use navigation solution based on Javascript.
|
||||
React Navigation is born from the React Native community's need for an extensible yet easy-to-use navigation solution based on JavaScript.
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -17,6 +17,10 @@ See: https://reactnavigation.org/docs/en/getting-started.html
|
||||
* The [Community Resources](https://github.com/react-navigation/react-navigation/blob/master/COMMUNITY_RESOURCES.md) document lists some other resources submitted to us by people who use React Navigation. Feel free to open a pull request to add your resource to the list.
|
||||
* You can contribute improvements to the documentation [in the website repository](https://github.com/react-navigation/react-navigation.github.io).
|
||||
|
||||
## Changelog
|
||||
|
||||
The changes for each release are outlined on [the GitHub releases page](https://github.com/react-navigation/react-navigation/releases).
|
||||
|
||||
## Try it out
|
||||
|
||||
You can also try out the [Navigation Playground app](https://exp.host/@react-navigation/NavigationPlayground) to get a sense for some of the tools built in to React Navigation. The "Fundamentals" in the documentation also include examples you can play with.
|
||||
@@ -45,4 +49,4 @@ This library has adopted a Code of Conduct that we expect project participants t
|
||||
|
||||
## License
|
||||
|
||||
React Navigation is licensed under the [BSD 2-clause "Simplified" License](https://github.com/react-community/react-navigation/blob/master/LICENSE).
|
||||
React Navigation is licensed under the [MIT](https://github.com/react-community/react-navigation/blob/master/LICENSE).
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
};
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
{
|
||||
"presets": ["expo"]
|
||||
"presets": [
|
||||
"expo"
|
||||
],
|
||||
"plugins": [
|
||||
["module-resolver", {
|
||||
"alias": {
|
||||
"react-navigation": "../src/react-navigation"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
12
example/README.md
Normal file
12
example/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Navigation Playground Example
|
||||
|
||||
The NavigationPlayground example app includes a variety of patterns and is used as a simple way for contributors to manually integration test changes.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
yarn bootstrap # in the react-navigation root directory
|
||||
yarn example start
|
||||
```
|
||||
|
||||
You can view this example application directly on Android phones by visiting scanning the QR code on [this site](https://exp.host/@react-navigation/NavigationPlayground) with the [Expo app](https://play.google.com/store/apps/details?id=host.exp.exponent&hl=en).
|
||||
@@ -3,12 +3,12 @@
|
||||
"name": "React Navigation Stack Example",
|
||||
"description": "Demonstrates the various capabilities of react-navigation-stack",
|
||||
"slug": "react-navigation-stack-demo",
|
||||
"sdkVersion": "33.0.0",
|
||||
"sdkVersion": "36.0.0",
|
||||
"version": "1.0.0",
|
||||
"primaryColor": "#2196f3",
|
||||
"packagerOpts": {
|
||||
"config": "./metro.config.js",
|
||||
"projectRoots": ""
|
||||
}
|
||||
"platforms": [
|
||||
"android",
|
||||
"ios"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,45 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies, import/no-commonjs */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
const path = require('path');
|
||||
const blacklist = require('metro-config/src/defaults/blacklist');
|
||||
const project = require('../package.json');
|
||||
const fs = require('fs');
|
||||
const escape = require('escape-string-regexp');
|
||||
const blacklist = require('metro-config/src/defaults/blacklist');
|
||||
|
||||
const projectDependencies = Object.keys({
|
||||
...project.dependencies,
|
||||
...project.peerDependencies,
|
||||
});
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const pak = JSON.parse(
|
||||
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
|
||||
);
|
||||
|
||||
const modules = [
|
||||
'@babel/runtime',
|
||||
'@expo/vector-icons',
|
||||
...Object.keys({
|
||||
...pak.dependencies,
|
||||
...pak.peerDependencies,
|
||||
}),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
projectRoot: __dirname,
|
||||
watchFolders: [path.resolve(__dirname, '..')],
|
||||
watchFolders: [root],
|
||||
|
||||
resolver: {
|
||||
blacklistRE: blacklist([
|
||||
new RegExp(
|
||||
`^${escape(
|
||||
path.resolve(__dirname, 'node_modules', project.name)
|
||||
)}\\/.*$`
|
||||
),
|
||||
new RegExp(
|
||||
`^${escape(path.resolve(__dirname, '..', 'node_modules'))}\\/.*$`
|
||||
),
|
||||
new RegExp(`^${escape(path.join(root, 'node_modules'))}\\/.*$`),
|
||||
]),
|
||||
|
||||
providesModuleNodeModules: [
|
||||
'@expo/vector-icons',
|
||||
'@babel/runtime',
|
||||
...projectDependencies,
|
||||
],
|
||||
extraNodeModules: modules.reduce((acc, name) => {
|
||||
acc[name] = path.join(__dirname, 'node_modules', name);
|
||||
return acc;
|
||||
}, {}),
|
||||
},
|
||||
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
inlineRequires: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,29 +9,30 @@
|
||||
"ios": "expo start --ios"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "^10.0.0",
|
||||
"@react-native-community/masked-view": "^0.1.1",
|
||||
"@react-navigation/core": "^3.5.0",
|
||||
"@expo/vector-icons": "^10.0.6",
|
||||
"@react-native-community/masked-view": "0.1.5",
|
||||
"@react-navigation/core": "^3.5.1",
|
||||
"@react-navigation/native": "^3.6.2",
|
||||
"expo": "^33.0.7",
|
||||
"expo-asset": "^5.0.1",
|
||||
"expo-blur": "~5.0.1",
|
||||
"expo-constants": "~5.0.1",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
|
||||
"expo": "^36.0.0",
|
||||
"expo-asset": "~8.0.0",
|
||||
"expo-blur": "~8.0.0",
|
||||
"expo-constants": "~8.0.0",
|
||||
"hoist-non-react-statics": "^3.3.1",
|
||||
"react": "16.9.0",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
||||
"react-native-gesture-handler": "~1.5.0",
|
||||
"react-native-iphone-x-helper": "^1.2.1",
|
||||
"react-native-paper": "^2.15.2",
|
||||
"react-navigation-drawer": "^2.0.1",
|
||||
"react-navigation-header-buttons": "^3.0.2",
|
||||
"react-navigation-stack": "^1.5.1",
|
||||
"react-navigation-tabs": "^1.2.0"
|
||||
"react-native-paper": "^3.4.0",
|
||||
"react-native-reanimated": "~1.4.0",
|
||||
"react-native-safe-area-context": "0.6.0",
|
||||
"react-native-screens": "2.0.0-alpha.12",
|
||||
"react-navigation-drawer": "^2.3.3",
|
||||
"react-navigation-header-buttons": "^3.0.4",
|
||||
"react-navigation-stack": "^2.0.4",
|
||||
"react-navigation-tabs": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-module-resolver": "^3.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"react-native-safe-area-view": "0.14.6",
|
||||
"react-native-screens": "1.0.0-alpha.23"
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"expo-cli": "^3.11.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,14 @@ import {
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { createDrawerNavigator } from 'react-navigation-drawer';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
NavigationDrawerScreenProps,
|
||||
} from 'react-navigation-drawer';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import SampleText from './SampleText';
|
||||
|
||||
@@ -22,7 +28,13 @@ const MyNavScreen = ({
|
||||
<ScrollView>
|
||||
<SafeAreaView forceInset={{ top: 'always' }}>
|
||||
<SampleText>{banner}</SampleText>
|
||||
<Button onPress={() => navigation.openDrawer()} title="Open drawer" />
|
||||
<Button
|
||||
onPress={() => {
|
||||
// @ts-ignore
|
||||
navigation.openDrawer();
|
||||
}}
|
||||
title="Open drawer"
|
||||
/>
|
||||
<Button
|
||||
onPress={() => navigation.navigate('Email')}
|
||||
title="Open other screen"
|
||||
@@ -33,26 +45,22 @@ const MyNavScreen = ({
|
||||
</ScrollView>
|
||||
);
|
||||
|
||||
const InboxScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Inbox Screen" navigation={navigation} />;
|
||||
const InboxScreen = ({ navigation }: NavigationDrawerScreenProps) => (
|
||||
<MyNavScreen banner="Inbox Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
InboxScreen.navigationOptions = {
|
||||
headerTitle: 'Inbox',
|
||||
};
|
||||
|
||||
const EmailScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Email Screen" navigation={navigation} />;
|
||||
const EmailScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Email Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
const DraftsScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Drafts Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
const DraftsScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Drafts Screen" navigation={navigation} />;
|
||||
DraftsScreen.navigationOptions = {
|
||||
headerTitle: 'Drafts',
|
||||
};
|
||||
|
||||
@@ -6,7 +6,10 @@ import {
|
||||
SafeAreaView,
|
||||
NavigationState,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import SampleText from './SampleText';
|
||||
|
||||
@@ -89,26 +92,24 @@ const ProfileNavigator = createStackNavigator(
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: {
|
||||
headerLeft: null,
|
||||
headerLeft: () => null,
|
||||
},
|
||||
mode: 'modal',
|
||||
}
|
||||
);
|
||||
|
||||
const MyHeaderTestScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Full screen view" navigation={navigation} />;
|
||||
const MyHeaderTestScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Full screen view" navigation={navigation} />
|
||||
);
|
||||
|
||||
MyHeaderTestScreen.navigationOptions = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => {
|
||||
}: NavigationStackScreenProps) => {
|
||||
const headerVisible =
|
||||
navigation.state.params && navigation.state.params.headerVisible;
|
||||
|
||||
return {
|
||||
header: headerVisible ? undefined : null,
|
||||
headerShown: headerVisible,
|
||||
title: 'Now you see me',
|
||||
};
|
||||
};
|
||||
@@ -122,7 +123,7 @@ const ModalStack = createStackNavigator(
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
},
|
||||
mode: 'modal',
|
||||
}
|
||||
|
||||
@@ -5,15 +5,16 @@ import {
|
||||
NavigationActions,
|
||||
NavigationEventPayload,
|
||||
NavigationEventSubscription,
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
NavigationStateRoute,
|
||||
SafeAreaView,
|
||||
StackActions,
|
||||
Themed,
|
||||
withNavigation,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackProp,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import { HeaderButtons } from './commonComponents/HeaderButtons';
|
||||
import SampleText from './SampleText';
|
||||
@@ -21,12 +22,12 @@ import SampleText from './SampleText';
|
||||
const DEBUG = false;
|
||||
|
||||
interface MyNavScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
banner: React.ReactNode;
|
||||
}
|
||||
|
||||
interface BackButtonProps {
|
||||
navigation: NavigationScreenProp<NavigationStateRoute<any>>;
|
||||
navigation: NavigationStackProp;
|
||||
}
|
||||
|
||||
class MyBackButton extends React.Component<BackButtonProps, any> {
|
||||
@@ -99,11 +100,7 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
|
||||
}
|
||||
}
|
||||
|
||||
interface MyHomeScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
class MyHomeScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Welcome',
|
||||
};
|
||||
@@ -143,10 +140,7 @@ class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
}
|
||||
}
|
||||
|
||||
interface MyPhotosScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
class MyPhotosScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
headerLeft: () => <MyBackButtonWithNavigation />,
|
||||
title: 'Photos',
|
||||
@@ -195,7 +189,7 @@ class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
const MyProfileScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
}) => (
|
||||
<MyNavScreen
|
||||
banner={`${
|
||||
@@ -205,7 +199,7 @@ const MyProfileScreen = ({
|
||||
/>
|
||||
);
|
||||
|
||||
MyProfileScreen.navigationOptions = (props: MyHomeScreenProps) => {
|
||||
MyProfileScreen.navigationOptions = (props: NavigationStackScreenProps) => {
|
||||
const { navigation } = props;
|
||||
const { state, setParams } = navigation;
|
||||
const { params } = state;
|
||||
@@ -213,7 +207,7 @@ MyProfileScreen.navigationOptions = (props: MyHomeScreenProps) => {
|
||||
headerBackImage: params!.headerBackImage,
|
||||
// Render a button on the right side of the header.
|
||||
// When pressed switches the screen to edit mode.
|
||||
headerRight: (
|
||||
headerRight: () => (
|
||||
<HeaderButtons>
|
||||
<HeaderButtons.Item
|
||||
title={params!.mode === 'edit' ? 'Done' : 'Edit'}
|
||||
@@ -227,23 +221,18 @@ MyProfileScreen.navigationOptions = (props: MyHomeScreenProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const SimpleStack = createStackNavigator(
|
||||
{
|
||||
Home: {
|
||||
screen: MyHomeScreen,
|
||||
},
|
||||
Photos: {
|
||||
path: 'photos/:name',
|
||||
screen: MyPhotosScreen,
|
||||
},
|
||||
Profile: {
|
||||
path: 'people/:name',
|
||||
screen: MyProfileScreen,
|
||||
},
|
||||
const SimpleStack = createStackNavigator({
|
||||
Home: {
|
||||
screen: MyHomeScreen,
|
||||
},
|
||||
{
|
||||
// headerLayoutPreset: 'center',
|
||||
}
|
||||
);
|
||||
Photos: {
|
||||
path: 'photos/:name',
|
||||
screen: MyPhotosScreen,
|
||||
},
|
||||
Profile: {
|
||||
path: 'people/:name',
|
||||
screen: MyProfileScreen,
|
||||
},
|
||||
});
|
||||
|
||||
export default SimpleStack;
|
||||
|
||||
@@ -39,6 +39,7 @@ const MyNavScreen = ({
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
{TEXT.split('\n').map((p, n) => (
|
||||
<Themed.Text
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={n}
|
||||
style={{ marginVertical: 10, marginHorizontal: 8 }}
|
||||
>
|
||||
|
||||
@@ -3,11 +3,13 @@ import { Button, Image, StyleSheet } from 'react-native';
|
||||
import {
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
NavigationScreenConfigProps,
|
||||
Themed,
|
||||
SafeAreaView,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import SampleText from './SampleText';
|
||||
|
||||
interface MyNavScreenProps {
|
||||
@@ -50,7 +52,7 @@ interface MyHomeScreenProps {
|
||||
|
||||
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
static navigationOptions = {
|
||||
headerBackTitle: null,
|
||||
headerBackTitleVisible: false,
|
||||
title: 'Welcome',
|
||||
};
|
||||
|
||||
@@ -63,13 +65,14 @@ class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
interface MyPhotosScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
static navigationOptions = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => ({
|
||||
headerBackTitle: null,
|
||||
headerBackTitleVisible: false,
|
||||
title: `${navigation.state.params!.name}'s photos`,
|
||||
});
|
||||
|
||||
@@ -92,6 +95,7 @@ class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
interface MyProfileScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class MyProfileScreen extends React.Component<MyProfileScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Profile',
|
||||
@@ -124,8 +128,8 @@ const StackWithCustomHeaderBackImage = createStackNavigator(
|
||||
},
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: ({ theme }: NavigationScreenConfigProps) => ({
|
||||
headerBackImage: (
|
||||
defaultNavigationOptions: ({ theme }: NavigationStackScreenProps) => ({
|
||||
headerBackImage: () => (
|
||||
<MyCustomHeaderBackImage
|
||||
style={[
|
||||
styles.myCustomHeaderBackImageAlt,
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
import * as React from 'react';
|
||||
import { StatusBar } from 'react-native';
|
||||
import { SafeAreaView, Themed } from 'react-navigation';
|
||||
import {
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
TransitionPresets,
|
||||
HeaderStyleInterpolators,
|
||||
} from 'react-navigation-stack';
|
||||
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
|
||||
interface NavScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class HomeScreen extends React.Component<NavScreenProps> {
|
||||
class HomeScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Welcome',
|
||||
};
|
||||
@@ -30,13 +26,13 @@ class HomeScreen extends React.Component<NavScreenProps> {
|
||||
title="Push screen with no header"
|
||||
/>
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go Home" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class OtherScreen extends React.Component<NavScreenProps> {
|
||||
class OtherScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Your title here',
|
||||
};
|
||||
@@ -57,13 +53,13 @@ class OtherScreen extends React.Component<NavScreenProps> {
|
||||
/>
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ScreenWithLongTitle extends React.Component<NavScreenProps> {
|
||||
class ScreenWithLongTitle extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: "Another title that's kind of long",
|
||||
};
|
||||
@@ -76,15 +72,15 @@ class ScreenWithLongTitle extends React.Component<NavScreenProps> {
|
||||
<SafeAreaView style={{ paddingTop: 30 }}>
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ScreenWithNoHeader extends React.Component<NavScreenProps> {
|
||||
class ScreenWithNoHeader extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
title: 'No Header',
|
||||
};
|
||||
|
||||
@@ -97,7 +93,7 @@ class ScreenWithNoHeader extends React.Component<NavScreenProps> {
|
||||
<Button onPress={() => push('Other')} title="Push another screen" />
|
||||
<Button onPress={() => pop()} title="Pop" />
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
@@ -111,7 +107,10 @@ const StackWithHeaderPreset = createStackNavigator(
|
||||
ScreenWithNoHeader,
|
||||
},
|
||||
{
|
||||
headerTransitionPreset: 'uikit',
|
||||
defaultNavigationOptions: {
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import { isIphoneX } from 'react-native-iphone-x-helper';
|
||||
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
||||
import {
|
||||
NavigationEventPayload,
|
||||
NavigationEventSubscription,
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
Themed,
|
||||
SupportedThemes,
|
||||
} from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
Header,
|
||||
HeaderStyleInterpolator,
|
||||
HeaderStyleInterpolators,
|
||||
NavigationStackScreenProps,
|
||||
NavigationStackProp,
|
||||
TransitionPresets,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import { HeaderButtons } from './commonComponents/HeaderButtons';
|
||||
import SampleText from './SampleText';
|
||||
|
||||
interface MyNavScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
banner: React.ReactNode;
|
||||
}
|
||||
|
||||
@@ -56,15 +56,8 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
|
||||
// at some point.
|
||||
|
||||
getHeaderInset(): any {
|
||||
const NOTCH_HEIGHT = isIphoneX() ? 25 : 0;
|
||||
|
||||
// $FlowIgnore: we will remove the HEIGHT static soon enough
|
||||
const BASE_HEADER_HEIGHT = Header.HEIGHT;
|
||||
|
||||
const HEADER_HEIGHT =
|
||||
Platform.OS === 'ios'
|
||||
? BASE_HEADER_HEIGHT + NOTCH_HEIGHT
|
||||
: BASE_HEADER_HEIGHT + 20;
|
||||
getStatusBarHeight() + Platform.select({ ios: 44, default: 56 });
|
||||
|
||||
return Platform.select({
|
||||
android: {
|
||||
@@ -81,7 +74,7 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
|
||||
}
|
||||
|
||||
interface MyHomeScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
}
|
||||
|
||||
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
@@ -125,7 +118,7 @@ class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
}
|
||||
|
||||
interface MyPhotosScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
}
|
||||
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
static navigationOptions = {
|
||||
@@ -175,7 +168,7 @@ class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
const MyProfileScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
}) => (
|
||||
<MyNavScreen
|
||||
banner={`${navigation.state.params!.mode === 'edit' ? 'Now Editing ' : ''}${
|
||||
@@ -186,17 +179,19 @@ const MyProfileScreen = ({
|
||||
);
|
||||
|
||||
MyProfileScreen.navigationOptions = (props: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
theme: SupportedThemes;
|
||||
}) => {
|
||||
const { navigation, theme } = props;
|
||||
const { state, setParams } = navigation;
|
||||
const { params } = state;
|
||||
return {
|
||||
headerBackImage: params!.headerBackImage,
|
||||
headerBackImage: params!.headerBackImage
|
||||
? () => params!.headerBackImage
|
||||
: undefined,
|
||||
// Render a button on the right side of the header.
|
||||
// When pressed switches the screen to edit mode.
|
||||
headerRight: (
|
||||
headerRight: () => (
|
||||
<HeaderButtons>
|
||||
<HeaderButtons.Item
|
||||
color={theme === 'light' ? '#000' : '#fff'}
|
||||
@@ -226,8 +221,9 @@ const StackWithTranslucentHeader = createStackNavigator(
|
||||
},
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: ({ theme }) => ({
|
||||
headerBackground:
|
||||
defaultNavigationOptions: ({ theme }: NavigationStackScreenProps) => ({
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
headerBackground: () =>
|
||||
Platform.OS === 'ios' ? (
|
||||
<BlurView
|
||||
style={{ flex: 1 }}
|
||||
@@ -241,13 +237,7 @@ const StackWithTranslucentHeader = createStackNavigator(
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
},
|
||||
headerTransparent: true,
|
||||
}),
|
||||
headerTransitionPreset: 'uikit',
|
||||
// You can leave this out if you don't want the card shadow to
|
||||
// be visible through the header
|
||||
transitionConfig: () => ({
|
||||
headerBackgroundInterpolator:
|
||||
HeaderStyleInterpolator.forBackgroundWithTranslation,
|
||||
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
import React from 'react';
|
||||
import { StatusBar, Text, View } from 'react-native';
|
||||
import { NavigationScreenProp, NavigationState } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { Text, View } from 'react-native';
|
||||
import { Themed } from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
|
||||
interface Props {
|
||||
navigation: NavigationScreenProp<NavigationState & any>;
|
||||
}
|
||||
|
||||
class HomeScreen extends React.Component<Props, any> {
|
||||
class HomeScreen extends React.Component<NavigationStackScreenProps> {
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
@@ -27,15 +26,18 @@ class HomeScreen extends React.Component<Props, any> {
|
||||
title="Go back to other examples"
|
||||
onPress={() => this.props.navigation.goBack(null)}
|
||||
/>
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ProfileScreen extends React.Component<any, any> {
|
||||
class ProfileScreen extends React.Component<
|
||||
NavigationStackScreenProps<{ homeKey: string }>
|
||||
> {
|
||||
render() {
|
||||
const { homeKey } = this.props.navigation.state.params;
|
||||
const homeKey = this.props.navigation.getParam('homeKey');
|
||||
|
||||
return (
|
||||
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
||||
<Text>Profile</Text>
|
||||
@@ -60,7 +62,7 @@ class ProfileScreen extends React.Component<any, any> {
|
||||
}
|
||||
}
|
||||
|
||||
class SettingsScreen extends React.Component<Props, any> {
|
||||
class SettingsScreen extends React.Component<NavigationStackScreenProps> {
|
||||
render() {
|
||||
const { homeKey } = this.props.navigation.state.params!;
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
import React from 'react';
|
||||
import { StatusBar, Text } from 'react-native';
|
||||
import { Text } from 'react-native';
|
||||
import {
|
||||
Themed,
|
||||
NavigationScreenProp,
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
NavigationStackProp,
|
||||
} from 'react-navigation-stack';
|
||||
import { createBottomTabNavigator } from 'react-navigation-tabs';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
@@ -18,7 +23,7 @@ Nulla convallis pulvinar hendrerit. Nulla mattis sem et aliquam ultrices. Nam eg
|
||||
Praesent lobortis elit sit amet mauris pulvinar, viverra condimentum massa pellentesque. Curabitur massa ex, dignissim eget neque at, fringilla consectetur justo. Cras sollicitudin vel ligula sed cursus. Aliquam porta sem hendrerit diam porta ultricies. Sed eu mi erat. Curabitur id justo vel tortor hendrerit vestibulum id eget est. Morbi eros magna, placerat id diam ut, varius sollicitudin mi. Curabitur pretium finibus accumsan.`;
|
||||
|
||||
interface Props {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
navigation: NavigationStackProp;
|
||||
banner: string;
|
||||
}
|
||||
|
||||
@@ -46,23 +51,20 @@ class MyNavScreen extends React.Component<Props> {
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
|
||||
{TEXT.split('\n').map((p, n) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Text key={n} style={{ marginVertical: 10, marginHorizontal: 8 }}>
|
||||
{p}
|
||||
</Text>
|
||||
))}
|
||||
</SafeAreaView>
|
||||
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const MyProfileScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => (
|
||||
const MyProfileScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen
|
||||
banner={`${navigation.state.params!.name}s Profile`}
|
||||
navigation={navigation}
|
||||
|
||||
@@ -7,7 +7,10 @@ import {
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { createBottomTabNavigator } from 'react-navigation-tabs';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import SampleText from './SampleText';
|
||||
@@ -59,9 +62,9 @@ const MyProfileScreen = ({
|
||||
|
||||
const MyNotificationsSettingsScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Notifications Screen" navigation={navigation} />;
|
||||
}: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Notifications Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
const MySettingsScreen = ({
|
||||
navigation,
|
||||
@@ -141,11 +144,7 @@ const StacksOverTabs = createStackNavigator({
|
||||
screen: MyNotificationsSettingsScreen,
|
||||
},
|
||||
Profile: {
|
||||
navigationOptions: ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => ({
|
||||
navigationOptions: ({ navigation }: NavigationStackScreenProps) => ({
|
||||
title: `${navigation.state.params!.name}'s Profile!`,
|
||||
}),
|
||||
path: '/people/:name',
|
||||
|
||||
@@ -11,7 +11,10 @@ import {
|
||||
NavigationState,
|
||||
SafeAreaView,
|
||||
} from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import {
|
||||
createMaterialTopTabNavigator,
|
||||
MaterialTopTabBar,
|
||||
@@ -64,11 +67,7 @@ const MyHomeScreen = ({
|
||||
/>
|
||||
);
|
||||
|
||||
const MyProfileScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => (
|
||||
const MyProfileScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen
|
||||
banner={`${navigation.state.params!.name}s Profile`}
|
||||
navigation={navigation}
|
||||
@@ -77,9 +76,9 @@ const MyProfileScreen = ({
|
||||
|
||||
const MyNotificationsSettingsScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Notifications Screen" navigation={navigation} />;
|
||||
}: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Notifications Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
const MySettingsScreen = ({
|
||||
navigation,
|
||||
@@ -148,7 +147,7 @@ const StackNavigator = createStackNavigator(
|
||||
Root: {
|
||||
screen: TabNavigator,
|
||||
navigationOptions: {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
},
|
||||
},
|
||||
NotifSettings: {
|
||||
@@ -159,11 +158,7 @@ const StackNavigator = createStackNavigator(
|
||||
},
|
||||
Profile: {
|
||||
screen: MyProfileScreen,
|
||||
navigationOptions: ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => ({
|
||||
navigationOptions: ({ navigation }: NavigationStackScreenProps) => ({
|
||||
title: `${navigation.state.params!.name}'s Profile!`,
|
||||
}),
|
||||
},
|
||||
|
||||
@@ -2,16 +2,18 @@ import React from 'react';
|
||||
import {
|
||||
ActivityIndicator,
|
||||
AsyncStorage,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
View,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { createSwitchNavigator } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { Themed, createSwitchNavigator } from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
|
||||
class SignInScreen extends React.Component<any, any> {
|
||||
class SignInScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Please sign in',
|
||||
};
|
||||
@@ -24,7 +26,7 @@ class SignInScreen extends React.Component<any, any> {
|
||||
title="Go back to other examples"
|
||||
onPress={() => this.props.navigation.goBack(null)}
|
||||
/>
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -35,7 +37,7 @@ class SignInScreen extends React.Component<any, any> {
|
||||
};
|
||||
}
|
||||
|
||||
class HomeScreen extends React.Component<any, any> {
|
||||
class HomeScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Welcome to the app!',
|
||||
};
|
||||
@@ -45,7 +47,7 @@ class HomeScreen extends React.Component<any, any> {
|
||||
<View style={styles.container}>
|
||||
<Button title="Show me more of the app" onPress={this.showMoreApp} />
|
||||
<Button title="Actually, sign me out :)" onPress={this.signOutAsync} />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -65,7 +67,7 @@ class HomeScreen extends React.Component<any, any> {
|
||||
};
|
||||
}
|
||||
|
||||
class OtherScreen extends React.Component<any, any> {
|
||||
class OtherScreen extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Lots of features here',
|
||||
};
|
||||
@@ -74,7 +76,7 @@ class OtherScreen extends React.Component<any, any> {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button title="I'm done, sign me out" onPress={this.signOutAsync} />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -105,7 +107,7 @@ class LoadingScreen extends React.Component<any, any> {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<ActivityIndicator />
|
||||
<StatusBar barStyle="default" />
|
||||
<Themed.StatusBar />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 939 B After Width: | Height: | Size: 930 B |
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB After Width: | Height: | Size: 75 KiB |
10304
example/yarn.lock
10304
example/yarn.lock
File diff suppressed because it is too large
Load Diff
1310
flow/react-navigation.js
vendored
1310
flow/react-navigation.js
vendored
File diff suppressed because it is too large
Load Diff
30
package.json
30
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation",
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.0",
|
||||
"description": "Routing and navigation for your React Native apps",
|
||||
"main": "src/react-navigation.js",
|
||||
"types": "typescript/react-navigation.d.ts",
|
||||
@@ -31,28 +31,28 @@
|
||||
"react-native": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/core": "^3.5.0",
|
||||
"@react-navigation/native": "^3.6.2"
|
||||
"@react-navigation/core": "^3.5.2",
|
||||
"@react-navigation/native": "^3.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/config-conventional": "^8.0.0",
|
||||
"@commitlint/config-conventional": "^8.3.4",
|
||||
"@release-it/conventional-changelog": "^1.1.0",
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/react": "^16.9.2",
|
||||
"@types/react-native": "^0.60.9",
|
||||
"codecov": "^3.5.0",
|
||||
"commitlint": "^8.0.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-satya164": "^2.4.1",
|
||||
"@types/jest": "^24.0.25",
|
||||
"@types/react": "^16.9.17",
|
||||
"@types/react-native": "^0.60.27",
|
||||
"codecov": "^3.6.1",
|
||||
"commitlint": "^8.3.4",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-satya164": "^3.1.5",
|
||||
"eslint-plugin-react-native-globals": "^0.1.0",
|
||||
"husky": "^3.0.0",
|
||||
"husky": "^3.1.0",
|
||||
"jest": "^24.9.0",
|
||||
"prettier": "^1.18.2",
|
||||
"prettier": "^1.19.1",
|
||||
"react": "16.8.3",
|
||||
"react-native": "~0.59.8",
|
||||
"react-test-renderer": "16.8.3",
|
||||
"release-it": "^12.3.6",
|
||||
"typescript": "^3.6.2"
|
||||
"release-it": "^12.4.3",
|
||||
"typescript": "^3.7.4"
|
||||
},
|
||||
"jest": {
|
||||
"notify": true,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
trailingComma: 'es5',
|
||||
singleQuote: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const throwError = (message, page) => {
|
||||
throw new Error(
|
||||
`${message}. See https://reactnavigation.org/docs/4.x/${page}.html for more details.`
|
||||
`${message}. See https://reactnavigation.org/docs/${page}.html for more details.`
|
||||
);
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = {
|
||||
|
||||
get DrawerGestureContext() {
|
||||
throwError(
|
||||
'`DrawerGestureContext` has been moved to `react-navigation-drawe`',
|
||||
'`DrawerGestureContext` has been moved to `react-navigation-drawer`',
|
||||
'stack-navigator'
|
||||
);
|
||||
},
|
||||
@@ -68,7 +68,7 @@ module.exports = {
|
||||
|
||||
get DrawerActions() {
|
||||
throwError(
|
||||
'`DrawerActions` has been moved to `react-navigation-drawe`',
|
||||
'`DrawerActions` has been moved to `react-navigation-drawer`',
|
||||
'drawer-navigator'
|
||||
);
|
||||
},
|
||||
|
||||
27
src/react-navigation.js
vendored
27
src/react-navigation.js
vendored
@@ -1,4 +1,29 @@
|
||||
export * from '@react-navigation/core';
|
||||
export * from '@react-navigation/native';
|
||||
|
||||
export * from './deprecations';
|
||||
// Export each item individually so that they can be evaluated lazily
|
||||
// https://babeljs.io/docs/en/babel-plugin-transform-modules-commonjs#lazy
|
||||
export {
|
||||
createNavigationContainer,
|
||||
createStackNavigator,
|
||||
createBottomTabNavigator,
|
||||
createMaterialTopTabNavigator,
|
||||
createDrawerNavigator,
|
||||
StackGestureContext,
|
||||
DrawerGestureContext,
|
||||
DrawerRouter,
|
||||
DrawerActions,
|
||||
Transitioner,
|
||||
StackView,
|
||||
StackViewCard,
|
||||
StackViewTransitionConfigs,
|
||||
Header,
|
||||
HeaderTitle,
|
||||
HeaderBackButton,
|
||||
HeaderStyleInterpolator,
|
||||
DrawerView,
|
||||
DrawerItems,
|
||||
DrawerSidebar,
|
||||
BottomTabBar,
|
||||
MaterialTopTabBar,
|
||||
} from './deprecations';
|
||||
|
||||
386
typescript/react-navigation.d.ts
vendored
386
typescript/react-navigation.d.ts
vendored
@@ -33,7 +33,6 @@
|
||||
|
||||
declare module 'react-navigation' {
|
||||
import * as React from 'react';
|
||||
import { PanGestureHandler } from 'react-native-gesture-handler';
|
||||
|
||||
import {
|
||||
Animated,
|
||||
@@ -50,14 +49,10 @@ declare module 'react-navigation' {
|
||||
// @todo: should we re-export from RNGH? not currently exposed through it
|
||||
export { FlatList, SectionList, ScrollView } from 'react-native';
|
||||
|
||||
export type ScreenProps = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
// @todo - any..
|
||||
export function getActiveChildNavigationOptions<S>(
|
||||
navigation: NavigationProp<S>,
|
||||
screenProps?: ScreenProps,
|
||||
screenProps?: unknown,
|
||||
theme?: SupportedThemes
|
||||
): NavigationParams;
|
||||
|
||||
@@ -86,7 +81,7 @@ declare module 'react-navigation' {
|
||||
routes: NavigationRoute[];
|
||||
isTransitioning: boolean;
|
||||
key: string;
|
||||
params: NavigationParams | undefined;
|
||||
params?: NavigationParams | undefined;
|
||||
}
|
||||
|
||||
export interface DrawerNavigationState extends NavigationState {
|
||||
@@ -138,7 +133,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export type NavigationScreenOptionsGetter<Options> = (
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>>,
|
||||
screenProps: ScreenProps | null,
|
||||
screenProps: unknown | null,
|
||||
theme: SupportedThemes
|
||||
) => Options;
|
||||
|
||||
@@ -169,9 +164,20 @@ declare module 'react-navigation' {
|
||||
params?: NavigationParams;
|
||||
};
|
||||
|
||||
getComponentForRouteName: (routeName: string) => NavigationComponent;
|
||||
getComponentForRouteName: (
|
||||
routeName: string
|
||||
) => NavigationComponent<{}, NavigationScreenProp<NavigationRoute>>;
|
||||
|
||||
getComponentForState: (state: State) => NavigationComponent;
|
||||
getComponentForState: (
|
||||
state: State
|
||||
) => NavigationComponent<{}, NavigationScreenProp<NavigationRoute>>;
|
||||
|
||||
getActionCreators: (
|
||||
route: NavigationRoute,
|
||||
key: string
|
||||
) => {
|
||||
[key: string]: () => NavigationAction;
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the screen navigation options for a given screen.
|
||||
@@ -184,54 +190,50 @@ declare module 'react-navigation' {
|
||||
getScreenOptions: NavigationScreenOptionsGetter<Options>;
|
||||
}
|
||||
|
||||
export type NavigationScreenOption<T> =
|
||||
| T
|
||||
| ((navigation: NavigationScreenProp<NavigationRoute>, config: T) => T);
|
||||
export type NavigationScreenComponent<
|
||||
Options,
|
||||
NavigationScreenPropType
|
||||
> = React.ComponentType<any> & {
|
||||
navigationOptions?: NavigationScreenConfig<
|
||||
Options,
|
||||
NavigationScreenPropType
|
||||
>;
|
||||
};
|
||||
|
||||
export interface NavigationScreenDetails<T> {
|
||||
options: T;
|
||||
state: NavigationRoute;
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions &
|
||||
NavigationTabScreenOptions &
|
||||
NavigationDrawerScreenOptions;
|
||||
|
||||
export interface NavigationScreenConfigProps {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
export interface NavigationScreenConfigProps<
|
||||
NavigationScreenPropType,
|
||||
ScreenProps = unknown
|
||||
> {
|
||||
navigation: NavigationScreenPropType;
|
||||
screenProps: ScreenProps;
|
||||
theme: SupportedThemes;
|
||||
}
|
||||
|
||||
export type NavigationScreenConfig<Options> =
|
||||
export type NavigationScreenConfig<
|
||||
Options,
|
||||
NavigationScreenPropType,
|
||||
ScreenProps = unknown
|
||||
> =
|
||||
| Options
|
||||
| ((
|
||||
navigationOptionsContainer: NavigationScreenConfigProps & {
|
||||
navigationOptions: NavigationScreenConfig<Options>;
|
||||
navigationOptionsContainer: NavigationScreenConfigProps<
|
||||
NavigationScreenPropType,
|
||||
ScreenProps
|
||||
> & {
|
||||
navigationOptions: Options;
|
||||
}
|
||||
) => Options);
|
||||
|
||||
export type NavigationComponent =
|
||||
| NavigationScreenComponent<NavigationParams, any, any>
|
||||
| NavigationNavigator<any, any, any>
|
||||
| any;
|
||||
|
||||
export type NavigationScreenComponent<
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationScreenProps<Params, Options> & Props> & {
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
};
|
||||
export type NavigationComponent<Options, NavigationPropType> =
|
||||
| NavigationScreenComponent<Options, NavigationPropType>
|
||||
| NavigationNavigator<Options, NavigationPropType>;
|
||||
|
||||
export type NavigationNavigator<
|
||||
State = NavigationState,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
||||
router: NavigationRouter<State, Options>;
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
Options,
|
||||
NavigationPropType
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options>> & {
|
||||
router: NavigationRouter<Options>;
|
||||
navigationOptions?: NavigationScreenConfig<Options, NavigationPropType>;
|
||||
};
|
||||
|
||||
export interface NavigationParams {
|
||||
@@ -255,6 +257,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationBackActionPayload {
|
||||
key?: string | null;
|
||||
immediate?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationBackAction extends NavigationBackActionPayload {
|
||||
@@ -266,7 +269,7 @@ declare module 'react-navigation' {
|
||||
key: string;
|
||||
|
||||
// The new params to merge into the existing route params
|
||||
params?: NavigationParams;
|
||||
params: NavigationParams;
|
||||
}
|
||||
|
||||
export interface NavigationSetParamsAction
|
||||
@@ -280,6 +283,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationInitAction extends NavigationInitActionPayload {
|
||||
type: 'Navigation/INIT';
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationReplaceActionPayload {
|
||||
@@ -287,7 +291,7 @@ declare module 'react-navigation' {
|
||||
newKey?: string;
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
action?: NavigationNavigateAction;
|
||||
action?: NavigationAction;
|
||||
}
|
||||
|
||||
export interface NavigationReplaceAction {
|
||||
@@ -295,11 +299,12 @@ declare module 'react-navigation' {
|
||||
key: string;
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
action?: NavigationNavigateAction;
|
||||
action?: NavigationAction;
|
||||
}
|
||||
|
||||
export interface NavigationCompleteTransitionActionPayload {
|
||||
key?: string;
|
||||
toChildKey?: string;
|
||||
}
|
||||
|
||||
export interface NavigationCompleteTransitionAction {
|
||||
@@ -333,6 +338,7 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationPopAction extends NavigationPopActionPayload {
|
||||
type: 'Navigation/POP';
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationPopToTopActionPayload {
|
||||
@@ -362,16 +368,25 @@ declare module 'react-navigation' {
|
||||
|
||||
export interface NavigationJumpToActionPayload {
|
||||
routeName: string;
|
||||
key: string;
|
||||
params?: NavigationParams;
|
||||
key?: string;
|
||||
preserveFocus?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationJumpToAction {
|
||||
type: 'Navigation/JUMP_TO';
|
||||
preserveFocus: boolean;
|
||||
routeName: string;
|
||||
key: string;
|
||||
params?: NavigationParams;
|
||||
preserveFocus?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationDrawerOpenedAction {
|
||||
key?: string;
|
||||
type: 'Navigation/DRAWER_OPENED';
|
||||
}
|
||||
|
||||
export interface NavigationDrawerClosedAction {
|
||||
key?: string;
|
||||
type: 'Navigation/DRAWER_CLOSED';
|
||||
}
|
||||
|
||||
export interface NavigationOpenDrawerAction {
|
||||
@@ -392,19 +407,46 @@ declare module 'react-navigation' {
|
||||
/**
|
||||
* Switch Navigator
|
||||
*/
|
||||
|
||||
export interface SwitchRouter extends NavigationRouter {}
|
||||
|
||||
export interface NavigationSwitchRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[];
|
||||
backBehavior: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'none'
|
||||
backBehavior?: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'none'
|
||||
resetOnBlur?: boolean; // defaults to `true`
|
||||
}
|
||||
|
||||
export function SwitchRouter(
|
||||
routeConfigs: NavigationRouteConfigMap<any, any>,
|
||||
config?: NavigationSwitchRouterConfig
|
||||
): NavigationRouter<any, any>;
|
||||
|
||||
export type NavigationSwitchProp<
|
||||
State = NavigationRoute,
|
||||
Params = NavigationParams
|
||||
> = NavigationScreenProp<State, Params> & {
|
||||
jumpTo(routeName: string, key?: string): void;
|
||||
};
|
||||
|
||||
export type NavigationSwitchScreenProps<
|
||||
Params = NavigationParams,
|
||||
ScreenProps = unknown
|
||||
> = {
|
||||
theme: SupportedThemes;
|
||||
navigation: NavigationSwitchProp<NavigationRoute, Params>;
|
||||
screenProps: ScreenProps;
|
||||
};
|
||||
|
||||
export type NavigationSwitchScreenComponent<
|
||||
Params = NavigationParams,
|
||||
ScreenProps = unknown
|
||||
> = React.ComponentType<NavigationSwitchScreenProps<Params, ScreenProps>> & {
|
||||
navigationOptions?: NavigationScreenConfig<
|
||||
{},
|
||||
NavigationSwitchProp<NavigationRoute, Params>,
|
||||
ScreenProps
|
||||
>;
|
||||
};
|
||||
|
||||
export type NavigationStackAction =
|
||||
| NavigationInitAction
|
||||
@@ -424,6 +466,8 @@ declare module 'react-navigation' {
|
||||
| NavigationBackAction;
|
||||
|
||||
export type NavigationDrawerAction =
|
||||
| NavigationDrawerOpenedAction
|
||||
| NavigationDrawerClosedAction
|
||||
| NavigationOpenDrawerAction
|
||||
| NavigationCloseDrawerAction
|
||||
| NavigationToggleDrawerAction;
|
||||
@@ -435,22 +479,26 @@ declare module 'react-navigation' {
|
||||
| NavigationStackAction
|
||||
| NavigationTabAction
|
||||
| NavigationDrawerAction
|
||||
| NavigationSwitchAction;
|
||||
| NavigationSwitchAction
|
||||
| { type: 'CHILD_ACTION'; key?: string };
|
||||
|
||||
export type NavigationRouteConfig =
|
||||
| NavigationComponent
|
||||
| ({
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
export type NavigationRouteConfig<Options, NavigationScreenPropType, ScreenProps = unknown> =
|
||||
| NavigationComponent<Options, NavigationScreenPropType>
|
||||
| (
|
||||
| { screen: NavigationComponent<Options, NavigationScreenPropType> }
|
||||
| {
|
||||
getScreen(): NavigationScreenComponent<
|
||||
Options,
|
||||
NavigationScreenPropType
|
||||
>;
|
||||
}) & {
|
||||
navigationOptions?: NavigationScreenConfig<
|
||||
Options,
|
||||
NavigationScreenPropType,
|
||||
ScreenProps
|
||||
>;
|
||||
params?: { [key: string]: any };
|
||||
path?: string;
|
||||
} & NavigationScreenRouteConfig);
|
||||
|
||||
export type NavigationScreenRouteConfig =
|
||||
| NavigationComponent
|
||||
| {
|
||||
screen: NavigationComponent;
|
||||
}
|
||||
| {
|
||||
getScreen: () => NavigationComponent;
|
||||
};
|
||||
|
||||
export interface NavigationPathsConfig {
|
||||
@@ -458,7 +506,7 @@ declare module 'react-navigation' {
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:strict-export-declare-modifiers
|
||||
interface NavigationTabRouterConfigBase {
|
||||
export interface NavigationTabRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
@@ -466,21 +514,13 @@ declare module 'react-navigation' {
|
||||
backBehavior?: 'none' | 'initialRoute' | 'history' | 'order'; // defaults to 'initialRoute'
|
||||
resetOnBlur?: boolean;
|
||||
}
|
||||
export interface NavigationTabRouterConfig
|
||||
extends NavigationTabRouterConfigBase {
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
}
|
||||
export interface NavigationBottomTabRouterConfig
|
||||
extends NavigationTabRouterConfigBase {
|
||||
defaultNavigationOptions?: NavigationScreenConfig<
|
||||
NavigationBottomTabScreenOptions
|
||||
>;
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
}
|
||||
|
||||
export interface NavigationRouteConfigMap {
|
||||
[routeName: string]: NavigationRouteConfig;
|
||||
export interface NavigationRouteConfigMap<Options, NavigationScreenPropType, ScreenProps = unknown> {
|
||||
[routeName: string]: NavigationRouteConfig<
|
||||
Options,
|
||||
NavigationScreenPropType,
|
||||
ScreenProps
|
||||
>;
|
||||
}
|
||||
|
||||
export type NavigationDispatch = (action: NavigationAction) => boolean;
|
||||
@@ -513,7 +553,6 @@ declare module 'react-navigation' {
|
||||
}
|
||||
|
||||
export interface NavigationEventsProps extends ViewProps {
|
||||
navigation?: NavigationNavigator;
|
||||
onWillFocus?: NavigationEventCallback;
|
||||
onDidFocus?: NavigationEventCallback;
|
||||
onWillBlur?: NavigationEventCallback;
|
||||
@@ -527,62 +566,52 @@ declare module 'react-navigation' {
|
||||
dispatch: NavigationDispatch;
|
||||
goBack: (routeKey?: string | null) => boolean;
|
||||
dismiss: () => boolean;
|
||||
navigate(options: {
|
||||
navigate<T extends NavigationParams>(options: {
|
||||
routeName:
|
||||
| string
|
||||
| {
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
params?: T;
|
||||
action?: NavigationNavigateAction;
|
||||
key?: string;
|
||||
};
|
||||
params?: NavigationParams;
|
||||
params?: T;
|
||||
action?: NavigationAction;
|
||||
key?: string;
|
||||
}): boolean;
|
||||
navigate(
|
||||
|
||||
navigate<T extends NavigationParams>(
|
||||
routeNameOrOptions: string,
|
||||
params?: NavigationParams,
|
||||
params?: T,
|
||||
action?: NavigationAction
|
||||
): boolean;
|
||||
openDrawer: () => any;
|
||||
closeDrawer: () => any;
|
||||
toggleDrawer: () => any;
|
||||
getParam<T extends keyof P>(
|
||||
param: T,
|
||||
fallback: NonNullable<P[T]>
|
||||
): NonNullable<P[T]>;
|
||||
getParam<T extends keyof P>(param: T): P[T];
|
||||
setParams: (newParams: Partial<P>) => boolean;
|
||||
emit: (eventName: 'refocus') => void;
|
||||
addListener: (
|
||||
eventName: 'willBlur' | 'willFocus' | 'didFocus' | 'didBlur',
|
||||
eventName: string,
|
||||
callback: NavigationEventCallback
|
||||
) => NavigationEventSubscription;
|
||||
push: (
|
||||
routeName: string,
|
||||
params?: NavigationParams,
|
||||
action?: NavigationNavigateAction
|
||||
) => boolean;
|
||||
replace: (
|
||||
routeName: string,
|
||||
params?: NavigationParams,
|
||||
action?: NavigationNavigateAction
|
||||
) => boolean;
|
||||
reset: (actions: NavigationAction[], index: number) => boolean;
|
||||
pop: (n?: number, params?: { immediate?: boolean }) => boolean;
|
||||
popToTop: (params?: { immediate?: boolean }) => boolean;
|
||||
isFocused: () => boolean;
|
||||
isFirstRouteInParent: () => boolean;
|
||||
router?: NavigationRouter;
|
||||
dangerouslyGetParent: () => NavigationScreenProp<S> | undefined;
|
||||
}
|
||||
|
||||
export interface NavigationNavigatorProps<O = {}, S = {}> {
|
||||
export interface NavigationNavigatorProps<
|
||||
Options = {},
|
||||
State = {},
|
||||
ScreenProps = unknown
|
||||
> {
|
||||
theme?: SupportedThemes | 'no-preference';
|
||||
detached?: boolean;
|
||||
navigation?: NavigationProp<S>;
|
||||
navigation?: NavigationProp<State>;
|
||||
screenProps?: ScreenProps;
|
||||
navigationOptions?: O;
|
||||
navigationOptions?: Options;
|
||||
}
|
||||
|
||||
export type NavigatorType =
|
||||
@@ -590,7 +619,11 @@ declare module 'react-navigation' {
|
||||
| 'react-navigation/TABS'
|
||||
| 'react-navigation/DRAWER';
|
||||
|
||||
export interface NavigationContainerProps<S = {}, O = {}> {
|
||||
export interface NavigationContainerProps<
|
||||
State = {},
|
||||
Options = {},
|
||||
ScreenProps = unknown
|
||||
> {
|
||||
uriPrefix?: string | RegExp;
|
||||
/**
|
||||
* Controls whether the navigation container handles URLs opened via 'Linking'
|
||||
@@ -603,7 +636,7 @@ declare module 'react-navigation' {
|
||||
nextNavigationState: NavigationState,
|
||||
action: NavigationAction
|
||||
) => void | null | undefined;
|
||||
navigation?: NavigationScreenProp<S>;
|
||||
navigation?: NavigationScreenProp<State>;
|
||||
/*
|
||||
* This prop is no longer supported. Use `loadNavigationState` and
|
||||
* `persistNavigationState` instead.
|
||||
@@ -615,7 +648,7 @@ declare module 'react-navigation' {
|
||||
|
||||
renderLoadingExperimental?: React.ComponentType;
|
||||
screenProps?: ScreenProps;
|
||||
navigationOptions?: O;
|
||||
navigationOptions?: Options;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
@@ -636,25 +669,20 @@ declare module 'react-navigation' {
|
||||
): NavigationContainerComponent;
|
||||
|
||||
router: NavigationRouter<any, any>;
|
||||
screenProps: ScreenProps;
|
||||
screenProps: unknown;
|
||||
navigationOptions: any;
|
||||
state: { nav: NavigationState | null };
|
||||
}
|
||||
|
||||
export interface SwitchNavigatorConfig {
|
||||
initialRouteName: string;
|
||||
resetOnBlur?: boolean;
|
||||
paths?: NavigationPathsConfig;
|
||||
backBehavior?: 'none' | 'initialRoute';
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig;
|
||||
|
||||
export function createSwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
routeConfigMap: NavigationRouteConfigMap<{}, NavigationSwitchProp>,
|
||||
switchConfig?: CreateNavigatorConfig<
|
||||
{},
|
||||
NavigationSwitchRouterConfig,
|
||||
{},
|
||||
NavigationSwitchProp
|
||||
>
|
||||
): NavigationNavigator<{}, NavigationProp<NavigationState>>;
|
||||
|
||||
/**
|
||||
* NavigationActions
|
||||
@@ -714,7 +742,7 @@ declare module 'react-navigation' {
|
||||
): NavigationReplaceAction;
|
||||
|
||||
function completeTransition(
|
||||
payload: NavigationCompleteTransitionActionPayload
|
||||
payload?: NavigationCompleteTransitionActionPayload
|
||||
): NavigationCompleteTransitionAction;
|
||||
}
|
||||
|
||||
@@ -735,7 +763,7 @@ declare module 'react-navigation' {
|
||||
* @desc from react-navigation/src/routers/TabRouter.js
|
||||
*/
|
||||
export function TabRouter(
|
||||
routeConfigs: NavigationRouteConfigMap,
|
||||
routeConfigs: NavigationRouteConfigMap<any, any>,
|
||||
config: NavigationTabRouterConfig
|
||||
): NavigationRouter<any, any>;
|
||||
|
||||
@@ -745,16 +773,14 @@ declare module 'react-navigation' {
|
||||
* @desc from react-navigation/src/routers/StackRouter.js
|
||||
*/
|
||||
export function StackRouter(
|
||||
routeConfigs: NavigationRouteConfigMap,
|
||||
config: NavigationTabRouterConfig
|
||||
routeConfigs: NavigationRouteConfigMap<any, any>,
|
||||
config?: NavigationTabRouterConfig
|
||||
): NavigationRouter<any, any>;
|
||||
|
||||
export interface NavigationStackRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
defaultNavigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
initialRouteKey?: string;
|
||||
}
|
||||
|
||||
@@ -763,28 +789,53 @@ declare module 'react-navigation' {
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js
|
||||
*/
|
||||
export interface NavigationDescriptor<Params = NavigationParams> {
|
||||
export interface NavigationDescriptor<
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
NavigationScreenPropType = NavigationScreenProp<NavigationRoute>
|
||||
> {
|
||||
key: string;
|
||||
state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
navigation: NavigationScreenProp<any>;
|
||||
options: NavigationScreenOptions;
|
||||
navigation: NavigationScreenPropType;
|
||||
options: Options;
|
||||
getComponent: () => React.ComponentType;
|
||||
}
|
||||
|
||||
export type NavigationView<O, S> = React.ComponentType<
|
||||
export type NavigationView<
|
||||
Options,
|
||||
State,
|
||||
ScreenProps = unknown
|
||||
> = React.ComponentType<
|
||||
{
|
||||
descriptors: { [key: string]: NavigationDescriptor };
|
||||
navigationConfig: O;
|
||||
navigationConfig: Options;
|
||||
screenProps?: ScreenProps;
|
||||
} & NavigationInjectedProps
|
||||
>;
|
||||
|
||||
export type CreateNavigatorConfig<
|
||||
NavigatorConfig,
|
||||
RouterConfig,
|
||||
Options,
|
||||
NavigationScreenPropType
|
||||
> = NavigatorConfig &
|
||||
RouterConfig & {
|
||||
defaultNavigationOptions?: NavigationScreenConfig<
|
||||
Options,
|
||||
NavigationScreenPropType
|
||||
>;
|
||||
navigationOptions?: NavigationScreenConfig<
|
||||
{ [key: string]: any },
|
||||
NavigationScreenProp<NavigationRoute>
|
||||
>;
|
||||
};
|
||||
|
||||
export function createNavigator<S, Options>(
|
||||
view: NavigationView<Options, S>,
|
||||
router: NavigationRouter<S, Options>,
|
||||
navigatorConfig?: {} | null,
|
||||
navigatorConfig?: {},
|
||||
navigatorType?: NavigatorType
|
||||
): any;
|
||||
): NavigationNavigator<Options, NavigationProp<NavigationState>>;
|
||||
|
||||
/**
|
||||
* Create an HOC that injects the navigation and manages the navigation state
|
||||
@@ -794,8 +845,8 @@ declare module 'react-navigation' {
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation/blob/master/src/createNavigationContainer.js
|
||||
*/
|
||||
export function createNavigationContainer(
|
||||
Component: NavigationNavigator<any, any, any>
|
||||
export function createNavigationContainer<Options, NavigationPropType>(
|
||||
Component: NavigationNavigator<Options, NavigationPropType>
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
@@ -803,31 +854,10 @@ declare module 'react-navigation' {
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation-native/blob/098e2e52b349d37357109d5aee545fa74699d3d4/src/createAppContainer.js#L64
|
||||
*/
|
||||
export function createAppContainer(
|
||||
Component: NavigationNavigator<any, any, any>
|
||||
export function createAppContainer<Options, NavigationPropType>(
|
||||
Component: NavigationNavigator<Options, NavigationPropType>
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
* END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
|
||||
*/
|
||||
|
||||
/**
|
||||
* BEGIN CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
export interface NavigationScreenProps<
|
||||
Params = NavigationParams,
|
||||
Options = any
|
||||
> {
|
||||
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
|
||||
screenProps?: ScreenProps;
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
}
|
||||
|
||||
/**
|
||||
* END CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
export type InferProps<
|
||||
@@ -838,6 +868,11 @@ declare module 'react-navigation' {
|
||||
isLandscape: boolean;
|
||||
}
|
||||
|
||||
export function createKeyboardAwareNavigator<Props>(
|
||||
Comp: React.ComponentType<Props>,
|
||||
stackConfig: object
|
||||
): React.ComponentType<Props>;
|
||||
|
||||
export function withOrientation<P extends NavigationOrientationInjectedProps>(
|
||||
Component: React.ComponentType<P>
|
||||
): React.ComponentType<Omit<P, keyof NavigationOrientationInjectedProps>>;
|
||||
@@ -869,6 +904,10 @@ declare module 'react-navigation' {
|
||||
T & { onRef?: React.Ref<React.Component<T & NavigationInjectedProps<P>>> }
|
||||
>;
|
||||
|
||||
export const NavigationProvider: React.ComponentType<{
|
||||
value: NavigationProp<any>;
|
||||
}>;
|
||||
|
||||
export interface NavigationFocusInjectedProps<P = NavigationParams>
|
||||
extends NavigationInjectedProps<P> {
|
||||
isFocused: boolean;
|
||||
@@ -921,17 +960,22 @@ declare module 'react-navigation' {
|
||||
NavigationScreenProp<NavigationRoute>
|
||||
>;
|
||||
|
||||
export function createKeyboardAwareNavigator<Props>(
|
||||
Comp: React.ComponentType<Props>,
|
||||
stackConfig: object
|
||||
): React.ComponentType<Props>;
|
||||
|
||||
/**
|
||||
* SceneView
|
||||
*/
|
||||
|
||||
export interface SceneViewProps {
|
||||
component: React.ComponentType;
|
||||
screenProps: ScreenProps;
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
screenProps: unknown;
|
||||
navigation: NavigationProp<any>;
|
||||
}
|
||||
|
||||
export class SceneView extends React.Component {}
|
||||
export const SceneView: React.ComponentType<SceneViewProps>;
|
||||
|
||||
/**
|
||||
* Themes
|
||||
|
||||
Reference in New Issue
Block a user