mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-19 18:38:16 +08:00
Compare commits
11 Commits
react-navi
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f553c2ad1 | ||
|
|
10ad9154a2 | ||
|
|
fb1e8d4a07 | ||
|
|
5c7f892d77 | ||
|
|
10c6c3280f | ||
|
|
e5856dae79 | ||
|
|
db24639445 | ||
|
|
f10543f9fc | ||
|
|
a3e3fa2cfd | ||
|
|
ec25edd658 | ||
|
|
09d4bc24e9 |
@@ -3,6 +3,14 @@
|
|||||||
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.6.4](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.6.3...react-navigation-animated-switch@0.6.4) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.6.3](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.6.2...react-navigation-animated-switch@0.6.3) (2020-10-26)
|
## [0.6.3](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.6.2...react-navigation-animated-switch@0.6.3) (2020-10-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-animated-switch
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-animated-switch",
|
"name": "react-navigation-animated-switch",
|
||||||
"version": "0.6.3",
|
"version": "0.6.4",
|
||||||
"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",
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
"react": "~16.13.1",
|
"react": "~16.13.1",
|
||||||
"react-native": "~0.63.2",
|
"react-native": "~0.63.2",
|
||||||
"react-native-reanimated": "~1.13.0",
|
"react-native-reanimated": "~1.13.0",
|
||||||
"react-navigation": "^4.4.3",
|
"react-navigation": "^4.4.4",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
import getChildrenNavigationCache from '../getChildrenNavigationCache';
|
||||||
|
|
||||||
|
it('should return empty table if navigation arg not provided', () => {
|
||||||
|
expect(getChildrenNavigationCache()._childrenNavigation).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should populate navigation._childrenNavigation as a side-effect', () => {
|
||||||
|
const navigation = {
|
||||||
|
state: {
|
||||||
|
routes: [{ key: 'one' }],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const result = getChildrenNavigationCache(navigation);
|
||||||
|
expect(result).toBeDefined();
|
||||||
|
expect(navigation._childrenNavigation).toBe(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete children cache keys that are no longer valid', () => {
|
||||||
|
const navigation = {
|
||||||
|
state: {
|
||||||
|
routes: [{ key: 'one' }, { key: 'two' }, { key: 'three' }],
|
||||||
|
},
|
||||||
|
_childrenNavigation: {
|
||||||
|
one: {},
|
||||||
|
two: {},
|
||||||
|
three: {},
|
||||||
|
four: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = getChildrenNavigationCache(navigation);
|
||||||
|
expect(result).toEqual({
|
||||||
|
one: {},
|
||||||
|
two: {},
|
||||||
|
three: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not delete children cache keys if in transitioning state', () => {
|
||||||
|
const navigation = {
|
||||||
|
state: {
|
||||||
|
routes: [{ key: 'one' }, { key: 'two' }, { key: 'three' }],
|
||||||
|
isTransitioning: true,
|
||||||
|
},
|
||||||
|
_childrenNavigation: {
|
||||||
|
one: {},
|
||||||
|
two: {},
|
||||||
|
three: {},
|
||||||
|
four: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = getChildrenNavigationCache(navigation);
|
||||||
|
expect(result).toEqual({
|
||||||
|
one: {},
|
||||||
|
two: {},
|
||||||
|
three: {},
|
||||||
|
four: {},
|
||||||
|
});
|
||||||
|
});
|
||||||
48
packages/core/src/__tests__/getEventManager.test.js
Normal file
48
packages/core/src/__tests__/getEventManager.test.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import getEventManager from '../getEventManager';
|
||||||
|
|
||||||
|
const TARGET = 'target';
|
||||||
|
|
||||||
|
it('calls listeners to emitted event', () => {
|
||||||
|
const eventManager = getEventManager(TARGET);
|
||||||
|
const callback = jest.fn();
|
||||||
|
eventManager.addListener('didFocus', callback);
|
||||||
|
|
||||||
|
eventManager.emit('didFocus');
|
||||||
|
|
||||||
|
expect(callback).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not call listeners connected to a different event', () => {
|
||||||
|
const eventManager = getEventManager(TARGET);
|
||||||
|
const callback = jest.fn();
|
||||||
|
eventManager.addListener('didFocus', callback);
|
||||||
|
|
||||||
|
eventManager.emit('didBlur');
|
||||||
|
|
||||||
|
expect(callback).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not call removed listeners', () => {
|
||||||
|
const eventManager = getEventManager(TARGET);
|
||||||
|
const callback = jest.fn();
|
||||||
|
const { remove } = eventManager.addListener('didFocus', callback);
|
||||||
|
|
||||||
|
eventManager.emit('didFocus');
|
||||||
|
expect(callback).toHaveBeenCalled();
|
||||||
|
|
||||||
|
remove();
|
||||||
|
|
||||||
|
eventManager.emit('didFocus');
|
||||||
|
expect(callback).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('calls the listeners with the given payload', () => {
|
||||||
|
const eventManager = getEventManager(TARGET);
|
||||||
|
const callback = jest.fn();
|
||||||
|
eventManager.addListener('didFocus', callback);
|
||||||
|
|
||||||
|
const payload = { foo: 0 };
|
||||||
|
eventManager.emit('didFocus', payload);
|
||||||
|
|
||||||
|
expect(callback).toHaveBeenCalledWith(payload);
|
||||||
|
});
|
||||||
@@ -3,6 +3,17 @@
|
|||||||
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.7.0](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.6.0...react-navigation-drawer@2.7.0) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add activityState to other navigators ([5c7f892](https://github.com/react-navigation/drawer/commit/5c7f892d77298f5c89534fa78a1a6a59c7f35a60))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.6.0](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.5.2...react-navigation-drawer@2.6.0) (2020-10-26)
|
# [2.6.0](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.5.2...react-navigation-drawer@2.6.0) (2020-10-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-drawer",
|
"name": "react-navigation-drawer",
|
||||||
"version": "2.6.0",
|
"version": "2.7.0",
|
||||||
"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",
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
"react-native-reanimated": "~1.13.0",
|
"react-native-reanimated": "~1.13.0",
|
||||||
"react-native-screens": "~2.10.1",
|
"react-native-screens": "~2.10.1",
|
||||||
"react-native-testing-library": "^6.0.0",
|
"react-native-testing-library": "^6.0.0",
|
||||||
"react-navigation": "^4.4.3",
|
"react-navigation": "^4.4.4",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
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,
|
||||||
|
// @ts-ignore
|
||||||
|
shouldUseActivityState,
|
||||||
|
} from 'react-native-screens';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
@@ -17,8 +22,17 @@ export default class ResourceSavingScene extends React.Component<Props> {
|
|||||||
if (screensEnabled?.() && this.props.enabled && Platform.OS !== 'web') {
|
if (screensEnabled?.() && this.props.enabled && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
if (shouldUseActivityState) {
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return (
|
||||||
|
// @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required
|
||||||
|
<Screen activityState={isVisible ? 2 : 0} {...rest} />
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
// @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required
|
||||||
|
<Screen active={isVisible ? 1 : 0} {...rest} />
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isVisible, children, style, ...rest } = this.props;
|
const { isVisible, children, style, ...rest } = this.props;
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
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-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.3.3...react-navigation-material-bottom-tabs@2.3.4) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.3.3](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.3.2...react-navigation-material-bottom-tabs@2.3.3) (2020-10-26)
|
## [2.3.3](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.3.2...react-navigation-material-bottom-tabs@2.3.3) (2020-10-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-material-bottom-tabs",
|
"name": "react-navigation-material-bottom-tabs",
|
||||||
"version": "2.3.3",
|
"version": "2.3.4",
|
||||||
"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",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"react": "~16.13.1",
|
"react": "~16.13.1",
|
||||||
"react-native": "~0.63.2",
|
"react-native": "~0.63.2",
|
||||||
"react-native-paper": "^4.2.0",
|
"react-native-paper": "^4.2.0",
|
||||||
"react-navigation": "^4.4.3",
|
"react-navigation": "^4.4.4",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
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.8.4](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.8.3...@react-navigation/native@3.8.4) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* address breaking change in react-native for Linking ([fb1e8d4](https://github.com/react-navigation/react-navigation-native/commit/fb1e8d4a077cece663633408d279459df66033a4))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.8.3](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.8.2...@react-navigation/native@3.8.3) (2020-10-26)
|
## [3.8.3](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.8.2...@react-navigation/native@3.8.3) (2020-10-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/native
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/native",
|
"name": "@react-navigation/native",
|
||||||
"version": "3.8.3",
|
"version": "3.8.4",
|
||||||
"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",
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ export default function createNavigationContainer(Component) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_statefulContainerCount++;
|
_statefulContainerCount++;
|
||||||
Linking.addEventListener('url', this._handleOpenURL);
|
this._linkingSub = Linking.addEventListener('url', this._handleOpenURL);
|
||||||
|
|
||||||
// Pull out anything that can impact state
|
// Pull out anything that can impact state
|
||||||
let parsedUrl = null;
|
let parsedUrl = null;
|
||||||
@@ -331,7 +331,14 @@ export default function createNavigationContainer(Component) {
|
|||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this._isMounted = false;
|
this._isMounted = false;
|
||||||
Linking.removeEventListener('url', this._handleOpenURL);
|
|
||||||
|
// https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7
|
||||||
|
if (this._linkingSub?.remove) {
|
||||||
|
this._linkingSub?.remove();
|
||||||
|
} else {
|
||||||
|
Linking.removeEventListener('url', this._handleOpenURL);
|
||||||
|
}
|
||||||
|
|
||||||
this.subs && this.subs.remove();
|
this.subs && this.subs.remove();
|
||||||
|
|
||||||
if (this._isStateful()) {
|
if (this._isStateful()) {
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
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.4.4](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.4.3...react-navigation@4.4.4) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [4.4.3](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.4.2...react-navigation@4.4.3) (2020-10-26)
|
## [4.4.3](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.4.2...react-navigation@4.4.3) (2020-10-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation",
|
"name": "react-navigation",
|
||||||
"version": "4.4.3",
|
"version": "4.4.4",
|
||||||
"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",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^3.7.9",
|
"@react-navigation/core": "^3.7.9",
|
||||||
"@react-navigation/native": "^3.8.3"
|
"@react-navigation/native": "^3.8.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
|
|||||||
@@ -3,6 +3,30 @@
|
|||||||
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.10.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.10.2...react-navigation-stack@2.10.3) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.10.2](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.10.1...react-navigation-stack@2.10.2) (2020-11-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.10.1](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.10.0...react-navigation-stack@2.10.1) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.10.0](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.9.0...react-navigation-stack@2.10.0) (2020-10-30)
|
# [2.10.0](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.9.0...react-navigation-stack@2.10.0) (2020-10-30)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-stack",
|
"name": "react-navigation-stack",
|
||||||
"version": "2.10.0",
|
"version": "2.10.3",
|
||||||
"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",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-native-community/masked-view": "0.1.10",
|
"@react-native-community/masked-view": "0.1.10",
|
||||||
"@react-navigation/stack": "^5.11.0",
|
"@react-navigation/stack": "^5.14.3",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"react-native-gesture-handler": "~1.7.0",
|
"react-native-gesture-handler": "~1.7.0",
|
||||||
"react-native-safe-area-context": "3.1.4",
|
"react-native-safe-area-context": "3.1.4",
|
||||||
"react-native-screens": "~2.10.1",
|
"react-native-screens": "~2.10.1",
|
||||||
"react-navigation": "^4.4.3",
|
"react-navigation": "^4.4.4",
|
||||||
"react-test-renderer": "~16.13.1",
|
"react-test-renderer": "~16.13.1",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/index.tsx 2020-10-26 16:08:35.000000000 +0100
|
+++ src/vendor/index.tsx 2020-11-10 21:04:07.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';
|
||||||
|
|
||||||
-/**
|
-/**
|
||||||
- * Navigators
|
- * Navigators
|
||||||
- */
|
- */
|
||||||
@@ -28,7 +28,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/i
|
|||||||
StackHeaderLeftButtonProps,
|
StackHeaderLeftButtonProps,
|
||||||
StackHeaderTitleProps,
|
StackHeaderTitleProps,
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-11-10 21:02:55.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,101 +0,0 @@
|
@@ -1,101 +0,0 @@
|
||||||
-import * as React from 'react';
|
-import * as React from 'react';
|
||||||
@@ -133,8 +133,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
|
|||||||
- 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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/types.tsx 2020-10-26 16:13:50.000000000 +0100
|
+++ src/vendor/types.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -8,15 +8,29 @@
|
@@ -8,15 +8,29 @@
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
@@ -170,20 +170,20 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
+ | 'didFocus'
|
+ | 'didFocus'
|
||||||
+ | 'willBlur'
|
+ | 'willBlur'
|
||||||
+ | 'didBlur';
|
+ | 'didBlur';
|
||||||
|
|
||||||
export type StackNavigationEventMap = {
|
export type StackNavigationEventMap = {
|
||||||
/**
|
/**
|
||||||
@@ -41,30 +55,29 @@
|
@@ -41,30 +55,29 @@
|
||||||
gestureCancel: { data: undefined };
|
gestureCancel: { data: undefined };
|
||||||
};
|
};
|
||||||
|
|
||||||
-export type StackNavigationHelpers = NavigationHelpers<
|
-export type StackNavigationHelpers = NavigationHelpers<
|
||||||
- ParamListBase,
|
- ParamListBase,
|
||||||
- StackNavigationEventMap
|
- StackNavigationEventMap
|
||||||
-> &
|
-> &
|
||||||
- StackActionHelpers<ParamListBase>;
|
- StackActionHelpers<ParamListBase>;
|
||||||
+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
|
||||||
@@ -223,9 +223,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
+ callback: NavigationEventCallback
|
+ callback: NavigationEventCallback
|
||||||
+ ) => NavigationEventSubscription;
|
+ ) => NavigationEventSubscription;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Layout = { width: number; height: number };
|
export type Layout = { width: number; height: number };
|
||||||
@@ -241,24 +254,27 @@
|
@@ -245,24 +258,27 @@
|
||||||
/**
|
/**
|
||||||
* Navigation prop for the header.
|
* Navigation prop for the header.
|
||||||
*/
|
*/
|
||||||
@@ -236,7 +236,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
*/
|
*/
|
||||||
styleInterpolator: StackHeaderStyleInterpolator;
|
styleInterpolator: StackHeaderStyleInterpolator;
|
||||||
};
|
};
|
||||||
|
|
||||||
-export type StackDescriptor = Descriptor<
|
-export type StackDescriptor = Descriptor<
|
||||||
- ParamListBase,
|
- ParamListBase,
|
||||||
- string,
|
- string,
|
||||||
@@ -247,11 +247,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
+ StackNavigationOptions,
|
+ StackNavigationOptions,
|
||||||
+ StackNavigationProp
|
+ StackNavigationProp
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type StackDescriptorMap = {
|
export type StackDescriptorMap = {
|
||||||
[key: string]: StackDescriptor;
|
[key: string]: StackDescriptor;
|
||||||
};
|
};
|
||||||
|
|
||||||
+export type TransitionCallbackProps = {
|
+export type TransitionCallbackProps = {
|
||||||
+ closing: boolean;
|
+ closing: boolean;
|
||||||
+};
|
+};
|
||||||
@@ -259,38 +259,29 @@ 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> & {
|
||||||
/**
|
/**
|
||||||
@@ -352,6 +368,8 @@
|
@@ -356,6 +372,8 @@
|
||||||
* Defaults to `false` for the last screen when mode='modal', otherwise `true`.
|
* Defaults to `false` for the last screen when mode='modal', otherwise `true`.
|
||||||
*/
|
*/
|
||||||
detachPreviousScreen?: boolean;
|
detachPreviousScreen?: boolean;
|
||||||
+ onTransitionStart?: (props: TransitionCallbackProps) => void;
|
+ onTransitionStart?: (props: TransitionCallbackProps) => void;
|
||||||
+ onTransitionEnd?: (props: TransitionCallbackProps) => void;
|
+ onTransitionEnd?: (props: TransitionCallbackProps) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationConfig = {
|
export type StackNavigationConfig = {
|
||||||
@@ -365,7 +383,7 @@
|
|
||||||
/**
|
|
||||||
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
|
||||||
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
|
||||||
- * Defaults to `true`.
|
|
||||||
+ * Defaults to `true` on Android, `false` on iOS.
|
|
||||||
*/
|
|
||||||
detachInactiveScreens?: boolean;
|
|
||||||
};
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/utils/PreviousSceneContext.tsx src/vendor/utils/PreviousSceneContext.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/utils/PreviousSceneContext.tsx src/vendor/utils/PreviousSceneContext.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/utils/PreviousSceneContext.tsx 2020-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/utils/PreviousSceneContext.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/utils/PreviousSceneContext.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/utils/PreviousSceneContext.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -1,6 +1,5 @@
|
@@ -1,6 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import type { Route } from '@react-navigation/native';
|
-import type { Route } from '@react-navigation/native';
|
||||||
-import type { Scene } from '../types';
|
-import type { Scene } from '../types';
|
||||||
+import type { Route, Scene } from '../types';
|
+import type { Route, Scene } from '../types';
|
||||||
|
|
||||||
const PreviousSceneContext = React.createContext<
|
const PreviousSceneContext = React.createContext<
|
||||||
Scene<Route<string>> | undefined
|
Scene<Route<string>> | undefined
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/Header.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/views/Header/Header.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -1,12 +1,15 @@
|
@@ -1,12 +1,15 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import { StackActions } from '@react-navigation/native';
|
-import { StackActions } from '@react-navigation/native';
|
||||||
@@ -299,12 +290,12 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
+import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
+import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
||||||
+
|
+
|
||||||
+import HeaderSegment, { getDefaultHeaderHeight } from './HeaderSegment';
|
+import HeaderSegment, { getDefaultHeaderHeight } from './HeaderSegment';
|
||||||
|
|
||||||
-import HeaderSegment from './HeaderSegment';
|
-import HeaderSegment from './HeaderSegment';
|
||||||
import HeaderTitle from './HeaderTitle';
|
import HeaderTitle from './HeaderTitle';
|
||||||
import debounce from '../../utils/debounce';
|
import debounce from '../../utils/debounce';
|
||||||
import type { StackHeaderProps, StackHeaderTitleProps } from '../../types';
|
import type { StackHeaderProps, StackHeaderTitleProps } from '../../types';
|
||||||
|
|
||||||
-export default React.memo(function Header(props: StackHeaderProps) {
|
-export default React.memo(function Header(props: StackHeaderProps) {
|
||||||
+const Header = React.memo(function Header(props: StackHeaderProps) {
|
+const Header = React.memo(function Header(props: StackHeaderProps) {
|
||||||
const {
|
const {
|
||||||
@@ -316,9 +307,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
? options.title
|
? options.title
|
||||||
- : scene.route.name;
|
- : scene.route.name;
|
||||||
+ : scene.route.routeName;
|
+ : scene.route.routeName;
|
||||||
|
|
||||||
let leftLabel;
|
let leftLabel;
|
||||||
|
|
||||||
@@ -38,17 +41,20 @@
|
@@ -38,17 +41,20 @@
|
||||||
? o.headerTitle
|
? o.headerTitle
|
||||||
: o.title !== undefined
|
: o.title !== undefined
|
||||||
@@ -326,7 +317,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
- : previous.route.name;
|
- : previous.route.name;
|
||||||
+ : previous.route.routeName;
|
+ : previous.route.routeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
const goBack = React.useCallback(
|
const goBack = React.useCallback(
|
||||||
debounce(() => {
|
debounce(() => {
|
||||||
@@ -378,8 +369,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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-10-26 16:14:24.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -8,9 +8,9 @@
|
@@ -8,9 +8,9 @@
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
LayoutChangeEvent,
|
LayoutChangeEvent,
|
||||||
@@ -389,23 +380,23 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
|||||||
import TouchableItem from '../TouchableItem';
|
import TouchableItem from '../TouchableItem';
|
||||||
+import useTheme from '../../../utils/useTheme';
|
+import useTheme from '../../../utils/useTheme';
|
||||||
import type { StackHeaderLeftButtonProps } from '../../types';
|
import type { StackHeaderLeftButtonProps } from '../../types';
|
||||||
|
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -7,7 +7,7 @@
|
@@ -7,7 +7,7 @@
|
||||||
StyleProp,
|
StyleProp,
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
-import { useTheme } from '@react-navigation/native';
|
-import { useTheme } from '@react-navigation/native';
|
||||||
+import useTheme from '../../../utils/useTheme';
|
+import useTheme from '../../../utils/useTheme';
|
||||||
|
|
||||||
type Props = ViewProps & {
|
type Props = ViewProps & {
|
||||||
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-10-26 16:15:18.000000000 +0100
|
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -1,11 +1,6 @@
|
@@ -1,11 +1,6 @@
|
||||||
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';
|
||||||
@@ -417,9 +408,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
|||||||
-} from '@react-navigation/native';
|
-} from '@react-navigation/native';
|
||||||
+import { NavigationContext } from 'react-navigation';
|
+import { NavigationContext } from 'react-navigation';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
|
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
@@ -19,6 +14,7 @@
|
@@ -18,6 +13,7 @@
|
||||||
import PreviousSceneContext from '../../utils/PreviousSceneContext';
|
import PreviousSceneContext from '../../utils/PreviousSceneContext';
|
||||||
import type {
|
import type {
|
||||||
Layout,
|
Layout,
|
||||||
@@ -427,7 +418,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
|||||||
Scene,
|
Scene,
|
||||||
StackHeaderStyleInterpolator,
|
StackHeaderStyleInterpolator,
|
||||||
StackNavigationProp,
|
StackNavigationProp,
|
||||||
@@ -105,9 +101,7 @@
|
@@ -99,9 +95,7 @@
|
||||||
insets,
|
insets,
|
||||||
scene,
|
scene,
|
||||||
previous,
|
previous,
|
||||||
@@ -438,7 +429,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
|||||||
styleInterpolator:
|
styleInterpolator:
|
||||||
mode === 'float'
|
mode === 'float'
|
||||||
? isHeaderStatic
|
? isHeaderStatic
|
||||||
@@ -126,7 +120,7 @@
|
@@ -120,7 +114,7 @@
|
||||||
key={scene.route.key}
|
key={scene.route.key}
|
||||||
value={scene.descriptor.navigation}
|
value={scene.descriptor.navigation}
|
||||||
>
|
>
|
||||||
@@ -447,7 +438,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
|||||||
<View
|
<View
|
||||||
onLayout={
|
onLayout={
|
||||||
onContentHeightChange
|
onContentHeightChange
|
||||||
@@ -155,7 +149,7 @@
|
@@ -149,7 +143,7 @@
|
||||||
>
|
>
|
||||||
{header !== undefined ? header(props) : <Header {...props} />}
|
{header !== undefined ? header(props) : <Header {...props} />}
|
||||||
</View>
|
</View>
|
||||||
@@ -457,8 +448,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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -8,7 +8,7 @@
|
@@ -8,7 +8,7 @@
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
@@ -476,34 +467,34 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSeg
|
|||||||
+ scene: Scene<NavigationRoute>;
|
+ scene: Scene<NavigationRoute>;
|
||||||
styleInterpolator: StackHeaderStyleInterpolator;
|
styleInterpolator: StackHeaderStyleInterpolator;
|
||||||
};
|
};
|
||||||
|
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-10-26 16:14:52.000000000 +0100
|
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -7,7 +7,7 @@
|
@@ -7,7 +7,7 @@
|
||||||
StyleProp,
|
StyleProp,
|
||||||
TextStyle,
|
TextStyle,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
-import { useTheme } from '@react-navigation/native';
|
-import { useTheme } from '@react-navigation/native';
|
||||||
+import useTheme from '../../../utils/useTheme';
|
+import useTheme from '../../../utils/useTheme';
|
||||||
|
|
||||||
type Props = Omit<TextProps, 'style'> & {
|
type Props = Omit<TextProps, 'style'> & {
|
||||||
tintColor?: string;
|
tintColor?: 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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/Card.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/views/Stack/Card.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -162,7 +162,7 @@
|
@@ -162,7 +162,7 @@
|
||||||
|
|
||||||
private interactionHandle: number | undefined;
|
private interactionHandle: number | undefined;
|
||||||
|
|
||||||
- private pendingGestureCallback: number | undefined;
|
- private pendingGestureCallback: number | undefined;
|
||||||
+ private pendingGestureCallback: any;
|
+ private pendingGestureCallback: any;
|
||||||
|
|
||||||
private lastToValue: number | undefined;
|
private lastToValue: number | undefined;
|
||||||
|
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardContainer.tsx 2020-10-26 16:08:40.000000000 +0100
|
+++ src/vendor/views/Stack/CardContainer.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -1,12 +1,13 @@
|
@@ -1,12 +1,13 @@
|
||||||
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';
|
||||||
@@ -520,10 +511,10 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
Layout,
|
Layout,
|
||||||
StackHeaderMode,
|
StackHeaderMode,
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardStack.tsx 2020-10-26 16:17:14.000000000 +0100
|
+++ src/vendor/views/Stack/CardStack.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -7,11 +7,7 @@
|
@@ -6,11 +6,7 @@
|
||||||
Platform,
|
Dimensions,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
-import type {
|
-import type {
|
||||||
@@ -532,10 +523,10 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
- StackNavigationState,
|
- StackNavigationState,
|
||||||
-} from '@react-navigation/native';
|
-} from '@react-navigation/native';
|
||||||
+import type { NavigationState as StackNavigationState } from 'react-navigation';
|
+import type { NavigationState as StackNavigationState } from 'react-navigation';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MaybeScreenContainer,
|
MaybeScreenContainer,
|
||||||
@@ -32,6 +28,7 @@
|
@@ -31,6 +27,7 @@
|
||||||
Layout,
|
Layout,
|
||||||
StackHeaderMode,
|
StackHeaderMode,
|
||||||
StackCardMode,
|
StackCardMode,
|
||||||
@@ -543,7 +534,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
Scene,
|
Scene,
|
||||||
StackDescriptorMap,
|
StackDescriptorMap,
|
||||||
StackNavigationOptions,
|
StackNavigationOptions,
|
||||||
@@ -45,7 +42,7 @@
|
@@ -44,7 +41,7 @@
|
||||||
type Props = {
|
type Props = {
|
||||||
mode: StackCardMode;
|
mode: StackCardMode;
|
||||||
insets: EdgeInsets;
|
insets: EdgeInsets;
|
||||||
@@ -553,8 +544,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
routes: Route<string>[];
|
routes: Route<string>[];
|
||||||
openingRouteKeys: string[];
|
openingRouteKeys: string[];
|
||||||
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-10-26 16:07:00.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-11-10 21:02:55.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/StackView.tsx 2020-10-26 16:20:15.000000000 +0100
|
+++ src/vendor/views/Stack/StackView.tsx 2020-11-10 21:04:07.000000000 +0100
|
||||||
@@ -2,12 +2,11 @@
|
@@ -2,12 +2,11 @@
|
||||||
import { View, Platform, StyleSheet } from 'react-native';
|
import { View, Platform, StyleSheet } from 'react-native';
|
||||||
import { SafeAreaConsumer, EdgeInsets } from 'react-native-safe-area-context';
|
import { SafeAreaConsumer, EdgeInsets } from 'react-native-safe-area-context';
|
||||||
@@ -569,7 +560,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
+ NavigationActions,
|
+ NavigationActions,
|
||||||
+ SceneView,
|
+ SceneView,
|
||||||
+} from 'react-navigation';
|
+} from 'react-navigation';
|
||||||
|
|
||||||
import { GestureHandlerRootView } from '../GestureHandler';
|
import { GestureHandlerRootView } from '../GestureHandler';
|
||||||
import CardStack from './CardStack';
|
import CardStack from './CardStack';
|
||||||
@@ -17,6 +16,7 @@
|
@@ -17,6 +16,7 @@
|
||||||
@@ -582,7 +573,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
StackDescriptorMap,
|
StackDescriptorMap,
|
||||||
@@ -24,9 +24,10 @@
|
@@ -24,9 +24,10 @@
|
||||||
import HeaderShownContext from '../../utils/HeaderShownContext';
|
import HeaderShownContext from '../../utils/HeaderShownContext';
|
||||||
|
|
||||||
type Props = StackNavigationConfig & {
|
type Props = StackNavigationConfig & {
|
||||||
- state: StackNavigationState<ParamListBase>;
|
- state: StackNavigationState<ParamListBase>;
|
||||||
+ state: StackNavigationState;
|
+ state: StackNavigationState;
|
||||||
@@ -590,23 +581,23 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
descriptors: StackDescriptorMap;
|
descriptors: StackDescriptorMap;
|
||||||
+ screenProps: unknown;
|
+ screenProps: unknown;
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
@@ -295,7 +296,9 @@
|
@@ -295,7 +296,9 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- return gestureEnabled !== false;
|
- return gestureEnabled !== false;
|
||||||
+ return gestureEnabled !== undefined
|
+ return gestureEnabled !== undefined
|
||||||
+ ? gestureEnabled
|
+ ? gestureEnabled
|
||||||
+ : Platform.OS !== 'android';
|
+ : Platform.OS !== 'android';
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -323,26 +326,49 @@
|
@@ -323,26 +326,49 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
- return descriptor.render();
|
- return descriptor.render();
|
||||||
+ const { navigation, getComponent } = descriptor;
|
+ const { navigation, getComponent } = descriptor;
|
||||||
+ const SceneComponent = getComponent();
|
+ const SceneComponent = getComponent();
|
||||||
@@ -619,11 +610,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
+ />
|
+ />
|
||||||
+ );
|
+ );
|
||||||
};
|
};
|
||||||
|
|
||||||
private renderHeader = (props: HeaderContainerProps) => {
|
private renderHeader = (props: HeaderContainerProps) => {
|
||||||
return <HeaderContainer {...props} />;
|
return <HeaderContainer {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
+ private handleTransitionComplete = () => {
|
+ private handleTransitionComplete = () => {
|
||||||
+ const { state, navigation } = this.props;
|
+ const { state, navigation } = this.props;
|
||||||
+
|
+
|
||||||
@@ -640,7 +631,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
const { state, navigation } = this.props;
|
const { state, navigation } = this.props;
|
||||||
const { closingRouteKeys, replacingRouteKeys } = this.state;
|
const { closingRouteKeys, replacingRouteKeys } = this.state;
|
||||||
|
|
||||||
+ this.handleTransitionComplete();
|
+ this.handleTransitionComplete();
|
||||||
+
|
+
|
||||||
if (
|
if (
|
||||||
@@ -690,7 +681,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
+
|
+
|
||||||
+ descriptor?.options.onTransitionStart?.({ closing });
|
+ descriptor?.options.onTransitionStart?.({ closing });
|
||||||
+ };
|
+ };
|
||||||
|
|
||||||
private handleTransitionEnd = (
|
private handleTransitionEnd = (
|
||||||
{ route }: { route: Route<string> },
|
{ route }: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -739,7 +730,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
+ private handleGestureCancel = () => {
|
+ private handleGestureCancel = () => {
|
||||||
+ // Do nothing
|
+ // Do nothing
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
@@ -749,7 +740,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
mode = 'card',
|
mode = 'card',
|
||||||
@@ -450,7 +469,7 @@
|
@@ -450,7 +469,7 @@
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
- <NavigationHelpersContext.Provider value={navigation}>
|
- <NavigationHelpersContext.Provider value={navigation}>
|
||||||
+ <>
|
+ <>
|
||||||
|
|||||||
@@ -152,16 +152,21 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
|
|||||||
onGestureCanceled={[Function]}
|
onGestureCanceled={[Function]}
|
||||||
onGestureEnd={[Function]}
|
onGestureEnd={[Function]}
|
||||||
onOpen={[Function]}
|
onOpen={[Function]}
|
||||||
onTransitionStart={[Function]}
|
onTransition={[Function]}
|
||||||
pointerEvents="box-none"
|
pointerEvents="box-none"
|
||||||
style={
|
style={
|
||||||
Object {
|
Array [
|
||||||
"bottom": 0,
|
Object {
|
||||||
"left": 0,
|
"overflow": undefined,
|
||||||
"position": "absolute",
|
},
|
||||||
"right": 0,
|
Object {
|
||||||
"top": 0,
|
"bottom": 0,
|
||||||
}
|
"left": 0,
|
||||||
|
"position": "absolute",
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
transitionSpec={
|
transitionSpec={
|
||||||
Object {
|
Object {
|
||||||
@@ -283,6 +288,112 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
<View
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"zIndex": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
accessibilityElementsHidden={false}
|
||||||
|
importantForAccessibility="auto"
|
||||||
|
onLayout={[Function]}
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={null}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"bottom": 0,
|
||||||
|
"left": 0,
|
||||||
|
"opacity": 1,
|
||||||
|
"position": "absolute",
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
"zIndex": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"backgroundColor": "#fff",
|
||||||
|
"borderBottomColor": "#a7a7aa",
|
||||||
|
"flex": 1,
|
||||||
|
"shadowColor": "#a7a7aa",
|
||||||
|
"shadowOffset": Object {
|
||||||
|
"height": 0.5,
|
||||||
|
"width": 0,
|
||||||
|
},
|
||||||
|
"shadowOpacity": 0.85,
|
||||||
|
"shadowRadius": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": 44,
|
||||||
|
"maxHeight": undefined,
|
||||||
|
"minHeight": undefined,
|
||||||
|
"opacity": undefined,
|
||||||
|
"transform": undefined,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
pointerEvents="none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<View
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"alignItems": "center",
|
||||||
|
"flex": 1,
|
||||||
|
"flexDirection": "row",
|
||||||
|
"justifyContent": "center",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<View
|
||||||
|
pointerEvents="box-none"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"marginHorizontal": 16,
|
||||||
|
"opacity": 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Text
|
||||||
|
accessibilityRole="header"
|
||||||
|
aria-level="1"
|
||||||
|
numberOfLines={1}
|
||||||
|
onLayout={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"color": "rgba(0, 0, 0, 0.9)",
|
||||||
|
"fontSize": 17,
|
||||||
|
"fontWeight": "600",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
Home
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
<View
|
<View
|
||||||
onLayout={[Function]}
|
onLayout={[Function]}
|
||||||
style={
|
style={
|
||||||
@@ -321,16 +432,21 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
|
|||||||
onGestureCanceled={[Function]}
|
onGestureCanceled={[Function]}
|
||||||
onGestureEnd={[Function]}
|
onGestureEnd={[Function]}
|
||||||
onOpen={[Function]}
|
onOpen={[Function]}
|
||||||
onTransitionStart={[Function]}
|
onTransition={[Function]}
|
||||||
pointerEvents="box-none"
|
pointerEvents="box-none"
|
||||||
style={
|
style={
|
||||||
Object {
|
Array [
|
||||||
"bottom": 0,
|
Object {
|
||||||
"left": 0,
|
"overflow": undefined,
|
||||||
"position": "absolute",
|
},
|
||||||
"right": 0,
|
Object {
|
||||||
"top": 0,
|
"bottom": 0,
|
||||||
}
|
"left": 0,
|
||||||
|
"position": "absolute",
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
transitionSpec={
|
transitionSpec={
|
||||||
Object {
|
Object {
|
||||||
@@ -365,7 +481,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
|
|||||||
style={
|
style={
|
||||||
Object {
|
Object {
|
||||||
"flex": 1,
|
"flex": 1,
|
||||||
"marginTop": 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -454,19 +569,6 @@ exports[`Nested navigators renders succesfully as direct child 1`] = `
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View
|
|
||||||
pointerEvents="box-none"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"height": 44,
|
|
||||||
"left": 0,
|
|
||||||
"position": "absolute",
|
|
||||||
"right": 0,
|
|
||||||
"top": 0,
|
|
||||||
"zIndex": 1,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -169,16 +169,21 @@ exports[`StackNavigator applies correct values when headerRight is present 1`] =
|
|||||||
onGestureCanceled={[Function]}
|
onGestureCanceled={[Function]}
|
||||||
onGestureEnd={[Function]}
|
onGestureEnd={[Function]}
|
||||||
onOpen={[Function]}
|
onOpen={[Function]}
|
||||||
onTransitionStart={[Function]}
|
onTransition={[Function]}
|
||||||
pointerEvents="box-none"
|
pointerEvents="box-none"
|
||||||
style={
|
style={
|
||||||
Object {
|
Array [
|
||||||
"bottom": 0,
|
Object {
|
||||||
"left": 0,
|
"overflow": undefined,
|
||||||
"position": "absolute",
|
},
|
||||||
"right": 0,
|
Object {
|
||||||
"top": 0,
|
"bottom": 0,
|
||||||
}
|
"left": 0,
|
||||||
|
"position": "absolute",
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
transitionSpec={
|
transitionSpec={
|
||||||
Object {
|
Object {
|
||||||
@@ -457,16 +462,21 @@ exports[`StackNavigator renders successfully 1`] = `
|
|||||||
onGestureCanceled={[Function]}
|
onGestureCanceled={[Function]}
|
||||||
onGestureEnd={[Function]}
|
onGestureEnd={[Function]}
|
||||||
onOpen={[Function]}
|
onOpen={[Function]}
|
||||||
onTransitionStart={[Function]}
|
onTransition={[Function]}
|
||||||
pointerEvents="box-none"
|
pointerEvents="box-none"
|
||||||
style={
|
style={
|
||||||
Object {
|
Array [
|
||||||
"bottom": 0,
|
Object {
|
||||||
"left": 0,
|
"overflow": undefined,
|
||||||
"position": "absolute",
|
},
|
||||||
"right": 0,
|
Object {
|
||||||
"top": 0,
|
"bottom": 0,
|
||||||
}
|
"left": 0,
|
||||||
|
"position": "absolute",
|
||||||
|
"right": 0,
|
||||||
|
"top": 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
transitionSpec={
|
transitionSpec={
|
||||||
Object {
|
Object {
|
||||||
|
|||||||
1
packages/stack/src/vendor/index.tsx
vendored
1
packages/stack/src/vendor/index.tsx
vendored
@@ -57,4 +57,5 @@ export type {
|
|||||||
StackHeaderInterpolatedStyle,
|
StackHeaderInterpolatedStyle,
|
||||||
StackHeaderInterpolationProps,
|
StackHeaderInterpolationProps,
|
||||||
StackHeaderStyleInterpolator,
|
StackHeaderStyleInterpolator,
|
||||||
|
TransitionPreset,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|||||||
6
packages/stack/src/vendor/types.tsx
vendored
6
packages/stack/src/vendor/types.tsx
vendored
@@ -158,6 +158,10 @@ export type StackHeaderOptions = {
|
|||||||
* Whether back button title font should scale to respect Text Size accessibility settings. Defaults to `false`.
|
* Whether back button title font should scale to respect Text Size accessibility settings. Defaults to `false`.
|
||||||
*/
|
*/
|
||||||
headerBackAllowFontScaling?: boolean;
|
headerBackAllowFontScaling?: boolean;
|
||||||
|
/**
|
||||||
|
* Accessibility label for the header back button.
|
||||||
|
*/
|
||||||
|
headerBackAccessibilityLabel?: string;
|
||||||
/**
|
/**
|
||||||
* Title string used by the back button on iOS. Defaults to the previous scene's `headerTitle`.
|
* Title string used by the back button on iOS. Defaults to the previous scene's `headerTitle`.
|
||||||
* Use `headerBackTitleVisible: false` to hide it.
|
* Use `headerBackTitleVisible: false` to hide it.
|
||||||
@@ -383,7 +387,7 @@ export type StackNavigationConfig = {
|
|||||||
/**
|
/**
|
||||||
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
||||||
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
||||||
* Defaults to `true` on Android, `false` on iOS.
|
* Defaults to `true` on Android, depends on the version of `react-native-screens` on iOS.
|
||||||
*/
|
*/
|
||||||
detachInactiveScreens?: boolean;
|
detachInactiveScreens?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
|
|||||||
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
||||||
|
|
||||||
type Props = React.ComponentProps<typeof BaseButton> & {
|
type Props = React.ComponentProps<typeof BaseButton> & {
|
||||||
activeOpacity: number;
|
pressOpacity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeDriver = Platform.OS !== 'web';
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
@@ -27,7 +27,7 @@ export default class BorderlessButton extends React.Component<Props> {
|
|||||||
overshootClamping: true,
|
overshootClamping: true,
|
||||||
restDisplacementThreshold: 0.01,
|
restDisplacementThreshold: 0.01,
|
||||||
restSpeedThreshold: 0.01,
|
restSpeedThreshold: 0.01,
|
||||||
toValue: active ? this.props.activeOpacity : 1,
|
toValue: active ? this.props.pressOpacity : 1,
|
||||||
useNativeDriver,
|
useNativeDriver,
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {
|
|||||||
forNoAnimation,
|
forNoAnimation,
|
||||||
forSlideRight,
|
forSlideRight,
|
||||||
} from '../../TransitionConfigs/HeaderStyleInterpolators';
|
} from '../../TransitionConfigs/HeaderStyleInterpolators';
|
||||||
import HeaderShownContext from '../../utils/HeaderShownContext';
|
|
||||||
import PreviousSceneContext from '../../utils/PreviousSceneContext';
|
import PreviousSceneContext from '../../utils/PreviousSceneContext';
|
||||||
import type {
|
import type {
|
||||||
Layout,
|
Layout,
|
||||||
@@ -52,7 +51,6 @@ export default function HeaderContainer({
|
|||||||
style,
|
style,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const focusedRoute = getFocusedRoute();
|
const focusedRoute = getFocusedRoute();
|
||||||
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
|
||||||
const parentPreviousScene = React.useContext(PreviousSceneContext);
|
const parentPreviousScene = React.useContext(PreviousSceneContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -62,11 +60,8 @@ export default function HeaderContainer({
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const { header, headerShown = true, headerTransparent } =
|
||||||
header,
|
scene.descriptor.options || {};
|
||||||
headerShown = isParentHeaderShown === false,
|
|
||||||
headerTransparent,
|
|
||||||
} = scene.descriptor.options || {};
|
|
||||||
|
|
||||||
if (!headerShown) {
|
if (!headerShown) {
|
||||||
return null;
|
return null;
|
||||||
@@ -81,11 +76,10 @@ export default function HeaderContainer({
|
|||||||
const previousScene = self[i - 1];
|
const previousScene = self[i - 1];
|
||||||
const nextScene = self[i + 1];
|
const nextScene = self[i + 1];
|
||||||
|
|
||||||
const {
|
const { headerShown: previousHeaderShown = true } =
|
||||||
headerShown: previousHeaderShown = isParentHeaderShown === false,
|
previousScene?.descriptor.options || {};
|
||||||
} = previousScene?.descriptor.options || {};
|
|
||||||
|
|
||||||
const { headerShown: nextHeaderShown = isParentHeaderShown === false } =
|
const { headerShown: nextHeaderShown = true } =
|
||||||
nextScene?.descriptor.options || {};
|
nextScene?.descriptor.options || {};
|
||||||
|
|
||||||
const isHeaderStatic =
|
const isHeaderStatic =
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ export default function HeaderSegment(props: Props) {
|
|||||||
headerBackTitleVisible,
|
headerBackTitleVisible,
|
||||||
headerTruncatedBackTitle: truncatedLabel,
|
headerTruncatedBackTitle: truncatedLabel,
|
||||||
headerPressColorAndroid: pressColorAndroid,
|
headerPressColorAndroid: pressColorAndroid,
|
||||||
|
headerBackAccessibilityLabel: backAccessibilityLabel,
|
||||||
headerBackAllowFontScaling: backAllowFontScaling,
|
headerBackAllowFontScaling: backAllowFontScaling,
|
||||||
headerTitleAllowFontScaling: titleAllowFontScaling,
|
headerTitleAllowFontScaling: titleAllowFontScaling,
|
||||||
headerTitleStyle: customTitleStyle,
|
headerTitleStyle: customTitleStyle,
|
||||||
@@ -290,6 +291,7 @@ export default function HeaderSegment(props: Props) {
|
|||||||
? left({
|
? left({
|
||||||
backImage,
|
backImage,
|
||||||
pressColorAndroid,
|
pressColorAndroid,
|
||||||
|
accessibilityLabel: backAccessibilityLabel,
|
||||||
allowFontScaling: backAllowFontScaling,
|
allowFontScaling: backAllowFontScaling,
|
||||||
onPress: onGoBack,
|
onPress: onGoBack,
|
||||||
labelVisible: headerBackTitleVisible,
|
labelVisible: headerBackTitleVisible,
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { TextInput, Platform, Keyboard } from 'react-native';
|
import { TextInput, Keyboard, HostComponent } from 'react-native';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
children: (props: {
|
children: (props: {
|
||||||
onPageChangeStart: () => void;
|
onPageChangeStart: () => void;
|
||||||
onPageChangeConfirm: () => void;
|
onPageChangeConfirm: (force: boolean) => void;
|
||||||
onPageChangeCancel: () => void;
|
onPageChangeCancel: () => void;
|
||||||
}) => React.ReactNode;
|
}) => React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type InputRef = React.ElementRef<HostComponent<unknown>> | undefined;
|
||||||
|
|
||||||
export default class KeyboardManager extends React.Component<Props> {
|
export default class KeyboardManager extends React.Component<Props> {
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
@@ -17,7 +19,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
|
|
||||||
// Numeric id of the previously focused text input
|
// Numeric id of the previously focused text input
|
||||||
// When a gesture didn't change the tab, we can restore the focused input with this
|
// When a gesture didn't change the tab, we can restore the focused input with this
|
||||||
private previouslyFocusedTextInput: any | null = null;
|
private previouslyFocusedTextInput: InputRef = undefined;
|
||||||
private startTimestamp: number = 0;
|
private startTimestamp: number = 0;
|
||||||
private keyboardTimeout: any;
|
private keyboardTimeout: any;
|
||||||
|
|
||||||
@@ -35,7 +37,8 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
const input: any = TextInput.State.currentlyFocusedInput
|
// @ts-expect-error: blurTextInput accepts both number and ref, but types say only ref
|
||||||
|
const input: InputRef = TextInput.State.currentlyFocusedInput
|
||||||
? TextInput.State.currentlyFocusedInput()
|
? TextInput.State.currentlyFocusedInput()
|
||||||
: TextInput.State.currentlyFocusedField();
|
: TextInput.State.currentlyFocusedField();
|
||||||
|
|
||||||
@@ -49,23 +52,30 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
this.startTimestamp = Date.now();
|
this.startTimestamp = Date.now();
|
||||||
};
|
};
|
||||||
|
|
||||||
private handlePageChangeConfirm = () => {
|
private handlePageChangeConfirm = (force: boolean) => {
|
||||||
if (!this.props.enabled) {
|
if (!this.props.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
const input = this.previouslyFocusedTextInput;
|
if (force) {
|
||||||
|
// Always dismiss input, even if we don't have a ref to it
|
||||||
if (Platform.OS === 'android') {
|
// We might not have the ref if onPageChangeStart was never called
|
||||||
|
// This can happen if page change was not from a gesture
|
||||||
Keyboard.dismiss();
|
Keyboard.dismiss();
|
||||||
} else if (input) {
|
} else {
|
||||||
TextInput.State.blurTextInput(input);
|
const input = this.previouslyFocusedTextInput;
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
// Dismiss the keyboard only if an input was a focused before
|
||||||
|
// This makes sure we don't dismiss input on going back and focusing an input
|
||||||
|
TextInput.State.blurTextInput(input);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup the ID on successful page change
|
// Cleanup the ID on successful page change
|
||||||
this.previouslyFocusedTextInput = null;
|
this.previouslyFocusedTextInput = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
private handlePageChangeCancel = () => {
|
private handlePageChangeCancel = () => {
|
||||||
@@ -89,11 +99,11 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
if (Date.now() - this.startTimestamp < 100) {
|
if (Date.now() - this.startTimestamp < 100) {
|
||||||
this.keyboardTimeout = setTimeout(() => {
|
this.keyboardTimeout = setTimeout(() => {
|
||||||
TextInput.State.focusTextInput(input);
|
TextInput.State.focusTextInput(input);
|
||||||
this.previouslyFocusedTextInput = null;
|
this.previouslyFocusedTextInput = undefined;
|
||||||
}, 100);
|
}, 100);
|
||||||
} else {
|
} else {
|
||||||
TextInput.State.focusTextInput(input);
|
TextInput.State.focusTextInput(input);
|
||||||
this.previouslyFocusedTextInput = null;
|
this.previouslyFocusedTextInput = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ type Props = ViewProps & {
|
|||||||
gestureDirection: GestureDirection;
|
gestureDirection: GestureDirection;
|
||||||
onOpen: () => void;
|
onOpen: () => void;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
onTransitionStart?: (props: { closing: boolean }) => void;
|
onTransition?: (props: { closing: boolean; gesture: boolean }) => void;
|
||||||
onGestureBegin?: () => void;
|
onGestureBegin?: () => void;
|
||||||
onGestureCanceled?: () => void;
|
onGestureCanceled?: () => void;
|
||||||
onGestureEnd?: () => void;
|
onGestureEnd?: () => void;
|
||||||
@@ -178,7 +178,7 @@ export default class Card extends React.Component<Props> {
|
|||||||
transitionSpec,
|
transitionSpec,
|
||||||
onOpen,
|
onOpen,
|
||||||
onClose,
|
onClose,
|
||||||
onTransitionStart,
|
onTransition,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const toValue = this.getAnimateToValue({
|
const toValue = this.getAnimateToValue({
|
||||||
@@ -198,7 +198,7 @@ export default class Card extends React.Component<Props> {
|
|||||||
|
|
||||||
clearTimeout(this.pendingGestureCallback);
|
clearTimeout(this.pendingGestureCallback);
|
||||||
|
|
||||||
onTransitionStart?.({ closing });
|
onTransition?.({ closing, gesture: velocity !== undefined });
|
||||||
animation(gesture, {
|
animation(gesture, {
|
||||||
...spec.config,
|
...spec.config,
|
||||||
velocity,
|
velocity,
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ type Props = TransitionPreset & {
|
|||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
onPageChangeStart?: () => void;
|
onPageChangeStart?: () => void;
|
||||||
onPageChangeConfirm?: () => void;
|
onPageChangeConfirm?: (force: boolean) => void;
|
||||||
onPageChangeCancel?: () => void;
|
onPageChangeCancel?: () => void;
|
||||||
onGestureStart?: (props: { route: Route<string> }) => void;
|
onGestureStart?: (props: { route: Route<string> }) => void;
|
||||||
onGestureEnd?: (props: { route: Route<string> }) => void;
|
onGestureEnd?: (props: { route: Route<string> }) => void;
|
||||||
@@ -117,42 +117,58 @@ function CardContainer({
|
|||||||
scene,
|
scene,
|
||||||
transitionSpec,
|
transitionSpec,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
React.useEffect(() => {
|
|
||||||
onPageChangeConfirm?.();
|
|
||||||
}, [active, onPageChangeConfirm]);
|
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
onTransitionEnd?.({ route: scene.route }, false);
|
const { route } = scene;
|
||||||
onOpenRoute({ route: scene.route });
|
|
||||||
|
onTransitionEnd?.({ route }, false);
|
||||||
|
onOpenRoute({ route });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
onTransitionEnd?.({ route: scene.route }, true);
|
const { route } = scene;
|
||||||
onCloseRoute({ route: scene.route });
|
|
||||||
|
onTransitionEnd?.({ route }, true);
|
||||||
|
onCloseRoute({ route });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGestureBegin = () => {
|
const handleGestureBegin = () => {
|
||||||
|
const { route } = scene;
|
||||||
|
|
||||||
onPageChangeStart?.();
|
onPageChangeStart?.();
|
||||||
onGestureStart?.({ route: scene.route });
|
onGestureStart?.({ route });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGestureCanceled = () => {
|
const handleGestureCanceled = () => {
|
||||||
|
const { route } = scene;
|
||||||
|
|
||||||
onPageChangeCancel?.();
|
onPageChangeCancel?.();
|
||||||
onGestureCancel?.({ route: scene.route });
|
onGestureCancel?.({ route });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleGestureEnd = () => {
|
const handleGestureEnd = () => {
|
||||||
onGestureEnd?.({ route: scene.route });
|
const { route } = scene;
|
||||||
|
|
||||||
|
onGestureEnd?.({ route });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleTransitionStart = ({ closing }: { closing: boolean }) => {
|
const handleTransition = ({
|
||||||
if (active && closing) {
|
closing,
|
||||||
onPageChangeConfirm?.();
|
gesture,
|
||||||
|
}: {
|
||||||
|
closing: boolean;
|
||||||
|
gesture: boolean;
|
||||||
|
}) => {
|
||||||
|
const { route } = scene;
|
||||||
|
|
||||||
|
if (!gesture) {
|
||||||
|
onPageChangeConfirm?.(true);
|
||||||
|
} else if (active && closing) {
|
||||||
|
onPageChangeConfirm?.(false);
|
||||||
} else {
|
} else {
|
||||||
onPageChangeCancel?.();
|
onPageChangeCancel?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTransitionStart?.({ route: scene.route }, closing);
|
onTransitionStart?.({ route }, closing);
|
||||||
};
|
};
|
||||||
|
|
||||||
const insets = {
|
const insets = {
|
||||||
@@ -202,7 +218,7 @@ function CardContainer({
|
|||||||
overlay={cardOverlay}
|
overlay={cardOverlay}
|
||||||
overlayEnabled={cardOverlayEnabled}
|
overlayEnabled={cardOverlayEnabled}
|
||||||
shadowEnabled={cardShadowEnabled}
|
shadowEnabled={cardShadowEnabled}
|
||||||
onTransitionStart={handleTransitionStart}
|
onTransition={handleTransition}
|
||||||
onGestureBegin={handleGestureBegin}
|
onGestureBegin={handleGestureBegin}
|
||||||
onGestureCanceled={handleGestureCanceled}
|
onGestureCanceled={handleGestureCanceled}
|
||||||
onGestureEnd={handleGestureEnd}
|
onGestureEnd={handleGestureEnd}
|
||||||
@@ -217,7 +233,14 @@ function CardContainer({
|
|||||||
pageOverflowEnabled={headerMode === 'screen' && mode === 'card'}
|
pageOverflowEnabled={headerMode === 'screen' && mode === 'card'}
|
||||||
containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null}
|
containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null}
|
||||||
contentStyle={[{ backgroundColor: colors.background }, cardStyle]}
|
contentStyle={[{ backgroundColor: colors.background }, cardStyle]}
|
||||||
style={StyleSheet.absoluteFill}
|
style={[
|
||||||
|
{
|
||||||
|
// This is necessary to avoid unfocused larger pages increasing scroll area
|
||||||
|
// The issue can be seen on the web when a smaller screen is pushed over a larger one
|
||||||
|
overflow: active ? undefined : 'hidden',
|
||||||
|
},
|
||||||
|
StyleSheet.absoluteFill,
|
||||||
|
]}
|
||||||
>
|
>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<View style={styles.scene}>
|
<View style={styles.scene}>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
StyleSheet,
|
StyleSheet,
|
||||||
LayoutChangeEvent,
|
LayoutChangeEvent,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
|
Platform,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
import type { NavigationState as StackNavigationState } from 'react-navigation';
|
import type { NavigationState as StackNavigationState } from 'react-navigation';
|
||||||
@@ -62,7 +63,7 @@ type Props = {
|
|||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
onPageChangeStart?: () => void;
|
onPageChangeStart?: () => void;
|
||||||
onPageChangeConfirm?: () => void;
|
onPageChangeConfirm?: (force: boolean) => void;
|
||||||
onPageChangeCancel?: () => void;
|
onPageChangeCancel?: () => void;
|
||||||
onGestureStart?: (props: { route: Route<string> }) => void;
|
onGestureStart?: (props: { route: Route<string> }) => void;
|
||||||
onGestureEnd?: (props: { route: Route<string> }) => void;
|
onGestureEnd?: (props: { route: Route<string> }) => void;
|
||||||
@@ -393,8 +394,9 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
onGestureStart,
|
onGestureStart,
|
||||||
onGestureEnd,
|
onGestureEnd,
|
||||||
onGestureCancel,
|
onGestureCancel,
|
||||||
// Enable on new versions of screens or for non modals on older versions
|
// Enable on new versions of `react-native-screens`
|
||||||
detachInactiveScreens = shouldUseActivityState || mode !== 'modal',
|
// On older versions of `react-native-screens`, there's an issue with screens not being responsive to user interaction.
|
||||||
|
detachInactiveScreens = Platform.OS === 'web' || shouldUseActivityState,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { scenes, layout, gestures, headerHeights } = this.state;
|
const { scenes, layout, gestures, headerHeights } = this.state;
|
||||||
@@ -443,10 +445,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
? this.state.scenes.slice(-2).some((scene) => {
|
? this.state.scenes.slice(-2).some((scene) => {
|
||||||
const { descriptor } = scene;
|
const { descriptor } = scene;
|
||||||
const options = descriptor ? descriptor.options : {};
|
const options = descriptor ? descriptor.options : {};
|
||||||
const {
|
const { headerTransparent, headerShown = true } = options;
|
||||||
headerTransparent,
|
|
||||||
headerShown = isParentHeaderShown === false,
|
|
||||||
} = options;
|
|
||||||
|
|
||||||
if (headerTransparent || headerShown === false) {
|
if (headerTransparent || headerShown === false) {
|
||||||
return true;
|
return true;
|
||||||
@@ -506,7 +505,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
// For the old implementation, it stays the same it was
|
// For the old implementation, it stays the same it was
|
||||||
let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;
|
let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;
|
||||||
|
|
||||||
if (shouldUseActivityState) {
|
if (shouldUseActivityState || Platform.OS === 'web') {
|
||||||
if (index < self.length - activeScreensLimit - 1) {
|
if (index < self.length - activeScreensLimit - 1) {
|
||||||
// screen should be inactive because it is too deep in the stack
|
// screen should be inactive because it is too deep in the stack
|
||||||
isScreenActive = STATE_INACTIVE;
|
isScreenActive = STATE_INACTIVE;
|
||||||
@@ -538,7 +537,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
safeAreaInsets,
|
safeAreaInsets,
|
||||||
headerShown = isParentHeaderShown === false,
|
headerShown = true,
|
||||||
headerTransparent,
|
headerTransparent,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
|
|||||||
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
||||||
|
|
||||||
type Props = React.ComponentProps<typeof BaseButton> & {
|
type Props = React.ComponentProps<typeof BaseButton> & {
|
||||||
activeOpacity: number;
|
pressOpacity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeDriver = Platform.OS !== 'web';
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
@@ -27,7 +27,7 @@ export default class TouchableItem extends React.Component<Props> {
|
|||||||
overshootClamping: true,
|
overshootClamping: true,
|
||||||
restDisplacementThreshold: 0.01,
|
restDisplacementThreshold: 0.01,
|
||||||
restSpeedThreshold: 0.01,
|
restSpeedThreshold: 0.01,
|
||||||
toValue: active ? this.props.activeOpacity : 1,
|
toValue: active ? this.props.pressOpacity : 1,
|
||||||
useNativeDriver,
|
useNativeDriver,
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
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.11.0](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.10.1...react-navigation-tabs@2.11.0) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add activityState to other navigators ([5c7f892](https://github.com/react-navigation/tabs/commit/5c7f892d77298f5c89534fa78a1a6a59c7f35a60))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.10.1](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.10.0...react-navigation-tabs@2.10.1) (2020-10-28)
|
## [2.10.1](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.10.0...react-navigation-tabs@2.10.1) (2020-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-tabs",
|
"name": "react-navigation-tabs",
|
||||||
"version": "2.10.1",
|
"version": "2.11.0",
|
||||||
"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",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"react-native-gesture-handler": "~1.7.0",
|
"react-native-gesture-handler": "~1.7.0",
|
||||||
"react-native-reanimated": "~1.13.0",
|
"react-native-reanimated": "~1.13.0",
|
||||||
"react-native-tab-view": "^2.13.0",
|
"react-native-tab-view": "^2.13.0",
|
||||||
"react-navigation": "^4.4.3",
|
"react-navigation": "^4.4.4",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
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,
|
||||||
|
// @ts-ignore
|
||||||
|
shouldUseActivityState,
|
||||||
|
} from 'react-native-screens';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
@@ -17,8 +22,17 @@ export default class ResourceSavingScene extends React.Component<Props> {
|
|||||||
if (screensEnabled?.() && this.props.enabled && Platform.OS !== 'web') {
|
if (screensEnabled?.() && this.props.enabled && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
if (shouldUseActivityState) {
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return (
|
||||||
|
// @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required
|
||||||
|
<Screen activityState={isVisible ? 2 : 0} {...rest} />
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
// @ts-expect-error: there was an `active` prop and no `activityState` in older version and stackPresentation was required
|
||||||
|
<Screen active={isVisible ? 1 : 0} {...rest} />
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isVisible, children, style, ...rest } = this.props;
|
const { isVisible, children, style, ...rest } = this.props;
|
||||||
|
|||||||
@@ -4179,10 +4179,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401"
|
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.10.tgz#5dda643e19e587793bc2034dd9bf7398ad43d401"
|
||||||
integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==
|
integrity sha512-rk4sWFsmtOw8oyx8SD3KSvawwaK7gRBSEIy2TAwURyGt+3TizssXP1r8nx3zY+R7v2vYYHXZ+k2/GULAT/bcaQ==
|
||||||
|
|
||||||
"@react-navigation/stack@^5.11.0":
|
"@react-navigation/stack@^5.14.3":
|
||||||
version "5.11.0"
|
version "5.14.3"
|
||||||
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.11.0.tgz#1fcb014e3606c7c48315934194cbd0691e115e99"
|
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.14.3.tgz#3d15fcd2cf8d0d2a1248686565c6a85e2d8e1c55"
|
||||||
integrity sha512-+YsiC7X21PaSclxl2fo7dCrOwbSSmuedZtRXQWwdAgcSqCKZUXi+k8CFoEebwvQA3DghhseYNCvQwLi9rphU5w==
|
integrity sha512-7rHc13DHsYP7l7GcgBcLEyX2/IAuCcRZ1Iu3MtOZSayjvFXxBBYKFKw0OyY9NxOfZUdLl3Q3mLiUHVFZkHMcuA==
|
||||||
dependencies:
|
dependencies:
|
||||||
color "^3.1.3"
|
color "^3.1.3"
|
||||||
react-native-iphone-x-helper "^1.3.0"
|
react-native-iphone-x-helper "^1.3.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user