mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-14 22:41:55 +08:00
Compare commits
9 Commits
react-navi
...
react-navi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d3f092cb84 | ||
|
|
f5a3880969 | ||
|
|
06f43549db | ||
|
|
741f38a028 | ||
|
|
3bb2c196e4 | ||
|
|
77db2eaf62 | ||
|
|
fc24ebd16c | ||
|
|
41e1272507 | ||
|
|
7ad6de59cb |
@@ -20,6 +20,7 @@
|
||||
"lint": "eslint --ext '.js,.ts,.tsx' .",
|
||||
"typescript": "tsc --noEmit",
|
||||
"test": "jest",
|
||||
"prerelease": "yarn lerna run clean",
|
||||
"release": "yarn lerna publish",
|
||||
"example": "yarn --cwd example"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [0.5.2](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.1...react-navigation-animated-switch@0.5.2) (2020-02-26)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-animated-switch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [0.5.1](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.0...react-navigation-animated-switch@0.5.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-animated-switch
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 0.5.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-animated-switch",
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.2",
|
||||
"description": "Animated switch for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "lib/module/index.js",
|
||||
@@ -28,7 +28,7 @@
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.61.5",
|
||||
"react-native-reanimated": "~1.7.0",
|
||||
"react-navigation": "^4.2.0",
|
||||
"react-navigation": "^4.2.2",
|
||||
"typescript": "~3.7.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
13
packages/core/.eslintrc.json
Normal file
13
packages/core/.eslintrc.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"settings": {
|
||||
"import/extensions": [".js", ".ts", ".tsx"],
|
||||
"import/parsers": {
|
||||
"@typescript-eslint/parser": [".ts", ".tsx"]
|
||||
},
|
||||
"import/resolver": {
|
||||
"node": {
|
||||
"extensions": [".js", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [3.6.1](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.6.0...@react-navigation/core@3.6.1) (2020-02-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix file extensions. closes [#7246](https://github.com/react-navigation/react-navigation-core/issues/7246) ([fc24ebd](https://github.com/react-navigation/react-navigation-core/commit/fc24ebd16c1010be4caaf3ead705909f283532f4))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 3.6.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-navigation/core",
|
||||
"version": "3.6.0",
|
||||
"version": "3.6.1",
|
||||
"description": "Core utilities for the react-navigation framework",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "lib/module/index.js",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import invariant from './utils/invariant.ts';
|
||||
import invariant from './utils/invariant';
|
||||
|
||||
/**
|
||||
* Utilities to perform atomic operation with navigate state and routes.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as NavigationActions from '../NavigationActions.ts';
|
||||
import * as NavigationActions from '../NavigationActions';
|
||||
|
||||
describe('generic navigation actions', () => {
|
||||
const params = { foo: 'bar' };
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import getChildEventSubscriber from './getChildEventSubscriber';
|
||||
import getChildRouter from './getChildRouter.ts';
|
||||
import getNavigationActionCreators from './routers/getNavigationActionCreators.ts';
|
||||
import getChildRouter from './getChildRouter';
|
||||
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
||||
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
||||
|
||||
const createParamGetter = route => (paramName, defaultValue) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import getNavigationActionCreators from './routers/getNavigationActionCreators.ts';
|
||||
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
||||
import getChildNavigation from './getChildNavigation';
|
||||
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import ThemeContext from '../views/ThemeContext.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
import ThemeContext from '../views/ThemeContext';
|
||||
|
||||
function createNavigator(NavigatorView, router, navigationConfig) {
|
||||
class Navigator extends React.Component {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import * as NavigationActions from '../NavigationActions.ts';
|
||||
import * as NavigationActions from '../NavigationActions';
|
||||
import * as StackActions from './StackActions';
|
||||
import createConfigGetter from './createConfigGetter';
|
||||
import getScreenForRouteName from './getScreenForRouteName';
|
||||
import StateUtils from '../StateUtils';
|
||||
import validateRouteConfigMap from './validateRouteConfigMap';
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import { generateKey } from './KeyGenerator.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
import { generateKey } from './KeyGenerator';
|
||||
import { createPathParser } from './pathUtils';
|
||||
|
||||
function behavesLikePushAction(action) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
import getScreenForRouteName from './getScreenForRouteName';
|
||||
import createConfigGetter from './createConfigGetter';
|
||||
|
||||
import * as NavigationActions from '../NavigationActions.ts';
|
||||
import * as SwitchActions from './SwitchActions.ts';
|
||||
import * as NavigationActions from '../NavigationActions';
|
||||
import * as SwitchActions from './SwitchActions';
|
||||
import * as StackActions from './StackActions';
|
||||
import validateRouteConfigMap from './validateRouteConfigMap';
|
||||
import { createPathParser } from './pathUtils';
|
||||
|
||||
@@ -5,8 +5,8 @@ import React from 'react';
|
||||
import SwitchRouter from '../SwitchRouter';
|
||||
import StackRouter from '../StackRouter';
|
||||
import TabRouter from '../TabRouter';
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||
|
||||
beforeEach(() => {
|
||||
_TESTING_ONLY_normalize_keys();
|
||||
|
||||
@@ -6,9 +6,9 @@ import StackRouter from '../StackRouter';
|
||||
import TabRouter from '../TabRouter';
|
||||
import SwitchRouter from '../SwitchRouter';
|
||||
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
import * as StackActions from '../StackActions';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||
|
||||
beforeEach(() => {
|
||||
_TESTING_ONLY_normalize_keys();
|
||||
|
||||
@@ -4,8 +4,8 @@ import React from 'react';
|
||||
|
||||
import StackRouter from '../StackRouter';
|
||||
import * as StackActions from '../StackActions';
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||
|
||||
beforeEach(() => {
|
||||
_TESTING_ONLY_normalize_keys();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import React from 'react';
|
||||
import SwitchRouter from '../SwitchRouter';
|
||||
import StackRouter from '../StackRouter';
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
import { getRouterTestHelper } from './routerTestHelper';
|
||||
|
||||
describe('SwitchRouter', () => {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import React from 'react';
|
||||
import TabRouter from '../TabRouter';
|
||||
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
|
||||
const INIT_ACTION = { type: NavigationActions.INIT };
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as NavigationActions from '../../NavigationActions.ts';
|
||||
import * as SwitchActions from '../../routers/SwitchActions.ts';
|
||||
import * as NavigationActions from '../../NavigationActions';
|
||||
import * as SwitchActions from '../../routers/SwitchActions';
|
||||
import * as StackActions from '../../routers/StackActions';
|
||||
|
||||
// A simple helper that makes it easier to write basic routing tests
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
|
||||
import getScreenForRouteName from './getScreenForRouteName';
|
||||
import validateScreenOptions from './validateScreenOptions';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isValidElementType } from 'react-is';
|
||||
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
|
||||
/**
|
||||
* Simple helper that gets a single screen (React component or navigator)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
import pathToRegexp, { compile } from 'path-to-regexp';
|
||||
import * as NavigationActions from '../NavigationActions.ts';
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import * as NavigationActions from '../NavigationActions';
|
||||
import invariant from '../utils/invariant';
|
||||
|
||||
const queryString = require('query-string');
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isValidElementType } from 'react-is';
|
||||
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
|
||||
/**
|
||||
* Make sure the config passed e.g. to StackRouter, TabRouter has
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import NavigationContext from './NavigationContext.ts';
|
||||
import NavigationContext from './NavigationContext';
|
||||
|
||||
export default class SceneView extends React.PureComponent {
|
||||
render() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import NavigationEvents from '../NavigationEvents';
|
||||
import NavigationContext from '../NavigationContext.ts';
|
||||
import NavigationContext from '../NavigationContext';
|
||||
|
||||
const createPropListener = () => jest.fn();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import hoistStatics from 'hoist-non-react-statics';
|
||||
import invariant from '../utils/invariant.ts';
|
||||
import NavigationContext from './NavigationContext.ts';
|
||||
import invariant from '../utils/invariant';
|
||||
import NavigationContext from './NavigationContext';
|
||||
|
||||
export default function withNavigation(
|
||||
Component,
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.4.2](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.1...react-navigation-drawer@2.4.2) (2020-02-26)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-drawer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.4.1](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.0...react-navigation-drawer@2.4.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-drawer
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.4.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-drawer",
|
||||
"version": "2.4.0",
|
||||
"version": "2.4.2",
|
||||
"description": "Drawer navigator component for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "lib/module/index.js",
|
||||
@@ -49,7 +49,7 @@
|
||||
"react-native-reanimated": "^1.2.0",
|
||||
"react-native-screens": "^2.0.0-beta.10",
|
||||
"react-native-testing-library": "^1.12.0",
|
||||
"react-navigation": "^4.2.0",
|
||||
"react-navigation": "^4.2.2",
|
||||
"typescript": "~3.7.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.2.2](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.1...react-navigation-material-bottom-tabs@2.2.2) (2020-02-26)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.1](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.0...react-navigation-material-bottom-tabs@2.2.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.2.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-material-bottom-tabs",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.2",
|
||||
"description": "Material Bottom Tab Navigation component for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"module": "lib/module/index.js",
|
||||
@@ -48,7 +48,7 @@
|
||||
"react-native-gesture-handler": "^1.6.0",
|
||||
"react-native-paper": "^3.1.1",
|
||||
"react-native-reanimated": "^1.2.0",
|
||||
"react-navigation": "^4.2.0",
|
||||
"react-navigation": "^4.2.2",
|
||||
"typescript": "~3.7.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [3.7.3](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.0...@react-navigation/native@3.7.3) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/native
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 3.7.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-navigation/native",
|
||||
"version": "3.7.0",
|
||||
"version": "3.7.3",
|
||||
"description": "React Native support for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"react-native": "lib/module/index.js",
|
||||
@@ -9,6 +9,10 @@
|
||||
"src",
|
||||
"lib"
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "bob build",
|
||||
"clean": "del lib"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
@@ -34,7 +38,8 @@
|
||||
"react-native-safe-area-view": "^0.14.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/core": "^3.6.0",
|
||||
"@react-native-community/bob": "^0.9.7",
|
||||
"@react-navigation/core": "^3.6.1",
|
||||
"@types/react-test-renderer": "^16.9.2",
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "~16.9.0",
|
||||
|
||||
@@ -3,6 +3,25 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [4.2.2](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.1...react-navigation@4.2.2) (2020-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix typescript errors in the definition file ([3bb2c19](https://github.com/react-navigation/react-navigation/commit/3bb2c196e4acfa069791003c2b448b5ab51004d2))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [4.2.1](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.0...react-navigation@4.2.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 4.2.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation",
|
||||
"version": "4.2.0",
|
||||
"version": "4.2.2",
|
||||
"description": "Routing and navigation for your React Native apps",
|
||||
"main": "src/index.js",
|
||||
"types": "typescript/react-navigation.d.ts",
|
||||
@@ -24,8 +24,8 @@
|
||||
"react-native": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/core": "^3.6.0",
|
||||
"@react-navigation/native": "^3.7.0"
|
||||
"@react-navigation/core": "^3.6.1",
|
||||
"@react-navigation/native": "^3.7.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^16.9.22",
|
||||
|
||||
@@ -690,21 +690,21 @@ export function createSwitchNavigator(
|
||||
* NavigationActions
|
||||
*/
|
||||
export namespace NavigationActions {
|
||||
declare const BACK: 'Navigation/BACK';
|
||||
declare const INIT: 'Navigation/INIT';
|
||||
declare const NAVIGATE: 'Navigation/NAVIGATE';
|
||||
declare const SET_PARAMS: 'Navigation/SET_PARAMS';
|
||||
export const BACK: 'Navigation/BACK';
|
||||
export const INIT: 'Navigation/INIT';
|
||||
export const NAVIGATE: 'Navigation/NAVIGATE';
|
||||
export const SET_PARAMS: 'Navigation/SET_PARAMS';
|
||||
|
||||
declare function init(
|
||||
export function init(
|
||||
options?: NavigationInitActionPayload
|
||||
): NavigationInitAction;
|
||||
declare function navigate(
|
||||
export function navigate(
|
||||
options: NavigationNavigateActionPayload
|
||||
): NavigationNavigateAction;
|
||||
declare function back(
|
||||
export function back(
|
||||
options?: NavigationBackActionPayload
|
||||
): NavigationBackAction;
|
||||
declare function setParams(
|
||||
export function setParams(
|
||||
options: NavigationSetParamsActionPayload
|
||||
): NavigationSetParamsAction;
|
||||
}
|
||||
@@ -713,45 +713,43 @@ export namespace NavigationActions {
|
||||
* DrawerActions
|
||||
*/
|
||||
export namespace DrawerActions {
|
||||
declare const OPEN_DRAWER: 'Navigation/OPEN_DRAWER';
|
||||
declare const CLOSE_DRAWER: 'Navigation/CLOSE_DRAWER';
|
||||
declare const TOGGLE_DRAWER: 'Navigation/TOGGLE_DRAWER';
|
||||
export const OPEN_DRAWER: 'Navigation/OPEN_DRAWER';
|
||||
export const CLOSE_DRAWER: 'Navigation/CLOSE_DRAWER';
|
||||
export const TOGGLE_DRAWER: 'Navigation/TOGGLE_DRAWER';
|
||||
|
||||
declare function openDrawer(): NavigationOpenDrawerAction;
|
||||
declare function closeDrawer(): NavigationCloseDrawerAction;
|
||||
declare function toggleDrawer(): NavigationToggleDrawerAction;
|
||||
export function openDrawer(): NavigationOpenDrawerAction;
|
||||
export function closeDrawer(): NavigationCloseDrawerAction;
|
||||
export function toggleDrawer(): NavigationToggleDrawerAction;
|
||||
}
|
||||
|
||||
/**
|
||||
* StackActions
|
||||
*/
|
||||
export namespace StackActions {
|
||||
declare const POP: 'Navigation/POP';
|
||||
declare const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
||||
declare const PUSH: 'Navigation/PUSH';
|
||||
declare const RESET: 'Navigation/RESET';
|
||||
declare const REPLACE: 'Navigation/REPLACE';
|
||||
declare const COMPLETE_TRANSITION: 'Navigation/COMPLETE_TRANSITION';
|
||||
export const POP: 'Navigation/POP';
|
||||
export const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
||||
export const PUSH: 'Navigation/PUSH';
|
||||
export const RESET: 'Navigation/RESET';
|
||||
export const REPLACE: 'Navigation/REPLACE';
|
||||
export const COMPLETE_TRANSITION: 'Navigation/COMPLETE_TRANSITION';
|
||||
|
||||
declare function pop(
|
||||
options: NavigationPopActionPayload
|
||||
): NavigationPopAction;
|
||||
declare function popToTop(
|
||||
export function pop(options: NavigationPopActionPayload): NavigationPopAction;
|
||||
export function popToTop(
|
||||
options?: NavigationPopToTopActionPayload
|
||||
): NavigationPopToTopAction;
|
||||
|
||||
declare function push(
|
||||
export function push(
|
||||
options: NavigationPushActionPayload
|
||||
): NavigationPushAction;
|
||||
declare function reset(
|
||||
export function reset(
|
||||
options: NavigationResetActionPayload
|
||||
): NavigationResetAction;
|
||||
|
||||
declare function replace(
|
||||
export function replace(
|
||||
options: NavigationReplaceActionPayload
|
||||
): NavigationReplaceAction;
|
||||
|
||||
declare function completeTransition(
|
||||
export function completeTransition(
|
||||
payload?: NavigationCompleteTransitionActionPayload
|
||||
): NavigationCompleteTransitionAction;
|
||||
}
|
||||
@@ -760,9 +758,9 @@ export namespace StackActions {
|
||||
* SwitchActions
|
||||
*/
|
||||
export namespace SwitchActions {
|
||||
declare const JUMP_TO: 'Navigation/JUMP_TO';
|
||||
export const JUMP_TO: 'Navigation/JUMP_TO';
|
||||
|
||||
declare function jumpTo(
|
||||
export function jumpTo(
|
||||
options: NavigationJumpToActionPayload
|
||||
): NavigationJumpToAction;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,36 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.2.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.2...react-navigation-stack@2.2.3) (2020-03-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* dispatch completeTransition on mount so focus event is emitted ([f5a3880](https://github.com/react-navigation/react-navigation-stack/commit/f5a3880969afad2df409b0606e249b3971361dca))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.2](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.1...react-navigation-stack@2.2.2) (2020-02-26)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix typescript errors in the definition file ([3bb2c19](https://github.com/react-navigation/react-navigation-stack/commit/3bb2c196e4acfa069791003c2b448b5ab51004d2))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.2.1](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.0...react-navigation-stack@2.2.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-stack
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.2.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-stack",
|
||||
"version": "2.2.0",
|
||||
"version": "2.2.3",
|
||||
"description": "Stack navigator component for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"module": "lib/module/index.js",
|
||||
@@ -45,7 +45,7 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.9.7",
|
||||
"@react-native-community/masked-view": "^0.1.6",
|
||||
"@react-navigation/stack": "^5.0.9",
|
||||
"@react-navigation/stack": "^5.1.1",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/react": "^16.9.22",
|
||||
"@types/react-native": "^0.61.17",
|
||||
@@ -56,7 +56,7 @@
|
||||
"react-native-gesture-handler": "^1.6.0",
|
||||
"react-native-safe-area-context": "^0.7.3",
|
||||
"react-native-screens": "^2.0.0-beta.10",
|
||||
"react-navigation": "^4.2.0",
|
||||
"react-navigation": "^4.2.2",
|
||||
"react-test-renderer": "~16.9.0",
|
||||
"typescript": "~3.7.5"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/index.tsx 2020-02-24 11:58:26.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/index.tsx 2020-03-04 00:03:45.000000000 +0100
|
||||
@@ -3,11 +3,6 @@
|
||||
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
||||
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
||||
@@ -28,9 +28,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/i
|
||||
StackHeaderTitleProps,
|
||||
StackCardInterpolatedStyle,
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.000000000 +0100
|
||||
@@ -1,79 +0,0 @@
|
||||
@@ -1,81 +0,0 @@
|
||||
-import * as React from 'react';
|
||||
-import {
|
||||
- useNavigationBuilder,
|
||||
@@ -107,12 +107,14 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
|
||||
-}
|
||||
-
|
||||
-export default createNavigatorFactory<
|
||||
- StackNavigationState,
|
||||
- StackNavigationOptions,
|
||||
- StackNavigationEventMap,
|
||||
- typeof StackNavigator
|
||||
->(StackNavigator);
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/types.tsx 2020-02-24 12:05:09.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/types.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -7,13 +7,28 @@
|
||||
} from 'react-native';
|
||||
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||
@@ -256,8 +258,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
||||
|
||||
export type StackNavigationConfig = {
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/BorderlessButton.tsx src/vendor/views/BorderlessButton.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/BorderlessButton.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/BorderlessButton.tsx 2020-02-24 12:50:48.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/BorderlessButton.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/BorderlessButton.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -39,6 +39,7 @@
|
||||
const { children, style, enabled, ...rest } = this.props;
|
||||
|
||||
@@ -267,8 +269,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/BorderlessButton
|
||||
{...rest}
|
||||
onActiveStateChange={this.handleActiveStateChange}
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/Header.tsx 2020-02-24 12:48:47.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/Header.tsx 2020-03-04 00:04:05.000000000 +0100
|
||||
@@ -1,12 +1,14 @@
|
||||
import * as React from 'react';
|
||||
-import { StackActions } from '@react-navigation/native';
|
||||
@@ -306,7 +308,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
||||
|
||||
const goBack = React.useCallback(
|
||||
debounce(() => {
|
||||
- if (navigation.canGoBack()) {
|
||||
- if (navigation.isFocused() && navigation.canGoBack()) {
|
||||
- navigation.dispatch({
|
||||
- ...StackActions.pop(),
|
||||
- source: scene.route.key,
|
||||
@@ -348,8 +350,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
||||
+
|
||||
+export default Header;
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-02-24 11:58:32.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -8,9 +8,9 @@
|
||||
StyleSheet,
|
||||
LayoutChangeEvent,
|
||||
@@ -362,8 +364,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
||||
|
||||
type Props = StackHeaderLeftButtonProps;
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-02-24 11:58:32.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
|
||||
@@ -373,8 +375,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
||||
type Props = ViewProps & {
|
||||
children?: React.ReactNode;
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-02-24 12:08:14.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -1,11 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||
@@ -426,8 +428,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
||||
);
|
||||
})}
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx src/vendor/views/Header/HeaderSegment.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-02-24 11:58:32.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -8,7 +8,7 @@
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
@@ -447,8 +449,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSeg
|
||||
};
|
||||
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx src/vendor/views/Header/HeaderTitle.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-02-24 12:47:49.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from 'react';
|
||||
-import { Animated, StyleSheet, Platform, TextProps } from 'react-native';
|
||||
@@ -462,8 +464,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTit
|
||||
children?: string;
|
||||
};
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Stack/Card.tsx 2020-02-24 11:58:32.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Stack/Card.tsx 2020-03-04 00:03:48.000000000 +0100
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
private interactionHandle: number | undefined;
|
||||
@@ -483,8 +485,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx s
|
||||
<StackGestureRefContext.Provider value={this.gestureRef}>
|
||||
<CardAnimationContext.Provider value={animationContext}>
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx src/vendor/views/Stack/CardContainer.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Stack/CardContainer.tsx 2020-02-24 11:58:32.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Stack/CardContainer.tsx 2020-03-04 13:24:38.000000000 +0100
|
||||
@@ -1,10 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||
@@ -504,7 +506,33 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
||||
|
||||
type Props = TransitionPreset & {
|
||||
index: number;
|
||||
@@ -180,7 +186,7 @@
|
||||
@@ -35,6 +41,7 @@
|
||||
closing: boolean
|
||||
) => void;
|
||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||
+ onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||
onPageChangeStart?: () => void;
|
||||
onPageChangeConfirm?: () => void;
|
||||
onPageChangeCancel?: () => void;
|
||||
@@ -81,6 +88,7 @@
|
||||
layout,
|
||||
onCloseRoute,
|
||||
onOpenRoute,
|
||||
+ onTransitionComplete,
|
||||
onPageChangeCancel,
|
||||
onPageChangeConfirm,
|
||||
onPageChangeStart,
|
||||
@@ -150,6 +158,9 @@
|
||||
};
|
||||
}, [pointerEvents, scene.progress.next]);
|
||||
|
||||
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
+ React.useEffect(() => onTransitionComplete({ route: scene.route }), []);
|
||||
+
|
||||
return (
|
||||
<Card
|
||||
index={index}
|
||||
@@ -180,7 +191,7 @@
|
||||
? { marginTop: headerHeight }
|
||||
: null
|
||||
}
|
||||
@@ -514,8 +542,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
||||
>
|
||||
<View style={styles.container}>
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Stack/CardStack.tsx 2020-02-24 12:09:38.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Stack/CardStack.tsx 2020-03-04 13:31:28.000000000 +0100
|
||||
@@ -9,9 +9,8 @@
|
||||
ViewProps,
|
||||
} from 'react-native';
|
||||
@@ -535,18 +563,33 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
||||
Layout,
|
||||
StackHeaderMode,
|
||||
StackCardMode,
|
||||
@@ -103,7 +103,7 @@
|
||||
<View
|
||||
collapsable={!enabled}
|
||||
removeClippedSubviews={Platform.OS !== 'ios' && enabled}
|
||||
- style={[style, { overflow: 'hidden' }]}
|
||||
+ style={[style, { overflow: 'hidden' }] as any}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
@@ -54,6 +54,7 @@
|
||||
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
||||
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||
headerMode: StackHeaderMode;
|
||||
+ onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||
onTransitionStart: (
|
||||
props: { route: Route<string> },
|
||||
closing: boolean
|
||||
@@ -371,6 +372,7 @@
|
||||
renderHeader,
|
||||
renderScene,
|
||||
headerMode,
|
||||
+ onTransitionComplete,
|
||||
onTransitionStart,
|
||||
onTransitionEnd,
|
||||
onPageChangeStart,
|
||||
@@ -546,6 +548,7 @@
|
||||
renderScene={renderScene}
|
||||
onOpenRoute={onOpenRoute}
|
||||
onCloseRoute={onCloseRoute}
|
||||
+ onTransitionComplete={onTransitionComplete}
|
||||
onTransitionStart={onTransitionStart}
|
||||
onTransitionEnd={onTransitionEnd}
|
||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx src/vendor/views/Stack/StackView.tsx
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-02-24 11:53:26.000000000 +0100
|
||||
+++ src/vendor/views/Stack/StackView.tsx 2020-02-24 12:09:08.000000000 +0100
|
||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-03-03 23:57:02.000000000 +0100
|
||||
+++ src/vendor/views/Stack/StackView.tsx 2020-03-04 13:24:28.000000000 +0100
|
||||
@@ -4,9 +4,9 @@
|
||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||
import {
|
||||
@@ -576,7 +619,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -290,14 +292,31 @@
|
||||
@@ -290,14 +292,37 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -598,10 +641,16 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
||||
};
|
||||
|
||||
+ private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
||||
+ // TODO: remove when the new event system lands
|
||||
+ this.props.navigation.dispatch(
|
||||
+ StackActions.completeTransition({ toChildKey: route.key })
|
||||
+ );
|
||||
+ const { state, navigation } = this.props;
|
||||
+
|
||||
+ if (state.isTransitioning) {
|
||||
+ navigation.dispatch(
|
||||
+ StackActions.completeTransition({
|
||||
+ key: navigation.state.key,
|
||||
+ toChildKey: route.key,
|
||||
+ })
|
||||
+ );
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||
@@ -609,7 +658,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
||||
this.setState(state => ({
|
||||
routes: state.replacingRouteKeys.length
|
||||
? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key))
|
||||
@@ -315,12 +334,17 @@
|
||||
@@ -315,12 +340,17 @@
|
||||
// If a route exists in state, trigger a pop
|
||||
// This will happen in when the route was closed from the card component
|
||||
// e.g. When the close animation triggered from a gesture ends
|
||||
@@ -632,7 +681,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
||||
// We need to clean up any state tracking the route and pop it immediately
|
||||
this.setState(state => ({
|
||||
routes: state.routes.filter(r => r.key !== route.key),
|
||||
@@ -337,22 +361,24 @@
|
||||
@@ -337,22 +367,24 @@
|
||||
private handleTransitionStart = (
|
||||
{ route }: { route: Route<string> },
|
||||
closing: boolean
|
||||
@@ -669,3 +718,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
||||
|
||||
render() {
|
||||
const {
|
||||
@@ -391,6 +423,7 @@
|
||||
closingRouteKeys={closingRouteKeys}
|
||||
onOpenRoute={this.handleOpenRoute}
|
||||
onCloseRoute={this.handleCloseRoute}
|
||||
+ onTransitionComplete={this.handleTransitionComplete}
|
||||
onTransitionStart={this.handleTransitionStart}
|
||||
onTransitionEnd={this.handleTransitionEnd}
|
||||
renderHeader={this.renderHeader}
|
||||
|
||||
@@ -41,6 +41,7 @@ type Props = TransitionPreset & {
|
||||
closing: boolean
|
||||
) => void;
|
||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||
onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||
onPageChangeStart?: () => void;
|
||||
onPageChangeConfirm?: () => void;
|
||||
onPageChangeCancel?: () => void;
|
||||
@@ -87,6 +88,7 @@ function CardContainer({
|
||||
layout,
|
||||
onCloseRoute,
|
||||
onOpenRoute,
|
||||
onTransitionComplete,
|
||||
onPageChangeCancel,
|
||||
onPageChangeConfirm,
|
||||
onPageChangeStart,
|
||||
@@ -156,6 +158,9 @@ function CardContainer({
|
||||
};
|
||||
}, [pointerEvents, scene.progress.next]);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
React.useEffect(() => onTransitionComplete({ route: scene.route }), []);
|
||||
|
||||
return (
|
||||
<Card
|
||||
index={index}
|
||||
|
||||
@@ -54,6 +54,7 @@ type Props = {
|
||||
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
||||
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||
headerMode: StackHeaderMode;
|
||||
onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||
onTransitionStart: (
|
||||
props: { route: Route<string> },
|
||||
closing: boolean
|
||||
@@ -371,6 +372,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
renderHeader,
|
||||
renderScene,
|
||||
headerMode,
|
||||
onTransitionComplete,
|
||||
onTransitionStart,
|
||||
onTransitionEnd,
|
||||
onPageChangeStart,
|
||||
@@ -546,6 +548,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
renderScene={renderScene}
|
||||
onOpenRoute={onOpenRoute}
|
||||
onCloseRoute={onCloseRoute}
|
||||
onTransitionComplete={onTransitionComplete}
|
||||
onTransitionStart={onTransitionStart}
|
||||
onTransitionEnd={onTransitionEnd}
|
||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||
|
||||
@@ -309,10 +309,16 @@ export default class StackView extends React.Component<Props, State> {
|
||||
};
|
||||
|
||||
private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
||||
// TODO: remove when the new event system lands
|
||||
this.props.navigation.dispatch(
|
||||
StackActions.completeTransition({ toChildKey: route.key })
|
||||
);
|
||||
const { state, navigation } = this.props;
|
||||
|
||||
if (state.isTransitioning) {
|
||||
navigation.dispatch(
|
||||
StackActions.completeTransition({
|
||||
key: navigation.state.key,
|
||||
toChildKey: route.key,
|
||||
})
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||
@@ -417,6 +423,7 @@ export default class StackView extends React.Component<Props, State> {
|
||||
closingRouteKeys={closingRouteKeys}
|
||||
onOpenRoute={this.handleOpenRoute}
|
||||
onCloseRoute={this.handleCloseRoute}
|
||||
onTransitionComplete={this.handleTransitionComplete}
|
||||
onTransitionStart={this.handleTransitionStart}
|
||||
onTransitionEnd={this.handleTransitionEnd}
|
||||
renderHeader={this.renderHeader}
|
||||
|
||||
7
packages/stack/types/index.d.ts
vendored
7
packages/stack/types/index.d.ts
vendored
@@ -1,7 +0,0 @@
|
||||
declare module '*.png' {
|
||||
import { ImageSourcePropType } from 'react-native';
|
||||
|
||||
declare const value: ImageSourcePropType;
|
||||
|
||||
export default value;
|
||||
}
|
||||
@@ -3,6 +3,22 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.8.2](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.1...react-navigation-tabs@2.8.2) (2020-02-26)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [2.8.1](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.0...react-navigation-tabs@2.8.1) (2020-02-24)
|
||||
|
||||
**Note:** Version bump only for package react-navigation-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 2.8.0 (2020-02-24)
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-navigation-tabs",
|
||||
"version": "2.8.0",
|
||||
"version": "2.8.2",
|
||||
"description": "Tab Navigation components for React Navigation",
|
||||
"main": "lib/commonjs/index.js",
|
||||
"module": "lib/module/index.js",
|
||||
@@ -56,7 +56,7 @@
|
||||
"react-native-gesture-handler": "^1.6.0",
|
||||
"react-native-reanimated": "^1.2.0",
|
||||
"react-native-tab-view": "^2.13.0",
|
||||
"react-navigation": "^4.2.0",
|
||||
"react-navigation": "^4.2.2",
|
||||
"typescript": "~3.7.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"lib": ["esnext", "dom"],
|
||||
"lib": ["esnext"],
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
@@ -3036,10 +3036,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.6.tgz#c7f2ac187c1f25aa8c30d11baa8f4398eca3bb84"
|
||||
integrity sha512-PpMoeXwPUoldCRKDuSi+zK5rT+sJTW6ri6RdGPkSKRzU77Q1d9IaR0O5IKvBj0XSdL3p+dcOa05gk35aGDffBQ==
|
||||
|
||||
"@react-navigation/stack@^5.0.9":
|
||||
version "5.0.9"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.0.9.tgz#f6b0a17bf3658d406c4f8b594924c2b79b8b930d"
|
||||
integrity sha512-6cgOCvvX4N35d2y+NX36qN25w8bjsJXVoo213cXB23X6SVRSRqbAPOWE98rsHyX6REYPyJx200k7U09xiwCImg==
|
||||
"@react-navigation/stack@^5.1.1":
|
||||
version "5.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.1.1.tgz#4fff1dc3fec66d7b71cfc31691d6e83d8777d5f8"
|
||||
integrity sha512-tQV4SNESAeqViItGFT8bLrCGWxYfSjw4uXGrCokzSBOMtrdUwINwXDqo40LZt/KZOT0kVN6MdzHq57ILB1LsGA==
|
||||
dependencies:
|
||||
color "^3.1.2"
|
||||
react-native-iphone-x-helper "^1.2.1"
|
||||
|
||||
Reference in New Issue
Block a user