mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-14 17:42:29 +08:00
Compare commits
19 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a495506e20 | ||
|
|
b20f2d1f7c | ||
|
|
66f3a4a0bb | ||
|
|
84cc0d758a | ||
|
|
ebc7f9ea75 | ||
|
|
bd9f0ad5f6 | ||
|
|
c326c106f9 | ||
|
|
52451d1109 | ||
|
|
0945689b70 | ||
|
|
37b9454f3e | ||
|
|
fb7ac960c8 | ||
|
|
e8515f9cd9 | ||
|
|
5eee804e7f | ||
|
|
45dbe5c40e | ||
|
|
d26bcc057e | ||
|
|
836ca4482e | ||
|
|
fdd549a536 | ||
|
|
128bbbe62a | ||
|
|
a186b445b4 |
1
.github/workflows/expo.yml
vendored
1
.github/workflows/expo.yml
vendored
@@ -3,6 +3,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"expo": {
|
"expo": {
|
||||||
"name": "React Navigation",
|
"name": "React Navigation",
|
||||||
"owner": "react-navigation",
|
"owner": "react-navigation",
|
||||||
"slug": "NavigationPlayground",
|
"slug": "react-navigation-example",
|
||||||
"description": "Demonstrates the functionality and various capabilities of React Navigation.",
|
"description": "Demonstrates the functionality and various capabilities of React Navigation.",
|
||||||
"privacy": "public",
|
"privacy": "public",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^10.0.0",
|
"@expo/vector-icons": "^10.0.0",
|
||||||
|
"@react-native-async-storage/async-storage": "^1.13.1",
|
||||||
"@react-native-community/masked-view": "0.1.10",
|
"@react-native-community/masked-view": "0.1.10",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"expo": "^39.0.0",
|
"expo": "^39.0.0",
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
import { AsyncStorage } from 'react-native';
|
|
||||||
|
|
||||||
export default AsyncStorage;
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
getItem(key: string) {
|
|
||||||
return Promise.resolve(localStorage.getItem(key));
|
|
||||||
},
|
|
||||||
setItem(key: string, value: string) {
|
|
||||||
return Promise.resolve(localStorage.setItem(key, value));
|
|
||||||
},
|
|
||||||
removeItem(key: string) {
|
|
||||||
return Promise.resolve(localStorage.removeItem(key));
|
|
||||||
},
|
|
||||||
clear() {
|
|
||||||
return Promise.resolve(localStorage.clear());
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -31,9 +31,11 @@ const AuthContext = React.createContext<{
|
|||||||
});
|
});
|
||||||
|
|
||||||
const SplashScreen = () => {
|
const SplashScreen = () => {
|
||||||
|
const { colors } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.content}>
|
<View style={styles.content}>
|
||||||
<ActivityIndicator />
|
<ActivityIndicator color={colors.primary} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
ScrollView,
|
ScrollView,
|
||||||
YellowBox,
|
|
||||||
Platform,
|
Platform,
|
||||||
StatusBar,
|
StatusBar,
|
||||||
I18nManager,
|
I18nManager,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
ScaledSize,
|
ScaledSize,
|
||||||
Linking,
|
Linking,
|
||||||
|
LogBox,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { enableScreens } from 'react-native-screens';
|
import { enableScreens } from 'react-native-screens';
|
||||||
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
||||||
@@ -38,9 +38,9 @@ import {
|
|||||||
HeaderStyleInterpolators,
|
HeaderStyleInterpolators,
|
||||||
} from '@react-navigation/stack';
|
} from '@react-navigation/stack';
|
||||||
import { useReduxDevToolsExtension } from '@react-navigation/devtools';
|
import { useReduxDevToolsExtension } from '@react-navigation/devtools';
|
||||||
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||||
|
|
||||||
import { restartApp } from './Restart';
|
import { restartApp } from './Restart';
|
||||||
import AsyncStorage from './AsyncStorage';
|
|
||||||
import LinkingPrefixes from './LinkingPrefixes';
|
import LinkingPrefixes from './LinkingPrefixes';
|
||||||
import SettingsItem from './Shared/SettingsItem';
|
import SettingsItem from './Shared/SettingsItem';
|
||||||
import SimpleStack from './Screens/SimpleStack';
|
import SimpleStack from './Screens/SimpleStack';
|
||||||
@@ -58,7 +58,9 @@ import PreventRemove from './Screens/PreventRemove';
|
|||||||
import CompatAPI from './Screens/CompatAPI';
|
import CompatAPI from './Screens/CompatAPI';
|
||||||
import LinkComponent from './Screens/LinkComponent';
|
import LinkComponent from './Screens/LinkComponent';
|
||||||
|
|
||||||
YellowBox.ignoreWarnings(['Require cycle:', 'Warning: Async Storage']);
|
if (Platform.OS !== 'web') {
|
||||||
|
LogBox.ignoreLogs(['Require cycle:']);
|
||||||
|
}
|
||||||
|
|
||||||
enableScreens();
|
enableScreens();
|
||||||
|
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.10.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.10.4...@react-navigation/bottom-tabs@5.10.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.10.3...@react-navigation/bottom-tabs@5.10.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.10.2...@react-navigation/bottom-tabs@5.10.3) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.10.1...@react-navigation/bottom-tabs@5.10.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.10.0...@react-navigation/bottom-tabs@5.10.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.9.2...@react-navigation/bottom-tabs@5.10.0) (2020-10-24)
|
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.9.2...@react-navigation/bottom-tabs@5.10.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/bottom-tabs",
|
"name": "@react-navigation/bottom-tabs",
|
||||||
"description": "Bottom tab navigator following iOS design guidelines",
|
"description": "Bottom tab navigator following iOS design guidelines",
|
||||||
"version": "5.10.0",
|
"version": "5.10.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-navigation/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.3.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.4...@react-navigation/compat@5.3.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.3...@react-navigation/compat@5.3.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.2...@react-navigation/compat@5.3.3) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.1...@react-navigation/compat@5.3.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.0...@react-navigation/compat@5.3.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.2.8...@react-navigation/compat@5.3.0) (2020-10-24)
|
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.2.8...@react-navigation/compat@5.3.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/compat",
|
"name": "@react-navigation/compat",
|
||||||
"description": "Compatibility layer to write navigator definitions in static configuration format",
|
"description": "Compatibility layer to write navigator definitions in static configuration format",
|
||||||
"version": "5.3.0",
|
"version": "5.3.5",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-navigation/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"react": "~16.13.1",
|
"react": "~16.13.1",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
|
|||||||
@@ -3,6 +3,63 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## [5.13.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.13.4...@react-navigation/core@5.13.5) (2020-11-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't use use-subscription to avoid peer dep related errors ([66f3a4a](https://github.com/react-navigation/react-navigation/commit/66f3a4a0bb39475434668bc94fb1750dbe618ee0)), closes [/github.com/react-navigation/react-navigation/issues/9021#issuecomment-721679760](https://github.com//github.com/react-navigation/react-navigation/issues/9021/issues/issuecomment-721679760)
|
||||||
|
* use useDebugValue in more places ([b20f2d1](https://github.com/react-navigation/react-navigation/commit/b20f2d1f7ccb82db70df9cddf5746557912daa99))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.13.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.13.3...@react-navigation/core@5.13.4) (2020-11-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix nested navigation not working the first time ([ebc7f9e](https://github.com/react-navigation/react-navigation/commit/ebc7f9ea75bbf6e3b6303027cfa023d7c97342ff))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.13.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.13.2...@react-navigation/core@5.13.3) (2020-11-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* handle navigating to same screen again for nested screens ([0945689](https://github.com/react-navigation/react-navigation/commit/0945689b70d71a4b5d766c61d57009761c460bf6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.13.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.13.1...@react-navigation/core@5.13.2) (2020-10-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix params from for the root screen when creating action ([e8515f9](https://github.com/react-navigation/react-navigation/commit/e8515f9cd94a912c107a407dea3d953c4172393f)), closes [#9006](https://github.com/react-navigation/react-navigation/issues/9006)
|
||||||
|
* trim routes if an index is specified in state ([fb7ac96](https://github.com/react-navigation/react-navigation/commit/fb7ac960c8e1ffca200ecb12696ce5531a139e50))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.13.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.13.0...@react-navigation/core@5.13.1) (2020-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve types for route prop in screenOptions ([d26bcc0](https://github.com/react-navigation/react-navigation/commit/d26bcc057ef31f8950f909adf83e263171a42d74))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.13.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.12.5...@react-navigation/core@5.13.0) (2020-10-24)
|
# [5.13.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.12.5...@react-navigation/core@5.13.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/core",
|
"name": "@react-navigation/core",
|
||||||
"description": "Core utilities for building navigators",
|
"description": "Core utilities for building navigators",
|
||||||
"version": "5.13.0",
|
"version": "5.13.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -35,19 +35,17 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.5.0",
|
"@react-navigation/routers": "^5.5.1",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.15",
|
"nanoid": "^3.1.15",
|
||||||
"query-string": "^6.13.6",
|
"query-string": "^6.13.6",
|
||||||
"react-is": "^16.13.0",
|
"react-is": "^16.13.0"
|
||||||
"use-subscription": "^1.5.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-is": "^16.7.1",
|
"@types/react-is": "^16.7.1",
|
||||||
"@types/use-subscription": "^1.0.0",
|
|
||||||
"del-cli": "^3.0.1",
|
"del-cli": "^3.0.1",
|
||||||
"react": "~16.13.1",
|
"react": "~16.13.1",
|
||||||
"react-test-renderer": "~16.13.1",
|
"react-test-renderer": "~16.13.1",
|
||||||
|
|||||||
@@ -132,6 +132,17 @@ export default function MockRouter(options: DefaultRouterOptions) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'GO_BACK': {
|
||||||
|
if (state.index === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
index: state.index - 1,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return BaseRouter.getStateForAction(state, action);
|
return BaseRouter.getStateForAction(state, action);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,158 @@ it('gets navigate action from state', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen with 2 screens', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state)).toEqual({
|
||||||
|
payload: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
type: 'RESET',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen with 2 screens with config', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
initialRouteName: 'foo',
|
||||||
|
screens: {
|
||||||
|
bar: 'bar',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state, config)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen with more than 2 screens with config', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
{ name: 'baz' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
initialRouteName: 'foo',
|
||||||
|
screens: {
|
||||||
|
bar: 'bar',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state, config)).toEqual({
|
||||||
|
payload: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
{ name: 'baz' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
type: 'RESET',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen with more than 2 screens with config with lower index', () => {
|
||||||
|
const state = {
|
||||||
|
index: 1,
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
{ name: 'baz' },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
initialRouteName: 'foo',
|
||||||
|
screens: {
|
||||||
|
bar: 'bar',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state, config)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'bar',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('gets navigate action from state with 2 screens', () => {
|
it('gets navigate action from state with 2 screens', () => {
|
||||||
const state = {
|
const state = {
|
||||||
routes: [
|
routes: [
|
||||||
@@ -95,6 +247,51 @@ it('gets navigate action from state with 2 screens', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state with 2 screens with lower index', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
state: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
state: {
|
||||||
|
index: 0,
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'qux',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
{ name: 'quz' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'foo',
|
||||||
|
params: {
|
||||||
|
screen: 'bar',
|
||||||
|
initial: true,
|
||||||
|
params: {
|
||||||
|
screen: 'qux',
|
||||||
|
initial: true,
|
||||||
|
params: {
|
||||||
|
author: 'jane',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('gets navigate action from state with more than 2 screens', () => {
|
it('gets navigate action from state with more than 2 screens', () => {
|
||||||
const state = {
|
const state = {
|
||||||
routes: [
|
routes: [
|
||||||
@@ -205,6 +402,37 @@ it('gets navigate action from state with config', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state for top-level screen with config', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
screens: {
|
||||||
|
initialRouteName: 'bar',
|
||||||
|
foo: {
|
||||||
|
path: 'some-path/:answer',
|
||||||
|
parse: {
|
||||||
|
answer: Number,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state, config)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'foo',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('gets navigate action from state with 2 screens including initial route and with config', () => {
|
it('gets navigate action from state with 2 screens including initial route and with config', () => {
|
||||||
const state = {
|
const state = {
|
||||||
routes: [
|
routes: [
|
||||||
@@ -452,6 +680,65 @@ it('gets navigate action from state with more than 2 screens and with config', (
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('gets navigate action from state with more than 2 screens with lower index', () => {
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'foo',
|
||||||
|
state: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'bar',
|
||||||
|
state: {
|
||||||
|
index: 1,
|
||||||
|
routes: [
|
||||||
|
{ name: 'quu' },
|
||||||
|
{
|
||||||
|
name: 'qux',
|
||||||
|
params: { author: 'jane' },
|
||||||
|
},
|
||||||
|
{ name: 'quz' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
screens: {
|
||||||
|
foo: {
|
||||||
|
initialRouteName: 'bar',
|
||||||
|
screens: {
|
||||||
|
bar: {
|
||||||
|
initialRouteName: 'quu',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getActionFromState(state, config)).toEqual({
|
||||||
|
payload: {
|
||||||
|
name: 'foo',
|
||||||
|
params: {
|
||||||
|
screen: 'bar',
|
||||||
|
initial: true,
|
||||||
|
params: {
|
||||||
|
screen: 'qux',
|
||||||
|
initial: false,
|
||||||
|
params: {
|
||||||
|
author: 'jane',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
type: 'NAVIGATE',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("doesn't return action if no routes are provided'", () => {
|
it("doesn't return action if no routes are provided'", () => {
|
||||||
expect(getActionFromState({ routes: [] })).toBe(undefined);
|
expect(getActionFromState({ routes: [] })).toBe(undefined);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -735,6 +735,20 @@ it('navigates to nested child in a navigator', () => {
|
|||||||
expect(element).toMatchInlineSnapshot(
|
expect(element).toMatchInlineSnapshot(
|
||||||
`"[bar-a, {\\"lol\\":\\"why\\",\\"whoa\\":\\"test\\"}]"`
|
`"[bar-a, {\\"lol\\":\\"why\\",\\"whoa\\":\\"test\\"}]"`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
act(() => navigation.current?.navigate('bar', { screen: 'bar-b' }));
|
||||||
|
|
||||||
|
act(() => navigation.current?.goBack());
|
||||||
|
|
||||||
|
expect(element).toMatchInlineSnapshot(
|
||||||
|
`"[bar-a, {\\"lol\\":\\"why\\",\\"whoa\\":\\"test\\"}]"`
|
||||||
|
);
|
||||||
|
|
||||||
|
act(() => navigation.current?.navigate('bar', { screen: 'bar-b' }));
|
||||||
|
|
||||||
|
expect(element).toMatchInlineSnapshot(
|
||||||
|
`"[bar-b, {\\"some\\":\\"stuff\\",\\"test\\":42,\\"whoa\\":\\"test\\"}]"`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('navigates to nested child in a navigator with initial: false', () => {
|
it('navigates to nested child in a navigator with initial: false', () => {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type {
|
|||||||
PartialRoute,
|
PartialRoute,
|
||||||
NavigationState,
|
NavigationState,
|
||||||
PartialState,
|
PartialState,
|
||||||
|
CommonActions,
|
||||||
} from '@react-navigation/routers';
|
} from '@react-navigation/routers';
|
||||||
import type { PathConfig, PathConfigMap, NestedNavigateParams } from './types';
|
import type { PathConfig, PathConfigMap, NestedNavigateParams } from './types';
|
||||||
|
|
||||||
@@ -24,31 +25,59 @@ type NavigateAction<State extends NavigationState> = {
|
|||||||
export default function getActionFromState(
|
export default function getActionFromState(
|
||||||
state: PartialState<NavigationState>,
|
state: PartialState<NavigationState>,
|
||||||
options?: Options
|
options?: Options
|
||||||
): NavigateAction<NavigationState> | undefined {
|
): NavigateAction<NavigationState> | CommonActions.Action | undefined {
|
||||||
// Create a normalized configs object which will be easier to use
|
// Create a normalized configs object which will be easier to use
|
||||||
const normalizedConfig = options ? createNormalizedConfigItem(options) : {};
|
const normalizedConfig = options ? createNormalizedConfigItem(options) : {};
|
||||||
|
|
||||||
let payload;
|
const routes =
|
||||||
let current: PartialState<NavigationState> | undefined = state;
|
state.index != null ? state.routes.slice(0, state.index + 1) : state.routes;
|
||||||
let config: ConfigItem | undefined = normalizedConfig;
|
|
||||||
let params: NestedNavigateParams<NavigationState> = {};
|
if (routes.length === 0) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!(
|
||||||
|
routes.length === 1 ||
|
||||||
|
(routes.length === 2 &&
|
||||||
|
routes[0].name === normalizedConfig?.initialRouteName)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
type: 'RESET',
|
||||||
|
payload: state,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const route = state.routes[state.index ?? state.routes.length - 1];
|
||||||
|
|
||||||
|
let current: PartialState<NavigationState> | undefined = route?.state;
|
||||||
|
let config: ConfigItem | undefined = normalizedConfig?.screens?.[route?.name];
|
||||||
|
let params: NestedNavigateParams<NavigationState> = { ...route.params };
|
||||||
|
|
||||||
|
let payload = route ? { name: route.name, params } : undefined;
|
||||||
|
|
||||||
while (current) {
|
while (current) {
|
||||||
if (current.routes.length === 0) {
|
if (current.routes.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const route: Route<string> | PartialRoute<Route<string>> =
|
const routes =
|
||||||
current.routes[current.routes.length - 1];
|
current.index != null
|
||||||
|
? current.routes.slice(0, current.index + 1)
|
||||||
|
: current.routes;
|
||||||
|
|
||||||
if (current.routes.length === 1) {
|
const route: Route<string> | PartialRoute<Route<string>> =
|
||||||
|
routes[routes.length - 1];
|
||||||
|
|
||||||
|
if (routes.length === 1) {
|
||||||
params.initial = true;
|
params.initial = true;
|
||||||
params.screen = route.name;
|
params.screen = route.name;
|
||||||
params.state = undefined; // Explicitly set to override existing value when merging params
|
params.state = undefined; // Explicitly set to override existing value when merging params
|
||||||
} else if (
|
} else if (
|
||||||
current.routes.length === 2 &&
|
routes.length === 2 &&
|
||||||
current.routes[0].key === undefined &&
|
routes[0].key === undefined &&
|
||||||
current.routes[0].name === config?.initialRouteName
|
routes[0].name === config?.initialRouteName
|
||||||
) {
|
) {
|
||||||
params.initial = false;
|
params.initial = false;
|
||||||
params.screen = route.name;
|
params.screen = route.name;
|
||||||
@@ -70,13 +99,6 @@ export default function getActionFromState(
|
|||||||
|
|
||||||
current = route.state;
|
current = route.state;
|
||||||
config = config?.screens?.[route.name];
|
config = config?.screens?.[route.name];
|
||||||
|
|
||||||
if (!payload) {
|
|
||||||
payload = {
|
|
||||||
name: route.name,
|
|
||||||
params,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!payload) {
|
if (!payload) {
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import type {
|
|||||||
} from '@react-navigation/routers';
|
} from '@react-navigation/routers';
|
||||||
|
|
||||||
export type DefaultNavigatorOptions<
|
export type DefaultNavigatorOptions<
|
||||||
ScreenOptions extends {}
|
ScreenOptions extends {},
|
||||||
> = DefaultRouterOptions & {
|
ParamList extends ParamListBase = ParamListBase
|
||||||
|
> = DefaultRouterOptions<Extract<keyof ParamList, string>> & {
|
||||||
/**
|
/**
|
||||||
* Children React Elements to extract the route configuration from.
|
* Children React Elements to extract the route configuration from.
|
||||||
* Only `Screen` components are supported as children.
|
* Only `Screen` components are supported as children.
|
||||||
@@ -23,7 +24,7 @@ export type DefaultNavigatorOptions<
|
|||||||
screenOptions?:
|
screenOptions?:
|
||||||
| ScreenOptions
|
| ScreenOptions
|
||||||
| ((props: {
|
| ((props: {
|
||||||
route: RouteProp<ParamListBase, string>;
|
route: RouteProp<ParamList, keyof ParamList>;
|
||||||
navigation: any;
|
navigation: any;
|
||||||
}) => ScreenOptions);
|
}) => ScreenOptions);
|
||||||
};
|
};
|
||||||
@@ -489,14 +490,11 @@ export type TypedNavigator<
|
|||||||
* Navigator component which manages the child screens.
|
* Navigator component which manages the child screens.
|
||||||
*/
|
*/
|
||||||
Navigator: React.ComponentType<
|
Navigator: React.ComponentType<
|
||||||
Omit<React.ComponentProps<Navigator>, keyof DefaultNavigatorOptions<any>> &
|
Omit<
|
||||||
Omit<DefaultNavigatorOptions<ScreenOptions>, 'initialRouteName'> & {
|
React.ComponentProps<Navigator>,
|
||||||
/**
|
keyof DefaultNavigatorOptions<any, any>
|
||||||
* Name of the route to focus by on initial render.
|
> &
|
||||||
* If not specified, usually the first route is used.
|
DefaultNavigatorOptions<ScreenOptions, ParamList>
|
||||||
*/
|
|
||||||
initialRouteName?: keyof ParamList;
|
|
||||||
}
|
|
||||||
>;
|
>;
|
||||||
/**
|
/**
|
||||||
* Component used for specifying route configuration.
|
* Component used for specifying route configuration.
|
||||||
|
|||||||
@@ -1,32 +1,42 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { useSubscription } from 'use-subscription';
|
import { useState } from 'react';
|
||||||
import useNavigation from './useNavigation';
|
import useNavigation from './useNavigation';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hook to get the current focus state of the screen. Returns a `true` if screen is focused, otherwise `false`.
|
* Hook to get the current focus state of the screen. Returns a `true` if screen is focused, otherwise `false`.
|
||||||
* This can be used if a component needs to render something based on the focus state.
|
* This can be used if a component needs to render something based on the focus state.
|
||||||
* It uses `use-subscription` under the hood for safer use in concurrent mode.
|
|
||||||
*/
|
*/
|
||||||
export default function useIsFocused(): boolean {
|
export default function useIsFocused(): boolean {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
const [isFocused, setIsFocused] = useState(navigation.isFocused);
|
||||||
const getCurrentValue = React.useCallback(navigation.isFocused, [navigation]);
|
|
||||||
const subscribe = React.useCallback(
|
|
||||||
(callback: () => void) => {
|
|
||||||
const unsubscribeFocus = navigation.addListener('focus', callback);
|
|
||||||
|
|
||||||
const unsubscribeBlur = navigation.addListener('blur', callback);
|
const valueToReturn = navigation.isFocused();
|
||||||
|
|
||||||
return () => {
|
if (isFocused !== valueToReturn) {
|
||||||
unsubscribeFocus();
|
// If the value has changed since the last render, we need to update it.
|
||||||
unsubscribeBlur();
|
// This could happen if we missed an update from the event listeners during re-render.
|
||||||
};
|
// React will process this update immediately, so the old subscription value won't be committed.
|
||||||
},
|
// It is still nice to avoid returning a mismatched value though, so let's override the return value.
|
||||||
[navigation]
|
// This is the same logic as in https://github.com/facebook/react/tree/master/packages/use-subscription
|
||||||
);
|
setIsFocused(valueToReturn);
|
||||||
|
}
|
||||||
|
|
||||||
return useSubscription({
|
React.useEffect(() => {
|
||||||
getCurrentValue,
|
const unsubscribeFocus = navigation.addListener('focus', () =>
|
||||||
subscribe,
|
setIsFocused(true)
|
||||||
});
|
);
|
||||||
|
|
||||||
|
const unsubscribeBlur = navigation.addListener('blur', () =>
|
||||||
|
setIsFocused(false)
|
||||||
|
);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
unsubscribeFocus();
|
||||||
|
unsubscribeBlur();
|
||||||
|
};
|
||||||
|
}, [navigation]);
|
||||||
|
|
||||||
|
React.useDebugValue(valueToReturn);
|
||||||
|
|
||||||
|
return valueToReturn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,9 +353,9 @@ export default function useNavigationBuilder<
|
|||||||
} else if (
|
} else if (
|
||||||
typeof route.params.screen === 'string' &&
|
typeof route.params.screen === 'string' &&
|
||||||
((route.params.initial === false && isFirstStateInitialization) ||
|
((route.params.initial === false && isFirstStateInitialization) ||
|
||||||
route.params.screen !== previousParams?.screen ||
|
route.params !== previousParams)
|
||||||
route.params.params !== previousParams?.params)
|
|
||||||
) {
|
) {
|
||||||
|
// FIXME: Since params are merged, `route.params.params` might contain params from an older route
|
||||||
// If the route was updated with new screen name and/or params, we should navigate there
|
// If the route was updated with new screen name and/or params, we should navigate there
|
||||||
action = CommonActions.navigate(route.params.screen, route.params.params);
|
action = CommonActions.navigate(route.params.screen, route.params.params);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,5 +68,7 @@ export default function useSyncState<T>(initialState?: (() => T) | T) {
|
|||||||
|
|
||||||
const state = stateRef.current;
|
const state = stateRef.current;
|
||||||
|
|
||||||
|
React.useDebugValue(state);
|
||||||
|
|
||||||
return [state, getState, setState, scheduleUpdate, flushUpdates] as const;
|
return [state, getState, setState, scheduleUpdate, flushUpdates] as const;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.1.13](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.12...@react-navigation/devtools@5.1.13) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.12](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.11...@react-navigation/devtools@5.1.12) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.10...@react-navigation/devtools@5.1.11) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.9...@react-navigation/devtools@5.1.10) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.8...@react-navigation/devtools@5.1.9) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.1.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.7...@react-navigation/devtools@5.1.8) (2020-10-24)
|
## [5.1.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.7...@react-navigation/devtools@5.1.8) (2020-10-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/devtools
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/devtools",
|
"name": "@react-navigation/devtools",
|
||||||
"description": "Developer tools for React Navigation",
|
"description": "Developer tools for React Navigation",
|
||||||
"version": "5.1.8",
|
"version": "5.1.13",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^5.13.0",
|
"@react-navigation/core": "^5.13.5",
|
||||||
"deep-equal": "^2.0.4"
|
"deep-equal": "^2.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.10.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.10.4...@react-navigation/drawer@5.10.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.10.3...@react-navigation/drawer@5.10.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.10.2...@react-navigation/drawer@5.10.3) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.10.1...@react-navigation/drawer@5.10.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.10.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.10.0...@react-navigation/drawer@5.10.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.9.3...@react-navigation/drawer@5.10.0) (2020-10-24)
|
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.9.3...@react-navigation/drawer@5.10.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/drawer",
|
"name": "@react-navigation/drawer",
|
||||||
"description": "Drawer navigator component with animated transitions and gesturess",
|
"description": "Drawer navigator component with animated transitions and gesturess",
|
||||||
"version": "5.10.0",
|
"version": "5.10.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-navigation/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.3.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.4...@react-navigation/material-bottom-tabs@5.3.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.3...@react-navigation/material-bottom-tabs@5.3.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.2...@react-navigation/material-bottom-tabs@5.3.3) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.1...@react-navigation/material-bottom-tabs@5.3.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.0...@react-navigation/material-bottom-tabs@5.3.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.2.19...@react-navigation/material-bottom-tabs@5.3.0) (2020-10-24)
|
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.2.19...@react-navigation/material-bottom-tabs@5.3.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/material-bottom-tabs",
|
"name": "@react-navigation/material-bottom-tabs",
|
||||||
"description": "Integration for bottom navigation component from react-native-paper",
|
"description": "Integration for bottom navigation component from react-native-paper",
|
||||||
"version": "5.3.0",
|
"version": "5.3.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-navigation/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.3.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.4...@react-navigation/material-top-tabs@5.3.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.3...@react-navigation/material-top-tabs@5.3.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.2...@react-navigation/material-top-tabs@5.3.3) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.1...@react-navigation/material-top-tabs@5.3.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.0...@react-navigation/material-top-tabs@5.3.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.2.19...@react-navigation/material-top-tabs@5.3.0) (2020-10-24)
|
# [5.3.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.2.19...@react-navigation/material-top-tabs@5.3.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/material-top-tabs",
|
"name": "@react-navigation/material-top-tabs",
|
||||||
"description": "Integration for the animated tab view component from react-native-tab-view",
|
"description": "Integration for the animated tab view component from react-native-tab-view",
|
||||||
"version": "5.3.0",
|
"version": "5.3.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.16.2",
|
"@react-native-community/bob": "^0.16.2",
|
||||||
"@react-navigation/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -3,6 +3,49 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## [5.8.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.4...@react-navigation/native@5.8.5) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.8.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.3...@react-navigation/native@5.8.4) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.8.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.2...@react-navigation/native@5.8.3) (2020-11-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* make sure that invalid linking config doesn't work if app is open ([52451d1](https://github.com/react-navigation/react-navigation/commit/52451d11094b8551e3c6950b3e005d68225c7da9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.8.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.1...@react-navigation/native@5.8.2) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.8.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.0...@react-navigation/native@5.8.1) (2020-10-28)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.8.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.7.6...@react-navigation/native@5.8.0) (2020-10-24)
|
# [5.8.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.7.6...@react-navigation/native@5.8.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/native",
|
"name": "@react-navigation/native",
|
||||||
"description": "React Native integration for React Navigation",
|
"description": "React Native integration for React Navigation",
|
||||||
"version": "5.8.0",
|
"version": "5.8.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^5.13.0",
|
"@react-navigation/core": "^5.13.5",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.15"
|
"nanoid": "^3.1.15"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -121,6 +121,19 @@ export default function useLinking(
|
|||||||
const state = getStateFromPathRef.current(path, configRef.current);
|
const state = getStateFromPathRef.current(path, configRef.current);
|
||||||
|
|
||||||
if (state) {
|
if (state) {
|
||||||
|
// Make sure that the routes in the state exist in the root navigator
|
||||||
|
// Otherwise there's an error in the linking configuration
|
||||||
|
const rootState = navigation.getRootState();
|
||||||
|
|
||||||
|
if (
|
||||||
|
state.routes.some((r) => !rootState?.routeNames.includes(r.name))
|
||||||
|
) {
|
||||||
|
console.warn(
|
||||||
|
"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const action = getActionFromState(state, configRef.current);
|
const action = getActionFromState(state, configRef.current);
|
||||||
|
|
||||||
if (action !== undefined) {
|
if (action !== undefined) {
|
||||||
|
|||||||
@@ -399,11 +399,26 @@ export default function useLinking(
|
|||||||
|
|
||||||
// We should only dispatch an action when going forward
|
// We should only dispatch an action when going forward
|
||||||
// Otherwise the action will likely add items to history, which would mess things up
|
// Otherwise the action will likely add items to history, which would mess things up
|
||||||
if (state && index > previousIndex) {
|
if (state) {
|
||||||
const action = getActionFromState(state, configRef.current);
|
// Make sure that the routes in the state exist in the root navigator
|
||||||
|
// Otherwise there's an error in the linking configuration
|
||||||
|
const rootState = navigation.getRootState();
|
||||||
|
|
||||||
if (action !== undefined) {
|
if (state.routes.some((r) => !rootState?.routeNames.includes(r.name))) {
|
||||||
navigation.dispatch(action);
|
console.warn(
|
||||||
|
"The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > previousIndex) {
|
||||||
|
const action = getActionFromState(state, configRef.current);
|
||||||
|
|
||||||
|
if (action !== undefined) {
|
||||||
|
navigation.dispatch(action);
|
||||||
|
} else {
|
||||||
|
navigation.resetRoot(state);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
navigation.resetRoot(state);
|
navigation.resetRoot(state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.5.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.5.0...@react-navigation/routers@5.5.1) (2020-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve types for route prop in screenOptions ([d26bcc0](https://github.com/react-navigation/react-navigation/commit/d26bcc057ef31f8950f909adf83e263171a42d74))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.5.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.4.12...@react-navigation/routers@5.5.0) (2020-10-24)
|
# [5.5.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.4.12...@react-navigation/routers@5.5.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/routers",
|
"name": "@react-navigation/routers",
|
||||||
"description": "Routers to help build custom navigators",
|
"description": "Routers to help build custom navigators",
|
||||||
"version": "5.5.0",
|
"version": "5.5.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
|
|||||||
@@ -116,12 +116,12 @@ export type ActionCreators<Action extends NavigationAction> = {
|
|||||||
[key: string]: (...args: any) => Action;
|
[key: string]: (...args: any) => Action;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DefaultRouterOptions = {
|
export type DefaultRouterOptions<RouteName extends string = string> = {
|
||||||
/**
|
/**
|
||||||
* Name of the route to focus by on initial render.
|
* Name of the route to focus by on initial render.
|
||||||
* If not specified, usually the first route is used.
|
* If not specified, usually the first route is used.
|
||||||
*/
|
*/
|
||||||
initialRouteName?: string;
|
initialRouteName?: RouteName;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RouterFactory<
|
export type RouterFactory<
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [5.12.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.1...@react-navigation/stack@5.12.2) (2020-11-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.12.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.0...@react-navigation/stack@5.12.1) (2020-11-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.12.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.11.1...@react-navigation/stack@5.12.0) (2020-11-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add a headerBackAccessibilityLabel option in stack ([c326c10](https://github.com/react-navigation/react-navigation/commit/c326c106f9a2492ff45bdc8da9bfbc404e48786a)), closes [#9016](https://github.com/react-navigation/react-navigation/issues/9016)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.11.0...@react-navigation/stack@5.11.1) (2020-10-30)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.11.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.10.0...@react-navigation/stack@5.11.0) (2020-10-28)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* enable react-native-screens in Stack by default on iOS ([45dbe5c](https://github.com/react-navigation/react-navigation/commit/45dbe5c40ebc66c62593b3fad35cff3048b888a4))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.9.3...@react-navigation/stack@5.10.0) (2020-10-24)
|
# [5.10.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.9.3...@react-navigation/stack@5.10.0) (2020-10-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/stack",
|
"name": "@react-navigation/stack",
|
||||||
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
||||||
"version": "5.10.0",
|
"version": "5.12.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -46,7 +46,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/native": "^5.8.0",
|
"@react-navigation/native": "^5.8.5",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
|
|||||||
@@ -145,6 +145,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.
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ 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 {
|
import type {
|
||||||
@@ -397,9 +396,8 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
onGestureStart,
|
onGestureStart,
|
||||||
onGestureEnd,
|
onGestureEnd,
|
||||||
onGestureCancel,
|
onGestureCancel,
|
||||||
detachInactiveScreens = Platform.OS === 'ios'
|
// Enable on new versions of screens or for non modals on older versions
|
||||||
? false // Disable `react-native-screens` on iOS by default since it's buggy
|
detachInactiveScreens = shouldUseActivityState || mode !== 'modal',
|
||||||
: shouldUseActivityState || mode !== 'modal', // Enable on new versions of screens or for non modals on older versions
|
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const { scenes, layout, gestures, headerHeights } = this.state;
|
const { scenes, layout, gestures, headerHeights } = this.state;
|
||||||
|
|||||||
14
yarn.lock
14
yarn.lock
@@ -3324,6 +3324,13 @@
|
|||||||
native-url "^0.2.6"
|
native-url "^0.2.6"
|
||||||
schema-utils "^2.6.5"
|
schema-utils "^2.6.5"
|
||||||
|
|
||||||
|
"@react-native-async-storage/async-storage@^1.13.1":
|
||||||
|
version "1.13.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@react-native-async-storage/async-storage/-/async-storage-1.13.1.tgz#c24200b33946f253e1d198d730548385a8904ecc"
|
||||||
|
integrity sha512-yNTjYah8LuCZDqD+kbPdgyfht1uW2uEf5OKlaAthcmKz9wOf68ccO7PFXyLXlFIEZDWkRcEk4Cu4MSsQYI9pBQ==
|
||||||
|
dependencies:
|
||||||
|
deep-assign "^3.0.0"
|
||||||
|
|
||||||
"@react-native-community/bob@^0.16.2":
|
"@react-native-community/bob@^0.16.2":
|
||||||
version "0.16.2"
|
version "0.16.2"
|
||||||
resolved "https://registry.yarnpkg.com/@react-native-community/bob/-/bob-0.16.2.tgz#9102b0160e70084fa1b75403a80dec332647c950"
|
resolved "https://registry.yarnpkg.com/@react-native-community/bob/-/bob-0.16.2.tgz#9102b0160e70084fa1b75403a80dec332647c950"
|
||||||
@@ -4027,11 +4034,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
source-map "^0.6.1"
|
source-map "^0.6.1"
|
||||||
|
|
||||||
"@types/use-subscription@^1.0.0":
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/use-subscription/-/use-subscription-1.0.0.tgz#d146f8d834f70f50d48bd8246a481d096f11db19"
|
|
||||||
integrity sha512-0WWZ5GUDKMXUY/1zy4Ur5/zsC0s/B+JjXfHdkvx6JgDNZzZV5eW+KKhDqsTGyqX56uh99gwGwbsKbVwkcVIKQA==
|
|
||||||
|
|
||||||
"@types/wait-on@*":
|
"@types/wait-on@*":
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/wait-on/-/wait-on-4.0.0.tgz#fb6fa2854b592f7344f1dd9836b5655795510dce"
|
resolved "https://registry.yarnpkg.com/@types/wait-on/-/wait-on-4.0.0.tgz#fb6fa2854b592f7344f1dd9836b5655795510dce"
|
||||||
@@ -18733,7 +18735,7 @@ urlgrey@0.4.4:
|
|||||||
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
|
resolved "https://registry.yarnpkg.com/urlgrey/-/urlgrey-0.4.4.tgz#892fe95960805e85519f1cd4389f2cb4cbb7652f"
|
||||||
integrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=
|
integrity sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=
|
||||||
|
|
||||||
use-subscription@^1.0.0, use-subscription@^1.5.0:
|
use-subscription@^1.0.0:
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/use-subscription/-/use-subscription-1.5.0.tgz#0df66fdf97b9a340147ad72f76fac1db6f56d240"
|
resolved "https://registry.yarnpkg.com/use-subscription/-/use-subscription-1.5.0.tgz#0df66fdf97b9a340147ad72f76fac1db6f56d240"
|
||||||
integrity sha512-/FVRiB2I7NDjzWoNBYPt6YkkvleMm/lFtxj1hH6nX2TVrJ/5UTbovw9OE1efv2Zl0HoAYuTjM7zHd9OsABn5sg==
|
integrity sha512-/FVRiB2I7NDjzWoNBYPt6YkkvleMm/lFtxj1hH6nX2TVrJ/5UTbovw9OE1efv2Zl0HoAYuTjM7zHd9OsABn5sg==
|
||||||
|
|||||||
Reference in New Issue
Block a user