mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-15 22:45:41 +08:00
Compare commits
23 Commits
@react-nav
...
react-navi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5afc82b11a | ||
|
|
80c8c9d1de | ||
|
|
fd7c5ca9b2 | ||
|
|
72bbebc80e | ||
|
|
915861e601 | ||
|
|
8152ae1212 | ||
|
|
79125bfab9 | ||
|
|
44c390075f | ||
|
|
1c5e7a5ff2 | ||
|
|
cfc1bac4e1 | ||
|
|
c0fb54b5a2 | ||
|
|
5927f4287f | ||
|
|
37a664b433 | ||
|
|
8d0b61f1b7 | ||
|
|
d3f092cb84 | ||
|
|
f5a3880969 | ||
|
|
06f43549db | ||
|
|
741f38a028 | ||
|
|
3bb2c196e4 | ||
|
|
77db2eaf62 | ||
|
|
fc24ebd16c | ||
|
|
41e1272507 | ||
|
|
7ad6de59cb |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
|||||||
.idea
|
.idea
|
||||||
.expo
|
.expo
|
||||||
.gradle
|
.gradle
|
||||||
|
.history
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
"ios": "expo start --ios"
|
"ios": "expo start --ios"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.8.4",
|
"@babel/runtime": "^7.8.7",
|
||||||
"@expo/vector-icons": "^10.0.6",
|
"@expo/vector-icons": "^10.0.6",
|
||||||
"@react-native-community/masked-view": "0.1.6",
|
"@react-native-community/masked-view": "0.1.7",
|
||||||
"expo": "^36.0.0",
|
"expo": "^36.0.0",
|
||||||
"expo-asset": "~8.0.0",
|
"expo-asset": "~8.0.0",
|
||||||
"expo-barcode-scanner": "^8.0.0",
|
"expo-barcode-scanner": "^8.0.0",
|
||||||
@@ -21,16 +21,16 @@
|
|||||||
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
||||||
"react-native-gesture-handler": "~1.6.0",
|
"react-native-gesture-handler": "~1.6.0",
|
||||||
"react-native-iphone-x-helper": "^1.2.1",
|
"react-native-iphone-x-helper": "^1.2.1",
|
||||||
"react-native-maps": "0.26.1",
|
"react-native-maps": "0.27.0",
|
||||||
"react-native-paper": "^3.4.0",
|
"react-native-paper": "^3.4.0",
|
||||||
"react-native-reanimated": "~1.7.0",
|
"react-native-reanimated": "~1.7.0",
|
||||||
"react-native-safe-area-context": "0.7.3",
|
"react-native-safe-area-context": "0.7.3",
|
||||||
"react-native-screens": "2.0.0-beta.10",
|
"react-native-screens": "2.3.0",
|
||||||
"react-native-webview": "8.1.2",
|
"react-native-webview": "8.1.2",
|
||||||
"react-navigation-header-buttons": "^3.0.5"
|
"react-navigation-header-buttons": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-plugin-module-resolver": "^4.0.0",
|
"babel-plugin-module-resolver": "^4.0.0",
|
||||||
"expo-cli": "^3.13.1"
|
"expo-cli": "^3.13.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,18 +20,19 @@
|
|||||||
"lint": "eslint --ext '.js,.ts,.tsx' .",
|
"lint": "eslint --ext '.js,.ts,.tsx' .",
|
||||||
"typescript": "tsc --noEmit",
|
"typescript": "tsc --noEmit",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
|
"prerelease": "yarn lerna run clean",
|
||||||
"release": "yarn lerna publish",
|
"release": "yarn lerna publish",
|
||||||
"example": "yarn --cwd example"
|
"example": "yarn --cwd example"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
||||||
"@babel/preset-env": "^7.8.4",
|
"@babel/preset-env": "^7.8.7",
|
||||||
"@babel/preset-react": "^7.8.3",
|
"@babel/preset-react": "^7.8.3",
|
||||||
"@babel/preset-typescript": "^7.8.3",
|
"@babel/preset-typescript": "^7.8.3",
|
||||||
"@babel/runtime": "^7.8.4",
|
"@babel/runtime": "^7.8.7",
|
||||||
"@commitlint/config-conventional": "^8.3.4",
|
"@commitlint/config-conventional": "^8.3.4",
|
||||||
"@types/jest": "^25.1.2",
|
"@types/jest": "^25.1.4",
|
||||||
"commitlint": "^8.3.5",
|
"commitlint": "^8.3.5",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
|
|||||||
@@ -3,6 +3,46 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.5.5](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.4...react-navigation-animated-switch@0.5.5) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.4](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.3...react-navigation-animated-switch@0.5.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.3](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.2...react-navigation-animated-switch@0.5.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 0.5.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-animated-switch",
|
"name": "react-navigation-animated-switch",
|
||||||
"version": "0.5.0",
|
"version": "0.5.5",
|
||||||
"description": "Animated switch for React Navigation",
|
"description": "Animated switch for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "0.9.7",
|
"@react-native-community/bob": "0.10.0",
|
||||||
"@types/react": "16.9.22",
|
"@types/react": "16.9.23",
|
||||||
"@types/react-native": "0.61.17",
|
"@types/react-native": "0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-reanimated": "~1.7.0",
|
"react-native-reanimated": "~1.7.0",
|
||||||
"react-navigation": "^4.2.0",
|
"react-navigation": "^4.3.2",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"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,28 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [3.7.0](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.6.1...@react-navigation/core@3.7.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation-core/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 3.6.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/core",
|
"name": "@react-navigation/core",
|
||||||
"version": "3.6.0",
|
"version": "3.7.0",
|
||||||
"description": "Core utilities for the react-navigation framework",
|
"description": "Core utilities for the react-navigation framework",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -36,11 +36,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
"hoist-non-react-statics": "^3.3.2",
|
||||||
"path-to-regexp": "^1.8.0",
|
"path-to-regexp": "^1.8.0",
|
||||||
"query-string": "^6.11.0",
|
"query-string": "^6.11.1",
|
||||||
"react-is": "^16.8.6"
|
"react-is": "^16.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
|
|||||||
@@ -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.
|
* 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', () => {
|
describe('generic navigation actions', () => {
|
||||||
const params = { foo: 'bar' };
|
const params = { foo: 'bar' };
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import getChildEventSubscriber from './getChildEventSubscriber';
|
import getChildEventSubscriber from './getChildEventSubscriber';
|
||||||
import getChildRouter from './getChildRouter.ts';
|
import getChildRouter from './getChildRouter';
|
||||||
import getNavigationActionCreators from './routers/getNavigationActionCreators.ts';
|
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
||||||
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
||||||
|
|
||||||
const createParamGetter = route => (paramName, defaultValue) => {
|
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 getChildNavigation from './getChildNavigation';
|
||||||
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import invariant from '../utils/invariant.ts';
|
import invariant from '../utils/invariant';
|
||||||
import ThemeContext from '../views/ThemeContext.ts';
|
import ThemeContext from '../views/ThemeContext';
|
||||||
|
|
||||||
function createNavigator(NavigatorView, router, navigationConfig) {
|
function createNavigator(NavigatorView, router, navigationConfig) {
|
||||||
class Navigator extends React.Component {
|
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 * as StackActions from './StackActions';
|
||||||
import createConfigGetter from './createConfigGetter';
|
import createConfigGetter from './createConfigGetter';
|
||||||
import getScreenForRouteName from './getScreenForRouteName';
|
import getScreenForRouteName from './getScreenForRouteName';
|
||||||
import StateUtils from '../StateUtils';
|
import StateUtils from '../StateUtils';
|
||||||
import validateRouteConfigMap from './validateRouteConfigMap';
|
import validateRouteConfigMap from './validateRouteConfigMap';
|
||||||
import invariant from '../utils/invariant.ts';
|
import invariant from '../utils/invariant';
|
||||||
import { generateKey } from './KeyGenerator.ts';
|
import { generateKey } from './KeyGenerator';
|
||||||
import { createPathParser } from './pathUtils';
|
import { createPathParser } from './pathUtils';
|
||||||
|
|
||||||
function behavesLikePushAction(action) {
|
function behavesLikePushAction(action) {
|
||||||
@@ -532,24 +532,43 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
action.type === NavigationActions.BACK ||
|
action.type === NavigationActions.BACK ||
|
||||||
action.type === StackActions.POP
|
action.type === StackActions.POP
|
||||||
) {
|
) {
|
||||||
const { key, n, immediate } = action;
|
const { key, n, immediate, prune } = action;
|
||||||
let backRouteIndex = state.index;
|
|
||||||
if (action.type === StackActions.POP && n != null) {
|
|
||||||
// determine the index to go back *from*. In this case, n=1 means to go
|
|
||||||
// back from state.index, as if it were a normal "BACK" action
|
|
||||||
backRouteIndex = Math.max(1, state.index - n + 1);
|
|
||||||
} else if (key) {
|
|
||||||
const backRoute = state.routes.find(route => route.key === key);
|
|
||||||
backRouteIndex = state.routes.indexOf(backRoute);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backRouteIndex > 0) {
|
if (action.type === StackActions.POP && prune === false && key) {
|
||||||
return {
|
const index = state.routes.findIndex(r => r.key === key);
|
||||||
...state,
|
const count = Math.max(index - (n == null ? 1 : n) + 1, 1);
|
||||||
routes: state.routes.slice(0, backRouteIndex),
|
const routes = state.routes
|
||||||
index: backRouteIndex - 1,
|
.slice(0, count)
|
||||||
isTransitioning: immediate !== true,
|
.concat(state.routes.slice(index + 1));
|
||||||
};
|
|
||||||
|
if (routes.length) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
routes,
|
||||||
|
index: routes.length - 1,
|
||||||
|
isTransitioning: immediate !== true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let backRouteIndex = state.index;
|
||||||
|
|
||||||
|
if (action.type === StackActions.POP && n != null) {
|
||||||
|
// determine the index to go back *from*. In this case, n=1 means to go
|
||||||
|
// back from state.index, as if it were a normal "BACK" action
|
||||||
|
backRouteIndex = Math.max(1, state.index - n + 1);
|
||||||
|
} else if (key) {
|
||||||
|
const backRoute = state.routes.find(route => route.key === key);
|
||||||
|
backRouteIndex = state.routes.indexOf(backRoute);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backRouteIndex > 0) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
routes: state.routes.slice(0, backRouteIndex),
|
||||||
|
index: backRouteIndex - 1,
|
||||||
|
isTransitioning: immediate !== true,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import invariant from '../utils/invariant.ts';
|
import invariant from '../utils/invariant';
|
||||||
import getScreenForRouteName from './getScreenForRouteName';
|
import getScreenForRouteName from './getScreenForRouteName';
|
||||||
import createConfigGetter from './createConfigGetter';
|
import createConfigGetter from './createConfigGetter';
|
||||||
|
|
||||||
import * as NavigationActions from '../NavigationActions.ts';
|
import * as NavigationActions from '../NavigationActions';
|
||||||
import * as SwitchActions from './SwitchActions.ts';
|
import * as SwitchActions from './SwitchActions';
|
||||||
import * as StackActions from './StackActions';
|
import * as StackActions from './StackActions';
|
||||||
import validateRouteConfigMap from './validateRouteConfigMap';
|
import validateRouteConfigMap from './validateRouteConfigMap';
|
||||||
import { createPathParser } from './pathUtils';
|
import { createPathParser } from './pathUtils';
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import React from 'react';
|
|||||||
import SwitchRouter from '../SwitchRouter';
|
import SwitchRouter from '../SwitchRouter';
|
||||||
import StackRouter from '../StackRouter';
|
import StackRouter from '../StackRouter';
|
||||||
import TabRouter from '../TabRouter';
|
import TabRouter from '../TabRouter';
|
||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
_TESTING_ONLY_normalize_keys();
|
_TESTING_ONLY_normalize_keys();
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import StackRouter from '../StackRouter';
|
|||||||
import TabRouter from '../TabRouter';
|
import TabRouter from '../TabRouter';
|
||||||
import SwitchRouter from '../SwitchRouter';
|
import SwitchRouter from '../SwitchRouter';
|
||||||
|
|
||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
import * as StackActions from '../StackActions';
|
import * as StackActions from '../StackActions';
|
||||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
_TESTING_ONLY_normalize_keys();
|
_TESTING_ONLY_normalize_keys();
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import React from 'react';
|
|||||||
|
|
||||||
import StackRouter from '../StackRouter';
|
import StackRouter from '../StackRouter';
|
||||||
import * as StackActions from '../StackActions';
|
import * as StackActions from '../StackActions';
|
||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator.ts';
|
import { _TESTING_ONLY_normalize_keys } from '../KeyGenerator';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
_TESTING_ONLY_normalize_keys();
|
_TESTING_ONLY_normalize_keys();
|
||||||
@@ -562,6 +562,31 @@ describe('StackRouter', () => {
|
|||||||
expect(poppedState3.routes.length).toBe(1);
|
expect(poppedState3.routes.length).toBe(1);
|
||||||
expect(poppedState3.index).toBe(0);
|
expect(poppedState3.index).toBe(0);
|
||||||
expect(poppedState3.isTransitioning).toBe(true);
|
expect(poppedState3.isTransitioning).toBe(true);
|
||||||
|
|
||||||
|
const poppedState4 = TestRouter.getStateForAction(
|
||||||
|
StackActions.pop({ key: 'C', prune: false, immediate: true }),
|
||||||
|
state
|
||||||
|
);
|
||||||
|
expect(poppedState4.routes.length).toBe(3);
|
||||||
|
expect(poppedState4.index).toBe(2);
|
||||||
|
expect(poppedState4.isTransitioning).toBe(false);
|
||||||
|
expect(poppedState4.routes).toEqual([
|
||||||
|
{ key: 'A', routeName: 'foo' },
|
||||||
|
{ key: 'B', routeName: 'bar', params: { bazId: '321' } },
|
||||||
|
{ key: 'D', routeName: 'bar' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const poppedState5 = TestRouter.getStateForAction(
|
||||||
|
StackActions.pop({ n: 2, key: 'C', prune: false }),
|
||||||
|
state
|
||||||
|
);
|
||||||
|
expect(poppedState5.routes.length).toBe(2);
|
||||||
|
expect(poppedState5.index).toBe(1);
|
||||||
|
expect(poppedState5.isTransitioning).toBe(true);
|
||||||
|
expect(poppedState5.routes).toEqual([
|
||||||
|
{ key: 'A', routeName: 'foo' },
|
||||||
|
{ key: 'D', routeName: 'bar' },
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('popToTop works as expected', () => {
|
it('popToTop works as expected', () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import SwitchRouter from '../SwitchRouter';
|
import SwitchRouter from '../SwitchRouter';
|
||||||
import StackRouter from '../StackRouter';
|
import StackRouter from '../StackRouter';
|
||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
import { getRouterTestHelper } from './routerTestHelper';
|
import { getRouterTestHelper } from './routerTestHelper';
|
||||||
|
|
||||||
describe('SwitchRouter', () => {
|
describe('SwitchRouter', () => {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import TabRouter from '../TabRouter';
|
import TabRouter from '../TabRouter';
|
||||||
|
|
||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
|
|
||||||
const INIT_ACTION = { type: NavigationActions.INIT };
|
const INIT_ACTION = { type: NavigationActions.INIT };
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as NavigationActions from '../../NavigationActions.ts';
|
import * as NavigationActions from '../../NavigationActions';
|
||||||
import * as SwitchActions from '../../routers/SwitchActions.ts';
|
import * as SwitchActions from '../../routers/SwitchActions';
|
||||||
import * as StackActions from '../../routers/StackActions';
|
import * as StackActions from '../../routers/StackActions';
|
||||||
|
|
||||||
// A simple helper that makes it easier to write basic routing tests
|
// 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 getScreenForRouteName from './getScreenForRouteName';
|
||||||
import validateScreenOptions from './validateScreenOptions';
|
import validateScreenOptions from './validateScreenOptions';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { isValidElementType } from 'react-is';
|
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)
|
* Simple helper that gets a single screen (React component or navigator)
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable import/no-commonjs */
|
/* eslint-disable import/no-commonjs */
|
||||||
|
|
||||||
import pathToRegexp, { compile } from 'path-to-regexp';
|
import pathToRegexp, { compile } from 'path-to-regexp';
|
||||||
import * as NavigationActions from '../NavigationActions.ts';
|
import * as NavigationActions from '../NavigationActions';
|
||||||
import invariant from '../utils/invariant.ts';
|
import invariant from '../utils/invariant';
|
||||||
|
|
||||||
const queryString = require('query-string');
|
const queryString = require('query-string');
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { isValidElementType } from 'react-is';
|
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
|
* Make sure the config passed e.g. to StackRouter, TabRouter has
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import NavigationContext from './NavigationContext.ts';
|
import NavigationContext from './NavigationContext';
|
||||||
|
|
||||||
export default class SceneView extends React.PureComponent {
|
export default class SceneView extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
import NavigationEvents from '../NavigationEvents';
|
import NavigationEvents from '../NavigationEvents';
|
||||||
import NavigationContext from '../NavigationContext.ts';
|
import NavigationContext from '../NavigationContext';
|
||||||
|
|
||||||
const createPropListener = () => jest.fn();
|
const createPropListener = () => jest.fn();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import hoistStatics from 'hoist-non-react-statics';
|
import hoistStatics from 'hoist-non-react-statics';
|
||||||
import invariant from '../utils/invariant.ts';
|
import invariant from '../utils/invariant';
|
||||||
import NavigationContext from './NavigationContext.ts';
|
import NavigationContext from './NavigationContext';
|
||||||
|
|
||||||
export default function withNavigation(
|
export default function withNavigation(
|
||||||
Component,
|
Component,
|
||||||
|
|||||||
@@ -3,6 +3,57 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.4.6](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.5...react-navigation-drawer@2.4.6) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.5](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.4...react-navigation-drawer@2.4.5) (2020-03-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't use react-native-screens on web ([44c3900](https://github.com/react-navigation/drawer/commit/44c390075f7b76664e09fd9a1a7926645133ebec)), closes [#7485](https://github.com/react-navigation/drawer/issues/7485)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.4](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.3...react-navigation-drawer@2.4.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.3](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.2...react-navigation-drawer@2.4.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 2.4.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-drawer",
|
"name": "react-navigation-drawer",
|
||||||
"version": "2.4.0",
|
"version": "2.4.6",
|
||||||
"description": "Drawer navigator component for React Navigation",
|
"description": "Drawer navigator component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -38,18 +38,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/react-navigation/drawer#readme",
|
"homepage": "https://github.com/react-navigation/drawer#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-lifecycles-compat": "^3.0.4",
|
"react-lifecycles-compat": "^3.0.4",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
"react-native-screens": "^2.3.0",
|
||||||
"react-native-testing-library": "^1.12.0",
|
"react-native-testing-library": "^1.12.0",
|
||||||
"react-navigation": "^4.2.0",
|
"react-navigation": "^4.3.2",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.0.12",
|
"react-native-gesture-handler": "^1.0.12",
|
||||||
"react-native-reanimated": "^1.0.0",
|
"react-native-reanimated": "^1.0.0",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Platform, StyleSheet, View } from 'react-native';
|
import { Platform, StyleSheet, View } from 'react-native';
|
||||||
import { Screen, screensEnabled } from 'react-native-screens';
|
import { Screen, screensEnabled } from 'react-native-screens';
|
||||||
@@ -10,21 +8,29 @@ type Props = {
|
|||||||
style?: any;
|
style?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whole view out of its container
|
const FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container
|
||||||
|
|
||||||
export default class ResourceSavingScene extends React.Component<Props> {
|
export default class ResourceSavingScene extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
if (screensEnabled?.()) {
|
// react-native-screens is buggy on web
|
||||||
|
if (screensEnabled?.() && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isVisible, children, style, ...rest } = this.props;
|
const { isVisible, children, style, ...rest } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.container, style]}
|
style={[
|
||||||
|
styles.container,
|
||||||
|
Platform.OS === 'web'
|
||||||
|
? { display: isVisible ? 'flex' : 'none' }
|
||||||
|
: null,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
collapsable={false}
|
collapsable={false}
|
||||||
removeClippedSubviews={
|
removeClippedSubviews={
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
|
|||||||
@@ -3,6 +3,46 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.2.5](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.4...react-navigation-material-bottom-tabs@2.2.5) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.2.4](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.3...react-navigation-material-bottom-tabs@2.2.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.2.3](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.2...react-navigation-material-bottom-tabs@2.2.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 2.2.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-material-bottom-tabs",
|
"name": "react-navigation-material-bottom-tabs",
|
||||||
"version": "2.2.0",
|
"version": "2.2.5",
|
||||||
"description": "Material Bottom Tab Navigation component for React Navigation",
|
"description": "Material Bottom Tab Navigation component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -38,17 +38,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/react-navigation/react-navigation-material-bottom-tabs#readme",
|
"homepage": "https://github.com/react-navigation/react-navigation-material-bottom-tabs#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/hoist-non-react-statics": "^3.3.1",
|
"@types/hoist-non-react-statics": "^3.3.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-paper": "^3.1.1",
|
"react-native-paper": "^3.1.1",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-navigation": "^4.2.0",
|
"react-navigation": "^4.3.2",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [3.7.6](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.5...@react-navigation/native@3.7.6) (2020-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't mix import and module.exports. closes [#7660](https://github.com/react-navigation/react-navigation-native/issues/7660) ([80c8c9d](https://github.com/react-navigation/react-navigation-native/commit/80c8c9d1dead57eab3b977a1eebf1e9f5f35cd1a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.7.5](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.4...@react-navigation/native@3.7.5) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* downgrade react-native-safe-area-view ([cfc1bac](https://github.com/react-navigation/react-navigation-native/commit/cfc1bac4e153db4a4ba3f2a9033f77b53367fcbc)), closes [#7813](https://github.com/react-navigation/react-navigation-native/issues/7813)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.7.4](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.3...@react-navigation/native@3.7.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 3.7.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/native",
|
"name": "@react-navigation/native",
|
||||||
"version": "3.7.0",
|
"version": "3.7.6",
|
||||||
"description": "React Native support for React Navigation",
|
"description": "React Native support for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -9,6 +9,10 @@
|
|||||||
"src",
|
"src",
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
|
"scripts": {
|
||||||
|
"prepare": "bob build",
|
||||||
|
"clean": "del lib"
|
||||||
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@@ -34,13 +38,13 @@
|
|||||||
"react-native-safe-area-view": "^0.14.8"
|
"react-native-safe-area-view": "^0.14.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/core": "^3.6.0",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
|
"@react-navigation/core": "^3.7.0",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
|
||||||
"react-test-renderer": "^16.9.2"
|
"react-test-renderer": "^16.9.2"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -68,9 +68,8 @@ const WrappedSectionList = React.forwardRef((props, ref) => (
|
|||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
export {
|
||||||
module.exports = {
|
WrappedScrollView as ScrollView,
|
||||||
ScrollView: WrappedScrollView,
|
WrappedFlatList as FlatList,
|
||||||
FlatList: WrappedFlatList,
|
WrappedSectionList as SectionList,
|
||||||
SectionList: WrappedSectionList,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function invariant(condition, format, a, b, c, d, e, f) {
|
export default function invariant(condition, format, a, b, c, d, e, f) {
|
||||||
validateFormat(format);
|
validateFormat(format);
|
||||||
|
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
@@ -43,6 +43,3 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
|
||||||
module.exports = invariant;
|
|
||||||
|
|||||||
@@ -3,6 +3,52 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [4.3.2](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.1...react-navigation@4.3.2) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [4.3.1](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.0...react-navigation@4.3.1) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [4.3.0](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.2...react-navigation@4.3.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 4.2.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation",
|
"name": "react-navigation",
|
||||||
"version": "4.2.0",
|
"version": "4.3.2",
|
||||||
"description": "Routing and navigation for your React Native apps",
|
"description": "Routing and navigation for your React Native apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"types": "typescript/react-navigation.d.ts",
|
"types": "typescript/react-navigation.d.ts",
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^3.6.0",
|
"@react-navigation/core": "^3.7.0",
|
||||||
"@react-navigation/native": "^3.7.0"
|
"@react-navigation/native": "^3.7.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ export interface NavigationPopActionPayload {
|
|||||||
// n: the number of routes to pop of the stack
|
// n: the number of routes to pop of the stack
|
||||||
n?: number;
|
n?: number;
|
||||||
immediate?: boolean;
|
immediate?: boolean;
|
||||||
|
prune?: boolean;
|
||||||
key?: string;
|
key?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,21 +691,21 @@ export function createSwitchNavigator(
|
|||||||
* NavigationActions
|
* NavigationActions
|
||||||
*/
|
*/
|
||||||
export namespace NavigationActions {
|
export namespace NavigationActions {
|
||||||
declare const BACK: 'Navigation/BACK';
|
export const BACK: 'Navigation/BACK';
|
||||||
declare const INIT: 'Navigation/INIT';
|
export const INIT: 'Navigation/INIT';
|
||||||
declare const NAVIGATE: 'Navigation/NAVIGATE';
|
export const NAVIGATE: 'Navigation/NAVIGATE';
|
||||||
declare const SET_PARAMS: 'Navigation/SET_PARAMS';
|
export const SET_PARAMS: 'Navigation/SET_PARAMS';
|
||||||
|
|
||||||
declare function init(
|
export function init(
|
||||||
options?: NavigationInitActionPayload
|
options?: NavigationInitActionPayload
|
||||||
): NavigationInitAction;
|
): NavigationInitAction;
|
||||||
declare function navigate(
|
export function navigate(
|
||||||
options: NavigationNavigateActionPayload
|
options: NavigationNavigateActionPayload
|
||||||
): NavigationNavigateAction;
|
): NavigationNavigateAction;
|
||||||
declare function back(
|
export function back(
|
||||||
options?: NavigationBackActionPayload
|
options?: NavigationBackActionPayload
|
||||||
): NavigationBackAction;
|
): NavigationBackAction;
|
||||||
declare function setParams(
|
export function setParams(
|
||||||
options: NavigationSetParamsActionPayload
|
options: NavigationSetParamsActionPayload
|
||||||
): NavigationSetParamsAction;
|
): NavigationSetParamsAction;
|
||||||
}
|
}
|
||||||
@@ -713,45 +714,43 @@ export namespace NavigationActions {
|
|||||||
* DrawerActions
|
* DrawerActions
|
||||||
*/
|
*/
|
||||||
export namespace DrawerActions {
|
export namespace DrawerActions {
|
||||||
declare const OPEN_DRAWER: 'Navigation/OPEN_DRAWER';
|
export const OPEN_DRAWER: 'Navigation/OPEN_DRAWER';
|
||||||
declare const CLOSE_DRAWER: 'Navigation/CLOSE_DRAWER';
|
export const CLOSE_DRAWER: 'Navigation/CLOSE_DRAWER';
|
||||||
declare const TOGGLE_DRAWER: 'Navigation/TOGGLE_DRAWER';
|
export const TOGGLE_DRAWER: 'Navigation/TOGGLE_DRAWER';
|
||||||
|
|
||||||
declare function openDrawer(): NavigationOpenDrawerAction;
|
export function openDrawer(): NavigationOpenDrawerAction;
|
||||||
declare function closeDrawer(): NavigationCloseDrawerAction;
|
export function closeDrawer(): NavigationCloseDrawerAction;
|
||||||
declare function toggleDrawer(): NavigationToggleDrawerAction;
|
export function toggleDrawer(): NavigationToggleDrawerAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* StackActions
|
* StackActions
|
||||||
*/
|
*/
|
||||||
export namespace StackActions {
|
export namespace StackActions {
|
||||||
declare const POP: 'Navigation/POP';
|
export const POP: 'Navigation/POP';
|
||||||
declare const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
export const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
||||||
declare const PUSH: 'Navigation/PUSH';
|
export const PUSH: 'Navigation/PUSH';
|
||||||
declare const RESET: 'Navigation/RESET';
|
export const RESET: 'Navigation/RESET';
|
||||||
declare const REPLACE: 'Navigation/REPLACE';
|
export const REPLACE: 'Navigation/REPLACE';
|
||||||
declare const COMPLETE_TRANSITION: 'Navigation/COMPLETE_TRANSITION';
|
export const COMPLETE_TRANSITION: 'Navigation/COMPLETE_TRANSITION';
|
||||||
|
|
||||||
declare function pop(
|
export function pop(options: NavigationPopActionPayload): NavigationPopAction;
|
||||||
options: NavigationPopActionPayload
|
export function popToTop(
|
||||||
): NavigationPopAction;
|
|
||||||
declare function popToTop(
|
|
||||||
options?: NavigationPopToTopActionPayload
|
options?: NavigationPopToTopActionPayload
|
||||||
): NavigationPopToTopAction;
|
): NavigationPopToTopAction;
|
||||||
|
|
||||||
declare function push(
|
export function push(
|
||||||
options: NavigationPushActionPayload
|
options: NavigationPushActionPayload
|
||||||
): NavigationPushAction;
|
): NavigationPushAction;
|
||||||
declare function reset(
|
export function reset(
|
||||||
options: NavigationResetActionPayload
|
options: NavigationResetActionPayload
|
||||||
): NavigationResetAction;
|
): NavigationResetAction;
|
||||||
|
|
||||||
declare function replace(
|
export function replace(
|
||||||
options: NavigationReplaceActionPayload
|
options: NavigationReplaceActionPayload
|
||||||
): NavigationReplaceAction;
|
): NavigationReplaceAction;
|
||||||
|
|
||||||
declare function completeTransition(
|
export function completeTransition(
|
||||||
payload?: NavigationCompleteTransitionActionPayload
|
payload?: NavigationCompleteTransitionActionPayload
|
||||||
): NavigationCompleteTransitionAction;
|
): NavigationCompleteTransitionAction;
|
||||||
}
|
}
|
||||||
@@ -760,9 +759,9 @@ export namespace StackActions {
|
|||||||
* SwitchActions
|
* SwitchActions
|
||||||
*/
|
*/
|
||||||
export namespace 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
|
options: NavigationJumpToActionPayload
|
||||||
): NavigationJumpToAction;
|
): NavigationJumpToAction;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,79 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.3.4](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.3...react-navigation-stack@2.3.4) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.2...react-navigation-stack@2.3.3) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.2](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.1...react-navigation-stack@2.3.2) (2020-03-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.1](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.0...react-navigation-stack@2.3.1) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [2.3.0](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.3...react-navigation-stack@2.3.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation-stack/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 2.2.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-stack",
|
"name": "react-navigation-stack",
|
||||||
"version": "2.2.0",
|
"version": "2.3.4",
|
||||||
"description": "Stack navigator component for React Navigation",
|
"description": "Stack navigator component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -43,20 +43,20 @@
|
|||||||
"react-native-iphone-x-helper": "^1.2.1"
|
"react-native-iphone-x-helper": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@react-native-community/masked-view": "^0.1.6",
|
"@react-native-community/masked-view": "^0.1.7",
|
||||||
"@react-navigation/stack": "^5.0.9",
|
"@react-navigation/stack": "^5.2.3",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.4",
|
"react-native": "~0.61.4",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-safe-area-context": "^0.7.3",
|
"react-native-safe-area-context": "^0.7.3",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
"react-native-screens": "^2.3.0",
|
||||||
"react-navigation": "^4.2.0",
|
"react-navigation": "^4.3.2",
|
||||||
"react-test-renderer": "~16.9.0",
|
"react-test-renderer": "~16.9.0",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.5.0",
|
"react-native-gesture-handler": "^1.5.0",
|
||||||
"react-native-safe-area-context": "^0.6.0",
|
"react-native-safe-area-context": "^0.6.0",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha.0 || ^2.0.0-alpha.20",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/index.tsx 2020-02-24 11:58:26.000000000 +0100
|
+++ src/vendor/index.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -3,11 +3,6 @@
|
@@ -3,11 +3,6 @@
|
||||||
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
||||||
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
||||||
@@ -28,9 +28,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/i
|
|||||||
StackHeaderTitleProps,
|
StackHeaderTitleProps,
|
||||||
StackCardInterpolatedStyle,
|
StackCardInterpolatedStyle,
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
|
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-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.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 * as React from 'react';
|
||||||
-import {
|
-import {
|
||||||
- useNavigationBuilder,
|
- useNavigationBuilder,
|
||||||
@@ -107,13 +107,15 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
|
|||||||
-}
|
-}
|
||||||
-
|
-
|
||||||
-export default createNavigatorFactory<
|
-export default createNavigatorFactory<
|
||||||
|
- StackNavigationState,
|
||||||
- StackNavigationOptions,
|
- StackNavigationOptions,
|
||||||
|
- StackNavigationEventMap,
|
||||||
- typeof StackNavigator
|
- typeof StackNavigator
|
||||||
->(StackNavigator);
|
->(StackNavigator);
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/types.tsx 2020-02-24 12:05:09.000000000 +0100
|
+++ src/vendor/types.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -7,13 +7,28 @@
|
@@ -8,14 +8,28 @@
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { EdgeInsets } from 'react-native-safe-area-context';
|
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
import {
|
import {
|
||||||
@@ -126,6 +128,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- Route,
|
- Route,
|
||||||
- NavigationHelpers,
|
- NavigationHelpers,
|
||||||
- StackNavigationState,
|
- StackNavigationState,
|
||||||
|
- StackActionHelpers,
|
||||||
-} from '@react-navigation/native';
|
-} from '@react-navigation/native';
|
||||||
+ NavigationParams,
|
+ NavigationParams,
|
||||||
+ NavigationNavigateAction,
|
+ NavigationNavigateAction,
|
||||||
@@ -148,7 +151,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
|
|
||||||
export type StackNavigationEventMap = {
|
export type StackNavigationEventMap = {
|
||||||
/**
|
/**
|
||||||
@@ -26,42 +41,29 @@
|
@@ -28,22 +42,29 @@
|
||||||
transitionEnd: { data: { closing: boolean } };
|
transitionEnd: { data: { closing: boolean } };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -156,8 +159,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- ParamListBase,
|
- ParamListBase,
|
||||||
- StackNavigationEventMap
|
- StackNavigationEventMap
|
||||||
->;
|
->;
|
||||||
|
-
|
||||||
+export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
+export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
||||||
|
|
||||||
export type StackNavigationProp<
|
export type StackNavigationProp<
|
||||||
- ParamList extends ParamListBase,
|
- ParamList extends ParamListBase,
|
||||||
- RouteName extends keyof ParamList = string
|
- RouteName extends keyof ParamList = string
|
||||||
@@ -167,28 +170,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- StackNavigationState,
|
- StackNavigationState,
|
||||||
- StackNavigationOptions,
|
- StackNavigationOptions,
|
||||||
- StackNavigationEventMap
|
- StackNavigationEventMap
|
||||||
-> & {
|
-> &
|
||||||
- /**
|
- StackActionHelpers<ParamList>;
|
||||||
- * Push a new screen onto the stack.
|
|
||||||
- *
|
|
||||||
- * @param name Name of the route for the tab.
|
|
||||||
- * @param [params] Params object for the route.
|
|
||||||
- */
|
|
||||||
- push<RouteName extends keyof ParamList>(
|
|
||||||
- ...args: ParamList[RouteName] extends undefined | any
|
|
||||||
- ? [RouteName] | [RouteName, ParamList[RouteName]]
|
|
||||||
- : [RouteName, ParamList[RouteName]]
|
|
||||||
- ): void;
|
|
||||||
-
|
|
||||||
- /**
|
|
||||||
- * Pop a screen from the stack.
|
|
||||||
- */
|
|
||||||
- pop(count?: number): void;
|
|
||||||
-
|
|
||||||
- /**
|
|
||||||
- * Pop to the first route in the stack, dismissing all other screens.
|
|
||||||
- */
|
|
||||||
- popToTop(): void;
|
|
||||||
+ State = NavigationRoute,
|
+ State = NavigationRoute,
|
||||||
+ Params = NavigationParams
|
+ Params = NavigationParams
|
||||||
+> = NavigationScreenProp<State, Params> & {
|
+> = NavigationScreenProp<State, Params> & {
|
||||||
@@ -209,10 +192,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
+ event: NavigationStackEventName,
|
+ event: NavigationStackEventName,
|
||||||
+ callback: NavigationEventCallback
|
+ callback: NavigationEventCallback
|
||||||
+ ) => NavigationEventSubscription;
|
+ ) => NavigationEventSubscription;
|
||||||
};
|
+};
|
||||||
|
|
||||||
export type Layout = { width: number; height: number };
|
export type Layout = { width: number; height: number };
|
||||||
@@ -237,24 +239,27 @@
|
|
||||||
|
@@ -218,24 +239,27 @@
|
||||||
/**
|
/**
|
||||||
* Navigation prop for the header.
|
* Navigation prop for the header.
|
||||||
*/
|
*/
|
||||||
@@ -246,7 +230,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
export type StackNavigationOptions = StackHeaderOptions &
|
export type StackNavigationOptions = StackHeaderOptions &
|
||||||
Partial<TransitionPreset> & {
|
Partial<TransitionPreset> & {
|
||||||
/**
|
/**
|
||||||
@@ -332,6 +337,8 @@
|
@@ -317,6 +341,8 @@
|
||||||
bottom?: number;
|
bottom?: number;
|
||||||
left?: number;
|
left?: number;
|
||||||
};
|
};
|
||||||
@@ -255,20 +239,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationConfig = {
|
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
|
|
||||||
@@ -39,6 +39,7 @@
|
|
||||||
const { children, style, enabled, ...rest } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
+ // @ts-ignore
|
|
||||||
<AnimatedBaseButton
|
|
||||||
{...rest}
|
|
||||||
onActiveStateChange={this.handleActiveStateChange}
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/Header.tsx 2020-02-24 12:48:47.000000000 +0100
|
+++ src/vendor/views/Header/Header.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -1,12 +1,14 @@
|
@@ -1,12 +1,14 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import { StackActions } from '@react-navigation/native';
|
-import { StackActions } from '@react-navigation/native';
|
||||||
@@ -306,7 +279,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
|
|
||||||
const goBack = React.useCallback(
|
const goBack = React.useCallback(
|
||||||
debounce(() => {
|
debounce(() => {
|
||||||
- if (navigation.canGoBack()) {
|
- if (navigation.isFocused() && navigation.canGoBack()) {
|
||||||
- navigation.dispatch({
|
- navigation.dispatch({
|
||||||
- ...StackActions.pop(),
|
- ...StackActions.pop(),
|
||||||
- source: scene.route.key,
|
- source: scene.route.key,
|
||||||
@@ -348,8 +321,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
+
|
+
|
||||||
+export default Header;
|
+export default Header;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-02-24 11:58:32.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -8,9 +8,9 @@
|
@@ -8,9 +8,9 @@
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
LayoutChangeEvent,
|
LayoutChangeEvent,
|
||||||
@@ -362,8 +335,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
|||||||
|
|
||||||
type Props = StackHeaderLeftButtonProps;
|
type Props = StackHeaderLeftButtonProps;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-02-24 11:58:32.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -1,6 +1,6 @@
|
@@ -1,6 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
|
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
|
||||||
@@ -373,8 +346,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
|||||||
type Props = ViewProps & {
|
type Props = ViewProps & {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-02-24 12:08:14.000000000 +0100
|
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -1,11 +1,6 @@
|
@@ -1,11 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||||
@@ -426,8 +399,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
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-02-24 11:58:32.000000000 +0100
|
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -8,7 +8,7 @@
|
@@ -8,7 +8,7 @@
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
@@ -447,24 +420,20 @@ 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
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-02-24 12:47:49.000000000 +0100
|
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -1,8 +1,8 @@
|
@@ -1,6 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import { Animated, StyleSheet, Platform, TextProps } from 'react-native';
|
import { Animated, StyleSheet, Platform } from 'react-native';
|
||||||
-import { useTheme } from '@react-navigation/native';
|
-import { useTheme } from '@react-navigation/native';
|
||||||
+import { Animated, StyleSheet, Platform } from 'react-native';
|
|
||||||
+import useTheme from '../../../utils/useTheme';
|
+import useTheme from '../../../utils/useTheme';
|
||||||
|
|
||||||
-type Props = TextProps & {
|
type Props = React.ComponentProps<typeof Animated.Text> & {
|
||||||
+type Props = React.ComponentProps<typeof Animated.Text> & {
|
|
||||||
tintColor?: string;
|
tintColor?: string;
|
||||||
children?: string;
|
|
||||||
};
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/Card.tsx 2020-02-24 11:58:32.000000000 +0100
|
+++ src/vendor/views/Stack/Card.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -133,7 +133,7 @@
|
@@ -138,7 +138,7 @@
|
||||||
|
|
||||||
private interactionHandle: number | undefined;
|
private interactionHandle: number | undefined;
|
||||||
|
|
||||||
@@ -473,18 +442,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx s
|
|||||||
|
|
||||||
private animate = ({
|
private animate = ({
|
||||||
closing,
|
closing,
|
||||||
@@ -507,7 +507,7 @@
|
|
||||||
) : null}
|
|
||||||
<View
|
|
||||||
ref={this.contentRef}
|
|
||||||
- style={[styles.content, contentStyle]}
|
|
||||||
+ style={[styles.content, contentStyle] as any}
|
|
||||||
>
|
|
||||||
<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
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardContainer.tsx 2020-02-24 11:58:32.000000000 +0100
|
+++ src/vendor/views/Stack/CardContainer.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -1,10 +1,16 @@
|
@@ -1,10 +1,16 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||||
@@ -504,7 +464,33 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
|
|
||||||
type Props = TransitionPreset & {
|
type Props = TransitionPreset & {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -180,7 +186,7 @@
|
@@ -36,6 +42,7 @@
|
||||||
|
closing: boolean
|
||||||
|
) => void;
|
||||||
|
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
|
+ onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||||
|
onPageChangeStart?: () => void;
|
||||||
|
onPageChangeConfirm?: () => void;
|
||||||
|
onPageChangeCancel?: () => void;
|
||||||
|
@@ -83,6 +90,7 @@
|
||||||
|
layout,
|
||||||
|
onCloseRoute,
|
||||||
|
onOpenRoute,
|
||||||
|
+ onTransitionComplete,
|
||||||
|
onPageChangeCancel,
|
||||||
|
onPageChangeConfirm,
|
||||||
|
onPageChangeStart,
|
||||||
|
@@ -152,6 +160,9 @@
|
||||||
|
};
|
||||||
|
}, [pointerEvents, scene.progress.next]);
|
||||||
|
|
||||||
|
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
+ React.useEffect(() => onTransitionComplete({ route: scene.route }), []);
|
||||||
|
+
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
index={index}
|
||||||
|
@@ -183,7 +194,7 @@
|
||||||
? { marginTop: headerHeight }
|
? { marginTop: headerHeight }
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
@@ -514,8 +500,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
>
|
>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardStack.tsx 2020-02-24 12:09:38.000000000 +0100
|
+++ src/vendor/views/Stack/CardStack.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -9,9 +9,8 @@
|
@@ -9,9 +9,8 @@
|
||||||
ViewProps,
|
ViewProps,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
@@ -535,18 +521,33 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
Layout,
|
Layout,
|
||||||
StackHeaderMode,
|
StackHeaderMode,
|
||||||
StackCardMode,
|
StackCardMode,
|
||||||
@@ -103,7 +103,7 @@
|
@@ -54,6 +54,7 @@
|
||||||
<View
|
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
||||||
collapsable={!enabled}
|
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||||
removeClippedSubviews={Platform.OS !== 'ios' && enabled}
|
headerMode: StackHeaderMode;
|
||||||
- style={[style, { overflow: 'hidden' }]}
|
+ onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||||
+ style={[style, { overflow: 'hidden' }] as any}
|
onTransitionStart: (
|
||||||
{...rest}
|
props: { route: Route<string> },
|
||||||
/>
|
closing: boolean
|
||||||
);
|
@@ -383,6 +384,7 @@
|
||||||
|
renderHeader,
|
||||||
|
renderScene,
|
||||||
|
headerMode,
|
||||||
|
+ onTransitionComplete,
|
||||||
|
onTransitionStart,
|
||||||
|
onTransitionEnd,
|
||||||
|
onPageChangeStart,
|
||||||
|
@@ -560,6 +562,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
|
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
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-03-19 20:09:01.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/StackView.tsx 2020-02-24 12:09:08.000000000 +0100
|
+++ src/vendor/views/Stack/StackView.tsx 2020-03-19 20:09:16.000000000 +0100
|
||||||
@@ -4,9 +4,9 @@
|
@@ -4,9 +4,9 @@
|
||||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||||
import {
|
import {
|
||||||
@@ -576,7 +577,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@@ -290,14 +292,31 @@
|
@@ -290,14 +292,37 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -598,10 +599,16 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
};
|
};
|
||||||
|
|
||||||
+ private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
+ private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
||||||
+ // TODO: remove when the new event system lands
|
+ const { state, navigation } = this.props;
|
||||||
+ this.props.navigation.dispatch(
|
+
|
||||||
+ StackActions.completeTransition({ toChildKey: route.key })
|
+ if (state.isTransitioning) {
|
||||||
+ );
|
+ navigation.dispatch(
|
||||||
|
+ StackActions.completeTransition({
|
||||||
|
+ key: navigation.state.key,
|
||||||
|
+ toChildKey: route.key,
|
||||||
|
+ })
|
||||||
|
+ );
|
||||||
|
+ }
|
||||||
+ };
|
+ };
|
||||||
+
|
+
|
||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
@@ -609,7 +616,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
routes: state.replacingRouteKeys.length
|
routes: state.replacingRouteKeys.length
|
||||||
? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key))
|
? 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
|
// If a route exists in state, trigger a pop
|
||||||
// This will happen in when the route was closed from the card component
|
// This will happen in when the route was closed from the card component
|
||||||
// e.g. When the close animation triggered from a gesture ends
|
// e.g. When the close animation triggered from a gesture ends
|
||||||
@@ -619,7 +626,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
- target: state.key,
|
- target: state.key,
|
||||||
- });
|
- });
|
||||||
+ // @ts-ignore
|
+ // @ts-ignore
|
||||||
+ navigation.dispatch(StackActions.pop({ key: route.key }));
|
+ navigation.dispatch(StackActions.pop({ key: route.key, prune: false }));
|
||||||
} else {
|
} else {
|
||||||
+ // While closing route we need to point to the previous one assuming that
|
+ // While closing route we need to point to the previous one assuming that
|
||||||
+ // this previous one in routes array
|
+ // this previous one in routes array
|
||||||
@@ -632,7 +639,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
|
// We need to clean up any state tracking the route and pop it immediately
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
routes: state.routes.filter(r => r.key !== route.key),
|
routes: state.routes.filter(r => r.key !== route.key),
|
||||||
@@ -337,22 +361,24 @@
|
@@ -337,22 +367,24 @@
|
||||||
private handleTransitionStart = (
|
private handleTransitionStart = (
|
||||||
{ route }: { route: Route<string> },
|
{ route }: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -669,3 +676,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
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}
|
||||||
|
|||||||
10
packages/stack/src/vendor/types.tsx
vendored
10
packages/stack/src/vendor/types.tsx
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
Animated,
|
Animated,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
@@ -42,7 +43,6 @@ export type StackNavigationEventMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
||||||
|
|
||||||
export type StackNavigationProp<
|
export type StackNavigationProp<
|
||||||
State = NavigationRoute,
|
State = NavigationRoute,
|
||||||
Params = NavigationParams
|
Params = NavigationParams
|
||||||
@@ -124,7 +124,7 @@ export type StackHeaderOptions = {
|
|||||||
/**
|
/**
|
||||||
* Style object for the title component.
|
* Style object for the title component.
|
||||||
*/
|
*/
|
||||||
headerTitleStyle?: StyleProp<TextStyle>;
|
headerTitleStyle?: React.ComponentProps<typeof Animated.Text>['style'];
|
||||||
/**
|
/**
|
||||||
* Style object for the container of the `headerTitle` component, for example to add padding.
|
* Style object for the container of the `headerTitle` component, for example to add padding.
|
||||||
* By default, `headerTitleContainerStyle` is with an absolute position style and offsets both `left` and `right`.
|
* By default, `headerTitleContainerStyle` is with an absolute position style and offsets both `left` and `right`.
|
||||||
@@ -284,6 +284,10 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|||||||
* Defaults to `true` on Android and `false` on iOS.
|
* Defaults to `true` on Android and `false` on iOS.
|
||||||
*/
|
*/
|
||||||
cardOverlayEnabled?: boolean;
|
cardOverlayEnabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Function that returns a React Element to display as a overlay for the card.
|
||||||
|
*/
|
||||||
|
cardOverlay?: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
/**
|
/**
|
||||||
* Style object for the card in stack.
|
* Style object for the card in stack.
|
||||||
* You can provide a custom background color to use instead of the default background here.
|
* You can provide a custom background color to use instead of the default background here.
|
||||||
@@ -437,7 +441,7 @@ export type StackHeaderTitleProps = {
|
|||||||
/**
|
/**
|
||||||
* Style object for the title element.
|
* Style object for the title element.
|
||||||
*/
|
*/
|
||||||
style?: StyleProp<TextStyle>;
|
style?: React.ComponentProps<typeof Animated.Text>['style'];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TransitionSpec =
|
export type TransitionSpec =
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default class BorderlessButton extends React.Component<Props> {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onActiveStateChange && this.props.onActiveStateChange(active);
|
this.props.onActiveStateChange?.(active);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
android: {
|
android: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: '500',
|
fontFamily: 'sans-serif-medium',
|
||||||
|
fontWeight: 'normal',
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { TextInput, Keyboard } from 'react-native';
|
import { TextInput } from 'react-native';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
@@ -54,7 +54,11 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
Keyboard.dismiss();
|
const input = this.previouslyFocusedTextInput;
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
TextInput.State.blurTextInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup the ID on successful page change
|
// Cleanup the ID on successful page change
|
||||||
this.previouslyFocusedTextInput = null;
|
this.previouslyFocusedTextInput = null;
|
||||||
|
|||||||
107
packages/stack/src/vendor/views/Stack/Card.tsx
vendored
107
packages/stack/src/vendor/views/Stack/Card.tsx
vendored
@@ -44,6 +44,7 @@ type Props = ViewProps & {
|
|||||||
onGestureCanceled?: () => void;
|
onGestureCanceled?: () => void;
|
||||||
onGestureEnd?: () => void;
|
onGestureEnd?: () => void;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
overlay: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
overlayEnabled: boolean;
|
overlayEnabled: boolean;
|
||||||
shadowEnabled: boolean;
|
shadowEnabled: boolean;
|
||||||
gestureEnabled: boolean;
|
gestureEnabled: boolean;
|
||||||
@@ -80,6 +81,10 @@ export default class Card extends React.Component<Props> {
|
|||||||
shadowEnabled: true,
|
shadowEnabled: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
|
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
|
||||||
|
overlay: ({ style }: { style: StyleProp<ViewStyle> }) =>
|
||||||
|
style ? (
|
||||||
|
<Animated.View pointerEvents="none" style={[styles.overlay, style]} />
|
||||||
|
) : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -266,8 +271,14 @@ export default class Card extends React.Component<Props> {
|
|||||||
velocity = nativeEvent.velocityX;
|
velocity = nativeEvent.velocityX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const gestureDirectionFactor =
|
||||||
|
gestureDirection === 'horizontal' || gestureDirection === 'vertical'
|
||||||
|
? 1
|
||||||
|
: -1;
|
||||||
|
|
||||||
const closing =
|
const closing =
|
||||||
Math.abs(translation + velocity * gestureVelocityImpact) >
|
gestureDirectionFactor *
|
||||||
|
(translation + velocity * gestureVelocityImpact) >
|
||||||
distance / 2
|
distance / 2
|
||||||
? velocity !== 0 || translation !== 0
|
? velocity !== 0 || translation !== 0
|
||||||
: false;
|
: false;
|
||||||
@@ -409,6 +420,7 @@ export default class Card extends React.Component<Props> {
|
|||||||
next,
|
next,
|
||||||
layout,
|
layout,
|
||||||
insets,
|
insets,
|
||||||
|
overlay,
|
||||||
overlayEnabled,
|
overlayEnabled,
|
||||||
shadowEnabled,
|
shadowEnabled,
|
||||||
gestureEnabled,
|
gestureEnabled,
|
||||||
@@ -470,55 +482,54 @@ export default class Card extends React.Component<Props> {
|
|||||||
: false;
|
: false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View pointerEvents="box-none" {...rest}>
|
<CardAnimationContext.Provider value={animationContext}>
|
||||||
{overlayEnabled && overlayStyle ? (
|
<View pointerEvents="box-none" {...rest}>
|
||||||
|
{overlayEnabled ? (
|
||||||
|
<View style={StyleSheet.absoluteFill}>
|
||||||
|
{overlay({ style: overlayStyle })}
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
<Animated.View
|
<Animated.View
|
||||||
pointerEvents="none"
|
style={[styles.container, containerStyle, customContainerStyle]}
|
||||||
style={[styles.overlay, overlayStyle]}
|
pointerEvents="box-none"
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
<Animated.View
|
|
||||||
style={[styles.container, containerStyle, customContainerStyle]}
|
|
||||||
pointerEvents="box-none"
|
|
||||||
>
|
|
||||||
<PanGestureHandler
|
|
||||||
ref={this.gestureRef}
|
|
||||||
enabled={layout.width !== 0 && gestureEnabled}
|
|
||||||
onGestureEvent={handleGestureEvent}
|
|
||||||
onHandlerStateChange={this.handleGestureStateChange}
|
|
||||||
{...this.gestureActivationCriteria()}
|
|
||||||
>
|
>
|
||||||
<Animated.View style={[styles.container, cardStyle]}>
|
<PanGestureHandler
|
||||||
{shadowEnabled && shadowStyle && !isTransparent ? (
|
ref={this.gestureRef}
|
||||||
<Animated.View
|
enabled={layout.width !== 0 && gestureEnabled}
|
||||||
style={[
|
onGestureEvent={handleGestureEvent}
|
||||||
styles.shadow,
|
onHandlerStateChange={this.handleGestureStateChange}
|
||||||
gestureDirection === 'horizontal'
|
{...this.gestureActivationCriteria()}
|
||||||
? [styles.shadowHorizontal, styles.shadowLeft]
|
>
|
||||||
: gestureDirection === 'horizontal-inverted'
|
<Animated.View style={[styles.container, cardStyle]}>
|
||||||
? [styles.shadowHorizontal, styles.shadowRight]
|
{shadowEnabled && shadowStyle && !isTransparent ? (
|
||||||
: gestureDirection === 'vertical'
|
<Animated.View
|
||||||
? [styles.shadowVertical, styles.shadowTop]
|
style={[
|
||||||
: [styles.shadowVertical, styles.shadowBottom],
|
styles.shadow,
|
||||||
shadowStyle,
|
gestureDirection === 'horizontal'
|
||||||
]}
|
? [styles.shadowHorizontal, styles.shadowLeft]
|
||||||
pointerEvents="none"
|
: gestureDirection === 'horizontal-inverted'
|
||||||
/>
|
? [styles.shadowHorizontal, styles.shadowRight]
|
||||||
) : null}
|
: gestureDirection === 'vertical'
|
||||||
<View
|
? [styles.shadowVertical, styles.shadowTop]
|
||||||
ref={this.contentRef}
|
: [styles.shadowVertical, styles.shadowBottom],
|
||||||
style={[styles.content, contentStyle] as any}
|
shadowStyle,
|
||||||
>
|
]}
|
||||||
<StackGestureRefContext.Provider value={this.gestureRef}>
|
pointerEvents="none"
|
||||||
<CardAnimationContext.Provider value={animationContext}>
|
/>
|
||||||
|
) : null}
|
||||||
|
<View
|
||||||
|
ref={this.contentRef}
|
||||||
|
style={[styles.content, contentStyle]}
|
||||||
|
>
|
||||||
|
<StackGestureRefContext.Provider value={this.gestureRef}>
|
||||||
{children}
|
{children}
|
||||||
</CardAnimationContext.Provider>
|
</StackGestureRefContext.Provider>
|
||||||
</StackGestureRefContext.Provider>
|
</View>
|
||||||
</View>
|
</Animated.View>
|
||||||
</Animated.View>
|
</PanGestureHandler>
|
||||||
</PanGestureHandler>
|
</Animated.View>
|
||||||
</Animated.View>
|
</View>
|
||||||
</View>
|
</CardAnimationContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,7 +543,7 @@ const styles = StyleSheet.create({
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
overlay: {
|
overlay: {
|
||||||
...StyleSheet.absoluteFillObject,
|
flex: 1,
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
},
|
},
|
||||||
shadow: {
|
shadow: {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type Props = TransitionPreset & {
|
|||||||
safeAreaInsetRight: number;
|
safeAreaInsetRight: number;
|
||||||
safeAreaInsetBottom: number;
|
safeAreaInsetBottom: number;
|
||||||
safeAreaInsetLeft: number;
|
safeAreaInsetLeft: number;
|
||||||
|
cardOverlay?: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
cardOverlayEnabled?: boolean;
|
cardOverlayEnabled?: boolean;
|
||||||
cardShadowEnabled?: boolean;
|
cardShadowEnabled?: boolean;
|
||||||
cardStyle?: StyleProp<ViewStyle>;
|
cardStyle?: StyleProp<ViewStyle>;
|
||||||
@@ -41,6 +42,7 @@ type Props = TransitionPreset & {
|
|||||||
closing: boolean
|
closing: boolean
|
||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
|
onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||||
onPageChangeStart?: () => void;
|
onPageChangeStart?: () => void;
|
||||||
onPageChangeConfirm?: () => void;
|
onPageChangeConfirm?: () => void;
|
||||||
onPageChangeCancel?: () => void;
|
onPageChangeCancel?: () => void;
|
||||||
@@ -64,6 +66,7 @@ const EPSILON = 0.1;
|
|||||||
|
|
||||||
function CardContainer({
|
function CardContainer({
|
||||||
active,
|
active,
|
||||||
|
cardOverlay,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
cardStyle,
|
cardStyle,
|
||||||
@@ -87,6 +90,7 @@ function CardContainer({
|
|||||||
layout,
|
layout,
|
||||||
onCloseRoute,
|
onCloseRoute,
|
||||||
onOpenRoute,
|
onOpenRoute,
|
||||||
|
onTransitionComplete,
|
||||||
onPageChangeCancel,
|
onPageChangeCancel,
|
||||||
onPageChangeConfirm,
|
onPageChangeConfirm,
|
||||||
onPageChangeStart,
|
onPageChangeStart,
|
||||||
@@ -156,6 +160,9 @@ function CardContainer({
|
|||||||
};
|
};
|
||||||
}, [pointerEvents, scene.progress.next]);
|
}, [pointerEvents, scene.progress.next]);
|
||||||
|
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
React.useEffect(() => onTransitionComplete({ route: scene.route }), []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
index={index}
|
index={index}
|
||||||
@@ -168,6 +175,7 @@ function CardContainer({
|
|||||||
closing={closing}
|
closing={closing}
|
||||||
onOpen={handleOpen}
|
onOpen={handleOpen}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
|
overlay={cardOverlay}
|
||||||
overlayEnabled={cardOverlayEnabled}
|
overlayEnabled={cardOverlayEnabled}
|
||||||
shadowEnabled={cardShadowEnabled}
|
shadowEnabled={cardShadowEnabled}
|
||||||
onTransitionStart={handleTransitionStart}
|
onTransitionStart={handleTransitionStart}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ type Props = {
|
|||||||
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
||||||
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||||
headerMode: StackHeaderMode;
|
headerMode: StackHeaderMode;
|
||||||
|
onTransitionComplete: (props: { route: Route<string> }) => void;
|
||||||
onTransitionStart: (
|
onTransitionStart: (
|
||||||
props: { route: Route<string> },
|
props: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -75,9 +76,6 @@ type State = {
|
|||||||
|
|
||||||
const EPSILON = 0.01;
|
const EPSILON = 0.01;
|
||||||
|
|
||||||
const dimensions = Dimensions.get('window');
|
|
||||||
const layout = { width: dimensions.width, height: dimensions.height };
|
|
||||||
|
|
||||||
const MaybeScreenContainer = ({
|
const MaybeScreenContainer = ({
|
||||||
enabled,
|
enabled,
|
||||||
...rest
|
...rest
|
||||||
@@ -160,7 +158,16 @@ const getProgressFromGesture = (
|
|||||||
layout: Layout,
|
layout: Layout,
|
||||||
descriptor?: StackDescriptor
|
descriptor?: StackDescriptor
|
||||||
) => {
|
) => {
|
||||||
const distance = getDistanceFromOptions(mode, layout, descriptor);
|
const distance = getDistanceFromOptions(
|
||||||
|
mode,
|
||||||
|
{
|
||||||
|
// Make sure that we have a non-zero distance, otherwise there will be incorrect progress
|
||||||
|
// This causes blank screen on web if it was previously inside container with display: none
|
||||||
|
width: Math.max(1, layout.width),
|
||||||
|
height: Math.max(1, layout.height),
|
||||||
|
},
|
||||||
|
descriptor
|
||||||
|
);
|
||||||
|
|
||||||
if (distance > 0) {
|
if (distance > 0) {
|
||||||
return gesture.interpolate({
|
return gesture.interpolate({
|
||||||
@@ -290,19 +297,25 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
state: State = {
|
constructor(props: Props) {
|
||||||
routes: [],
|
super(props);
|
||||||
scenes: [],
|
|
||||||
gestures: {},
|
const { height = 0, width = 0 } = Dimensions.get('window');
|
||||||
layout,
|
|
||||||
descriptors: this.props.descriptors,
|
this.state = {
|
||||||
// Used when card's header is null and mode is float to make transition
|
routes: [],
|
||||||
// between screens with headers and those without headers smooth.
|
scenes: [],
|
||||||
// This is not a great heuristic here. We don't know synchronously
|
gestures: {},
|
||||||
// on mount what the header height is so we have just used the most
|
layout: { height, width },
|
||||||
// common cases here.
|
descriptors: this.props.descriptors,
|
||||||
headerHeights: {},
|
// Used when card's header is null and mode is float to make transition
|
||||||
};
|
// between screens with headers and those without headers smooth.
|
||||||
|
// This is not a great heuristic here. We don't know synchronously
|
||||||
|
// on mount what the header height is so we have just used the most
|
||||||
|
// common cases here.
|
||||||
|
headerHeights: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private handleLayout = (e: LayoutChangeEvent) => {
|
private handleLayout = (e: LayoutChangeEvent) => {
|
||||||
const { height, width } = e.nativeEvent.layout;
|
const { height, width } = e.nativeEvent.layout;
|
||||||
@@ -371,6 +384,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
renderHeader,
|
renderHeader,
|
||||||
renderScene,
|
renderScene,
|
||||||
headerMode,
|
headerMode,
|
||||||
|
onTransitionComplete,
|
||||||
onTransitionStart,
|
onTransitionStart,
|
||||||
onTransitionEnd,
|
onTransitionEnd,
|
||||||
onPageChangeStart,
|
onPageChangeStart,
|
||||||
@@ -401,9 +415,9 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
left = insets.left,
|
left = insets.left,
|
||||||
} = focusedOptions.safeAreaInsets || {};
|
} = focusedOptions.safeAreaInsets || {};
|
||||||
|
|
||||||
// Screens is buggy on iOS, so we don't enable it there
|
// Screens is buggy on iOS and web, so we only enable it on Android
|
||||||
// For modals, usually we want the screen underneath to be visible, so also disable it there
|
// For modals, usually we want the screen underneath to be visible, so also disable it there
|
||||||
const isScreensEnabled = Platform.OS !== 'ios' && mode !== 'modal';
|
const isScreensEnabled = Platform.OS === 'android' && mode !== 'modal';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -431,6 +445,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
headerTransparent,
|
headerTransparent,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
|
cardOverlay,
|
||||||
cardStyle,
|
cardStyle,
|
||||||
animationEnabled,
|
animationEnabled,
|
||||||
gestureResponseDistance,
|
gestureResponseDistance,
|
||||||
@@ -528,6 +543,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
safeAreaInsetRight={safeAreaInsetRight}
|
safeAreaInsetRight={safeAreaInsetRight}
|
||||||
safeAreaInsetBottom={safeAreaInsetBottom}
|
safeAreaInsetBottom={safeAreaInsetBottom}
|
||||||
safeAreaInsetLeft={safeAreaInsetLeft}
|
safeAreaInsetLeft={safeAreaInsetLeft}
|
||||||
|
cardOverlay={cardOverlay}
|
||||||
cardOverlayEnabled={cardOverlayEnabled}
|
cardOverlayEnabled={cardOverlayEnabled}
|
||||||
cardShadowEnabled={cardShadowEnabled}
|
cardShadowEnabled={cardShadowEnabled}
|
||||||
cardStyle={cardStyle}
|
cardStyle={cardStyle}
|
||||||
@@ -546,6 +562,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
renderScene={renderScene}
|
renderScene={renderScene}
|
||||||
onOpenRoute={onOpenRoute}
|
onOpenRoute={onOpenRoute}
|
||||||
onCloseRoute={onCloseRoute}
|
onCloseRoute={onCloseRoute}
|
||||||
|
onTransitionComplete={onTransitionComplete}
|
||||||
onTransitionStart={onTransitionStart}
|
onTransitionStart={onTransitionStart}
|
||||||
onTransitionEnd={onTransitionEnd}
|
onTransitionEnd={onTransitionEnd}
|
||||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||||
|
|||||||
@@ -309,10 +309,16 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
private handleTransitionComplete = ({ route }: { route: Route<string> }) => {
|
||||||
// TODO: remove when the new event system lands
|
const { state, navigation } = this.props;
|
||||||
this.props.navigation.dispatch(
|
|
||||||
StackActions.completeTransition({ toChildKey: route.key })
|
if (state.isTransitioning) {
|
||||||
);
|
navigation.dispatch(
|
||||||
|
StackActions.completeTransition({
|
||||||
|
key: navigation.state.key,
|
||||||
|
toChildKey: route.key,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
@@ -335,7 +341,7 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
// This will happen in when the route was closed from the card component
|
// This will happen in when the route was closed from the card component
|
||||||
// e.g. When the close animation triggered from a gesture ends
|
// e.g. When the close animation triggered from a gesture ends
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
navigation.dispatch(StackActions.pop({ key: route.key }));
|
navigation.dispatch(StackActions.pop({ key: route.key, prune: false }));
|
||||||
} else {
|
} else {
|
||||||
// While closing route we need to point to the previous one assuming that
|
// While closing route we need to point to the previous one assuming that
|
||||||
// this previous one in routes array
|
// this previous one in routes array
|
||||||
@@ -417,6 +423,7 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
closingRouteKeys={closingRouteKeys}
|
closingRouteKeys={closingRouteKeys}
|
||||||
onOpenRoute={this.handleOpenRoute}
|
onOpenRoute={this.handleOpenRoute}
|
||||||
onCloseRoute={this.handleCloseRoute}
|
onCloseRoute={this.handleCloseRoute}
|
||||||
|
onTransitionComplete={this.handleTransitionComplete}
|
||||||
onTransitionStart={this.handleTransitionStart}
|
onTransitionStart={this.handleTransitionStart}
|
||||||
onTransitionEnd={this.handleTransitionEnd}
|
onTransitionEnd={this.handleTransitionEnd}
|
||||||
renderHeader={this.renderHeader}
|
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,60 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.8.6](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.5...react-navigation-tabs@2.8.6) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.5](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.4...react-navigation-tabs@2.8.5) (2020-03-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't use react-native-screens on web ([44c3900](https://github.com/react-navigation/tabs/commit/44c390075f7b76664e09fd9a1a7926645133ebec)), closes [#7485](https://github.com/react-navigation/tabs/issues/7485)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.4](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.3...react-navigation-tabs@2.8.4) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* downgrade react-native-safe-area-view ([cfc1bac](https://github.com/react-navigation/tabs/commit/cfc1bac4e153db4a4ba3f2a9033f77b53367fcbc)), closes [#7813](https://github.com/react-navigation/tabs/issues/7813)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.3](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.2...react-navigation-tabs@2.8.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [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)
|
# 2.8.0 (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-tabs",
|
"name": "react-navigation-tabs",
|
||||||
"version": "2.8.0",
|
"version": "2.8.6",
|
||||||
"description": "Tab Navigation components for React Navigation",
|
"description": "Tab Navigation components for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -42,21 +42,21 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
"hoist-non-react-statics": "^3.3.2",
|
||||||
"react-lifecycles-compat": "^3.0.4",
|
"react-lifecycles-compat": "^3.0.4",
|
||||||
"react-native-safe-area-view": "^0.14.6",
|
"react-native-safe-area-view": "^0.14.8",
|
||||||
"react-native-tab-view": "^2.11.0"
|
"react-native-tab-view": "^2.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/hoist-non-react-statics": "^3.3.1",
|
"@types/hoist-non-react-statics": "^3.3.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-native-tab-view": "^2.13.0",
|
"react-native-tab-view": "^2.13.0",
|
||||||
"react-navigation": "^4.2.0",
|
"react-navigation": "^4.3.2",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.0.0",
|
"react-native-gesture-handler": "^1.0.0",
|
||||||
"react-native-reanimated": "^1.0.0-alpha",
|
"react-native-reanimated": "^1.0.0-alpha",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Platform, StyleSheet, View } from 'react-native';
|
import { Platform, StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
import { Screen, screensEnabled } from 'react-native-screens';
|
import { Screen, screensEnabled } from 'react-native-screens';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -9,12 +8,14 @@ type Props = {
|
|||||||
style?: any;
|
style?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whole view out of its container
|
const FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container
|
||||||
|
|
||||||
export default class ResourceSavingScene extends React.Component<Props> {
|
export default class ResourceSavingScene extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
if (screensEnabled?.()) {
|
// react-native-screens is buggy on web
|
||||||
|
if (screensEnabled?.() && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
||||||
}
|
}
|
||||||
@@ -23,7 +24,13 @@ export default class ResourceSavingScene extends React.Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.container, style, { opacity: isVisible ? 1 : 0 }]}
|
style={[
|
||||||
|
styles.container,
|
||||||
|
Platform.OS === 'web'
|
||||||
|
? { display: isVisible ? 'flex' : 'none' }
|
||||||
|
: null,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
collapsable={false}
|
collapsable={false}
|
||||||
removeClippedSubviews={
|
removeClippedSubviews={
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"jsx": "react",
|
"jsx": "react",
|
||||||
"lib": ["esnext", "dom"],
|
"lib": ["esnext"],
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
|||||||
Reference in New Issue
Block a user