mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-22 20:08:15 +08:00
Compare commits
14 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
923722cbb0 | ||
|
|
2c1adc9043 | ||
|
|
40439ccb42 | ||
|
|
24b3f739da | ||
|
|
2c8401d5cb | ||
|
|
6cc463f20d | ||
|
|
e6c6cc8331 | ||
|
|
8a6511c491 | ||
|
|
bfd6eb79c3 | ||
|
|
ebcd077626 | ||
|
|
5d0c7ea6d4 | ||
|
|
038eb87c42 | ||
|
|
72f90b50d2 | ||
|
|
0fce8eb2a1 |
@@ -8,7 +8,7 @@
|
|||||||
"version": "independent",
|
"version": "independent",
|
||||||
"command": {
|
"command": {
|
||||||
"publish": {
|
"publish": {
|
||||||
"allowBranch": "6.x",
|
"allowBranch": "main",
|
||||||
"conventionalCommits": true,
|
"conventionalCommits": true,
|
||||||
"createRelease": "github",
|
"createRelease": "github",
|
||||||
"message": "chore: publish",
|
"message": "chore: publish",
|
||||||
|
|||||||
@@ -3,6 +3,25 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
# [6.0.0-next.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.1...@react-navigation/bottom-tabs@6.0.0-next.2) (2021-03-12)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0...@react-navigation/bottom-tabs@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.1...@react-navigation/bottom-tabs@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.1...@react-navigation/bottom-tabs@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
Bottom tab navigator for React Navigation following iOS design guidelines.
|
Bottom tab navigator for React Navigation following iOS design guidelines.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/bottom-tab-navigator/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/bottom-tab-navigator/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -37,12 +37,12 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0",
|
"@react-navigation/elements": "^1.0.0-next.2",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"warn-once": "^0.0.1"
|
"warn-once": "^0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-safe-area-context": ">= 3.0.0",
|
"react-native-safe-area-context": ">= 3.0.0",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
shouldUseActivityState,
|
shouldUseActivityState,
|
||||||
} from 'react-native-screens';
|
} from 'react-native-screens';
|
||||||
import { ResourceSavingScene } from '@react-navigation/elements';
|
import { ResourceSavingView } from '@react-navigation/elements';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResourceSavingScene visible={visible} {...rest}>
|
<ResourceSavingView visible={visible} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</ResourceSavingScene>
|
</ResourceSavingView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0...@react-navigation/core@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.14.3...@react-navigation/core@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.14.3...@react-navigation/core@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^6.0.0-next.0",
|
"@react-navigation/routers": "^6.0.0-next.1",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.20",
|
"nanoid": "^3.1.20",
|
||||||
"query-string": "^6.14.1",
|
"query-string": "^6.14.1",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@6.0.0...@react-navigation/devtools@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.17...@react-navigation/devtools@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.17...@react-navigation/devtools@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/devtools
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Developer tools for React Navigation.
|
Developer tools for React Navigation.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/devtools).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/devtools).
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^6.0.0-next.0",
|
"@react-navigation/core": "^6.0.0-next.1",
|
||||||
"deep-equal": "^2.0.5"
|
"deep-equal": "^2.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,28 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [6.0.0-next.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@6.0.0-next.1...@react-navigation/drawer@6.0.0-next.2) (2021-03-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* export drawer button ([2c8401d](https://github.com/react-navigation/react-navigation/commit/2c8401d5cb347d37c96e5b30f8ad05c17fd22ea4))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@6.0.0...@react-navigation/drawer@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.2...@react-navigation/drawer@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.2...@react-navigation/drawer@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `@react-navigation/drawer`
|
# `@react-navigation/drawer`
|
||||||
|
|
||||||
Drawer navigator for React Navigation following Material Design guidelines.
|
Drawer navigator for React Navigation following Material Design guidelines.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/drawer-navigator/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/drawer-navigator/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -42,12 +42,12 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0",
|
"@react-navigation/elements": "^1.0.0-next.2",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"warn-once": "^0.0.1"
|
"warn-once": "^0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "~0.63.51",
|
"@types/react-native": "~0.63.51",
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": ">= 1.0.0",
|
"react-native-gesture-handler": ">= 1.0.0",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export { default as DrawerItem } from './views/DrawerItem';
|
|||||||
export { default as DrawerItemList } from './views/DrawerItemList';
|
export { default as DrawerItemList } from './views/DrawerItemList';
|
||||||
export { default as DrawerContent } from './views/DrawerContent';
|
export { default as DrawerContent } from './views/DrawerContent';
|
||||||
export { default as DrawerContentScrollView } from './views/DrawerContentScrollView';
|
export { default as DrawerContentScrollView } from './views/DrawerContentScrollView';
|
||||||
|
export { default as DrawerToggleButton } from './views/DrawerToggleButton';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities
|
* Utilities
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
shouldUseActivityState,
|
shouldUseActivityState,
|
||||||
} from 'react-native-screens';
|
} from 'react-native-screens';
|
||||||
import { ResourceSavingScene } from '@react-navigation/elements';
|
import { ResourceSavingView } from '@react-navigation/elements';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
visible: boolean;
|
visible: boolean;
|
||||||
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResourceSavingScene visible={visible} {...rest}>
|
<ResourceSavingView visible={visible} {...rest}>
|
||||||
{children}
|
{children}
|
||||||
</ResourceSavingScene>
|
</ResourceSavingView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,33 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
# [1.0.0-next.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0-next.1...@react-navigation/elements@1.0.0-next.2) (2021-03-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* use theme in PlatformPressable ([40439cc](https://github.com/react-navigation/react-navigation/commit/40439ccb420825a1aa480648526a816f2422ea6e))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* return nearest parent header height for useHeaderHeight ([24b3f73](https://github.com/react-navigation/react-navigation/commit/24b3f739da4b8af8dca77d92c72cfdaa762e564a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [1.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0...@react-navigation/elements@1.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 1.0.0-next.0 (2021-03-09)
|
# 1.0.0-next.0 (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
UI Components for React Navigation.
|
UI Components for React Navigation.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/elements/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/elements/).
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/elements",
|
"name": "@react-navigation/elements",
|
||||||
"description": "UI Components for React Navigation",
|
"description": "UI Components for React Navigation",
|
||||||
"version": "1.0.0-next.0",
|
"version": "1.0.0-next.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-masked-view/masked-view": "^0.2.2",
|
"@react-native-masked-view/masked-view": "^0.2.2",
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "~0.63.51",
|
"@types/react-native": "~0.63.51",
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-safe-area-context": ">= 3.0.0"
|
"react-native-safe-area-context": ">= 3.0.0"
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export default function HeaderBackButton({
|
|||||||
labelVisible = Platform.OS === 'ios',
|
labelVisible = Platform.OS === 'ios',
|
||||||
onLabelLayout,
|
onLabelLayout,
|
||||||
onPress,
|
onPress,
|
||||||
pressColorAndroid: customPressColorAndroid,
|
pressColor,
|
||||||
|
pressOpacity,
|
||||||
screenLayout,
|
screenLayout,
|
||||||
tintColor: customTintColor,
|
tintColor: customTintColor,
|
||||||
titleLayout,
|
titleLayout,
|
||||||
@@ -31,7 +32,7 @@ export default function HeaderBackButton({
|
|||||||
testID,
|
testID,
|
||||||
style,
|
style,
|
||||||
}: HeaderBackButtonProps) {
|
}: HeaderBackButtonProps) {
|
||||||
const { dark, colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
|
||||||
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
|
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
|
||||||
undefined | number
|
undefined | number
|
||||||
@@ -45,13 +46,6 @@ export default function HeaderBackButton({
|
|||||||
default: colors.text,
|
default: colors.text,
|
||||||
});
|
});
|
||||||
|
|
||||||
const pressColorAndroid =
|
|
||||||
customPressColorAndroid !== undefined
|
|
||||||
? customPressColorAndroid
|
|
||||||
: dark
|
|
||||||
? 'rgba(255, 255, 255, .32)'
|
|
||||||
: 'rgba(0, 0, 0, .32)';
|
|
||||||
|
|
||||||
const handleLabelLayout = (e: LayoutChangeEvent) => {
|
const handleLabelLayout = (e: LayoutChangeEvent) => {
|
||||||
onLabelLayout?.(e);
|
onLabelLayout?.(e);
|
||||||
|
|
||||||
@@ -156,7 +150,8 @@ export default function HeaderBackButton({
|
|||||||
accessibilityLabel={accessibilityLabel}
|
accessibilityLabel={accessibilityLabel}
|
||||||
testID={testID}
|
testID={testID}
|
||||||
onPress={disabled ? undefined : handlePress}
|
onPress={disabled ? undefined : handlePress}
|
||||||
pressColor={pressColorAndroid}
|
pressColor={pressColor}
|
||||||
|
pressOpacity={pressOpacity}
|
||||||
android_ripple={{ borderless: true }}
|
android_ripple={{ borderless: true }}
|
||||||
style={[styles.container, disabled && styles.disabled, style]}
|
style={[styles.container, disabled && styles.disabled, style]}
|
||||||
hitSlop={Platform.select({
|
hitSlop={Platform.select({
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Platform, Pressable, PressableProps } from 'react-native';
|
import { Platform, Pressable, PressableProps } from 'react-native';
|
||||||
|
import { useTheme } from '@react-navigation/native';
|
||||||
|
|
||||||
export type Props = PressableProps & {
|
export type Props = PressableProps & {
|
||||||
pressColor?: string;
|
pressColor?: string;
|
||||||
@@ -12,24 +13,30 @@ const ANDROID_SUPPORTS_RIPPLE =
|
|||||||
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
|
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlatformPressable provides an abstraction on top of TouchableNativeFeedback and
|
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
||||||
* TouchableOpacity to handle platform differences.
|
|
||||||
*
|
|
||||||
* On Android, you can pass the props of TouchableNativeFeedback.
|
|
||||||
* On other platforms, you can pass the props of TouchableOpacity.
|
|
||||||
*/
|
*/
|
||||||
export default function PlatformPressable({
|
export default function PlatformPressable({
|
||||||
android_ripple,
|
android_ripple,
|
||||||
pressColor = 'rgba(0, 0, 0, .32)',
|
pressColor,
|
||||||
pressOpacity,
|
pressOpacity,
|
||||||
style,
|
style,
|
||||||
...rest
|
...rest
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
const { dark } = useTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Pressable
|
<Pressable
|
||||||
android_ripple={
|
android_ripple={
|
||||||
ANDROID_SUPPORTS_RIPPLE
|
ANDROID_SUPPORTS_RIPPLE
|
||||||
? { color: pressColor, ...android_ripple }
|
? {
|
||||||
|
color:
|
||||||
|
pressColor !== undefined
|
||||||
|
? pressColor
|
||||||
|
: dark
|
||||||
|
? 'rgba(255, 255, 255, .32)'
|
||||||
|
: 'rgba(0, 0, 0, .32)',
|
||||||
|
...android_ripple,
|
||||||
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
style={({ pressed }) => [
|
style={({ pressed }) => [
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export default function Screen(props: Props) {
|
|||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
||||||
|
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
header,
|
header,
|
||||||
@@ -50,7 +51,9 @@ export default function Screen(props: Props) {
|
|||||||
<HeaderShownContext.Provider
|
<HeaderShownContext.Provider
|
||||||
value={isParentHeaderShown || headerShown !== false}
|
value={isParentHeaderShown || headerShown !== false}
|
||||||
>
|
>
|
||||||
<HeaderHeightContext.Provider value={headerShown ? headerHeight : 0}>
|
<HeaderHeightContext.Provider
|
||||||
|
value={headerShown ? headerHeight : parentHeaderHeight}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</HeaderHeightContext.Provider>
|
</HeaderHeightContext.Provider>
|
||||||
</HeaderShownContext.Provider>
|
</HeaderShownContext.Provider>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export { default as getHeaderTitle } from './Header/getHeaderTitle';
|
|||||||
|
|
||||||
export { default as MissingIcon } from './MissingIcon';
|
export { default as MissingIcon } from './MissingIcon';
|
||||||
export { default as PlatformPressable } from './PlatformPressable';
|
export { default as PlatformPressable } from './PlatformPressable';
|
||||||
export { default as ResourceSavingScene } from './ResourceSavingScene';
|
export { default as ResourceSavingView } from './ResourceSavingView';
|
||||||
export { default as SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
export { default as SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
||||||
export { default as Screen } from './Screen';
|
export { default as Screen } from './Screen';
|
||||||
|
|
||||||
|
|||||||
@@ -127,13 +127,16 @@ export type HeaderBackButtonProps = {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
/**
|
/**
|
||||||
* Callback to call when the button is pressed.
|
* Callback to call when the button is pressed.
|
||||||
* By default, this triggers `goBack`.
|
|
||||||
*/
|
*/
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
/**
|
/**
|
||||||
* Color for material ripple (Android >= 5.0 only).
|
* Color for material ripple (Android >= 5.0 only).
|
||||||
*/
|
*/
|
||||||
pressColorAndroid?: string;
|
pressColor?: string;
|
||||||
|
/**
|
||||||
|
* Opacity when the button is pressed, used when ripple is not supported.
|
||||||
|
*/
|
||||||
|
pressOpacity?: number;
|
||||||
/**
|
/**
|
||||||
* Function which returns a React Element to display custom image in header's back button.
|
* Function which returns a React Element to display custom image in header's back button.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@6.0.0...@react-navigation/material-bottom-tabs@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.9...@react-navigation/material-bottom-tabs@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.9...@react-navigation/material-bottom-tabs@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
React Navigation integration for [bottom navigation](https://material.io/components/bottom-navigation) component from [`react-native-paper`](https://callstack.github.io/react-native-paper/bottom-navigation.html).
|
React Navigation integration for [bottom navigation](https://material.io/components/bottom-navigation) component from [`react-native-paper`](https://callstack.github.io/react-native-paper/bottom-navigation.html).
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-bottom-tab-navigator/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-bottom-tab-navigator/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "~0.63.51",
|
"@types/react-native": "~0.63.51",
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-paper": ">= 3.0.0",
|
"react-native-paper": ">= 3.0.0",
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@6.0.0...@react-navigation/material-top-tabs@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.9...@react-navigation/material-top-tabs@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.9...@react-navigation/material-top-tabs@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# `@react-navigation/material-top-tabs`
|
# `@react-navigation/material-top-tabs`
|
||||||
|
|
||||||
React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/react-native-community/react-native-tab-view).
|
React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/satya164/react-native-tab-view).
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-top-tab-navigator/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-top-tab-navigator/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
"warn-once": "^0.0.1"
|
"warn-once": "^0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "~0.63.51",
|
"@types/react-native": "~0.63.51",
|
||||||
@@ -59,10 +59,10 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-pager-view": ">= 1.0.0",
|
"react-native-pager-view": ">= 4.0.0",
|
||||||
"react-native-tab-view": ">= 3.0.0"
|
"react-native-tab-view": ">= 3.0.0"
|
||||||
},
|
},
|
||||||
"react-native-builder-bob": {
|
"react-native-builder-bob": {
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@6.0.0...@react-navigation/native@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.9...@react-navigation/native@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.9...@react-navigation/native@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
React Native integration for React Navigation.
|
React Native integration for React Navigation.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/getting-started/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/getting-started/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^6.0.0-next.0",
|
"@react-navigation/core": "^6.0.0-next.1",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.20"
|
"nanoid": "^3.1.20"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@6.0.0...@react-navigation/routers@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/routers
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.6.2...@react-navigation/routers@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.6.2...@react-navigation/routers@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ yarn add @react-navigation/routers
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/custom-routers/).
|
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/custom-routers/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.1",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
|
|||||||
@@ -3,6 +3,41 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
# [6.0.0-next.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.2...@react-navigation/stack@6.0.0-next.3) (2021-03-12)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* export drawer button ([2c8401d](https://github.com/react-navigation/react-navigation/commit/2c8401d5cb347d37c96e5b30f8ad05c17fd22ea4))
|
||||||
|
* return nearest parent header height for useHeaderHeight ([24b3f73](https://github.com/react-navigation/react-navigation/commit/24b3f739da4b8af8dca77d92c72cfdaa762e564a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [6.0.0-next.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.1...@react-navigation/stack@6.0.0-next.2) (2021-03-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* respect headerStatusBarHeight option in Stack ([#9405](https://github.com/react-navigation/react-navigation/issues/9405)) ([8a6511c](https://github.com/react-navigation/react-navigation/commit/8a6511c491b2affbe378d720e613a3e3041ca9c2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [6.0.0-next.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0...@react-navigation/stack@6.0.0-next.1) (2021-03-10)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix peer dep versions ([72f90b5](https://github.com/react-navigation/react-navigation/commit/72f90b50d27eda1315bb750beca8a36f26dafe17))
|
||||||
|
* remove use of deprecated currentlyFocusedField ([038eb87](https://github.com/react-navigation/react-navigation/commit/038eb87c42564f9d733e6870826726d3fb0adaee))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.6...@react-navigation/stack@6.0.0-next.0) (2021-03-09)
|
# [6.0.0-next.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.6...@react-navigation/stack@6.0.0-next.0) (2021-03-09)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
Stack navigator for React Navigation.
|
Stack navigator for React Navigation.
|
||||||
|
|
||||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/stack-navigator/).
|
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/stack-navigator/).
|
||||||
|
|||||||
@@ -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": "6.0.0-next.0",
|
"version": "6.0.0-next.3",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -41,13 +41,13 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0",
|
"@react-navigation/elements": "^1.0.0-next.2",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"react-native-iphone-x-helper": "^1.3.0",
|
"react-native-iphone-x-helper": "^1.3.0",
|
||||||
"warn-once": "^0.0.1"
|
"warn-once": "^0.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.0",
|
"@react-navigation/native": "^6.0.0-next.1",
|
||||||
"@testing-library/react-native": "^7.2.0",
|
"@testing-library/react-native": "^7.2.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
"typescript": "^4.2.3"
|
"typescript": "^4.2.3"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^5.0.5",
|
"@react-navigation/native": "^6.0.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": ">= 1.0.0",
|
"react-native-gesture-handler": ">= 1.0.0",
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type * as React from 'react';
|
import type * as React from 'react';
|
||||||
import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
||||||
import type {
|
import type {
|
||||||
NavigationProp,
|
NavigationProp,
|
||||||
ParamListBase,
|
ParamListBase,
|
||||||
@@ -149,10 +148,6 @@ export type StackHeaderProps = {
|
|||||||
* Layout of the screen.
|
* Layout of the screen.
|
||||||
*/
|
*/
|
||||||
layout: Layout;
|
layout: Layout;
|
||||||
/**
|
|
||||||
* Safe area insets to use in the header, e.g. to apply extra spacing for statusbar and notch.
|
|
||||||
*/
|
|
||||||
insets: EdgeInsets;
|
|
||||||
/**
|
/**
|
||||||
* Options for the back button.
|
* Options for the back button.
|
||||||
*/
|
*/
|
||||||
@@ -267,17 +262,6 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|||||||
* Not supported on Web.
|
* Not supported on Web.
|
||||||
*/
|
*/
|
||||||
gestureVelocityImpact?: number;
|
gestureVelocityImpact?: number;
|
||||||
/**
|
|
||||||
* Safe area insets for the screen. This is used to avoid elements like notch and status bar.
|
|
||||||
* By default, the device's safe area insets are automatically detected. You can override the behavior with this option.
|
|
||||||
* For example, to remove the extra spacing for status bar, pass `safeAreaInsets: { top: 0 }`.
|
|
||||||
*/
|
|
||||||
safeAreaInsets?: {
|
|
||||||
top?: number;
|
|
||||||
right?: number;
|
|
||||||
bottom?: number;
|
|
||||||
left?: number;
|
|
||||||
};
|
|
||||||
/**
|
/**
|
||||||
* Whether to detach the previous screen from the view hierarchy to save memory.
|
* Whether to detach the previous screen from the view hierarchy to save memory.
|
||||||
* Set it to `false` if you need the previous screen to be seen through the active screen.
|
* Set it to `false` if you need the previous screen to be seen through the active screen.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import { StackActions, useNavigationState } from '@react-navigation/native';
|
import { StackActions, useNavigationState } from '@react-navigation/native';
|
||||||
import { getHeaderTitle, HeaderShownContext } from '@react-navigation/elements';
|
import { getHeaderTitle, HeaderShownContext } from '@react-navigation/elements';
|
||||||
|
|
||||||
@@ -10,13 +11,14 @@ import type { StackHeaderProps } from '../../types';
|
|||||||
export default React.memo(function Header({
|
export default React.memo(function Header({
|
||||||
back,
|
back,
|
||||||
layout,
|
layout,
|
||||||
insets,
|
|
||||||
progress,
|
progress,
|
||||||
options,
|
options,
|
||||||
route,
|
route,
|
||||||
navigation,
|
navigation,
|
||||||
styleInterpolator,
|
styleInterpolator,
|
||||||
}: StackHeaderProps) {
|
}: StackHeaderProps) {
|
||||||
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
let previousTitle;
|
let previousTitle;
|
||||||
|
|
||||||
// The label for the left back button shows the title of the previous screen
|
// The label for the left back button shows the title of the previous screen
|
||||||
@@ -47,7 +49,11 @@ export default React.memo(function Header({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const statusBarHeight =
|
const statusBarHeight =
|
||||||
(isModal && !isFirstRouteInParent) || isParentHeaderShown ? 0 : insets.top;
|
options.headerStatusBarHeight !== undefined
|
||||||
|
? options.headerStatusBarHeight
|
||||||
|
: (isModal && !isFirstRouteInParent) || isParentHeaderShown
|
||||||
|
? 0
|
||||||
|
: insets.top;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HeaderSegment
|
<HeaderSegment
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
ParamListBase,
|
ParamListBase,
|
||||||
} from '@react-navigation/native';
|
} from '@react-navigation/native';
|
||||||
import { HeaderBackContext, getHeaderTitle } from '@react-navigation/elements';
|
import { HeaderBackContext, getHeaderTitle } from '@react-navigation/elements';
|
||||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
|
||||||
|
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import {
|
import {
|
||||||
@@ -28,7 +27,6 @@ import type {
|
|||||||
export type Props = {
|
export type Props = {
|
||||||
mode: 'float' | 'screen';
|
mode: 'float' | 'screen';
|
||||||
layout: Layout;
|
layout: Layout;
|
||||||
insets: EdgeInsets;
|
|
||||||
scenes: (Scene | undefined)[];
|
scenes: (Scene | undefined)[];
|
||||||
getPreviousScene: (props: { route: Route<string> }) => Scene | undefined;
|
getPreviousScene: (props: { route: Route<string> }) => Scene | undefined;
|
||||||
getFocusedRoute: () => Route<string>;
|
getFocusedRoute: () => Route<string>;
|
||||||
@@ -45,7 +43,6 @@ export default function HeaderContainer({
|
|||||||
mode,
|
mode,
|
||||||
scenes,
|
scenes,
|
||||||
layout,
|
layout,
|
||||||
insets,
|
|
||||||
getPreviousScene,
|
getPreviousScene,
|
||||||
getFocusedRoute,
|
getFocusedRoute,
|
||||||
onContentHeightChange,
|
onContentHeightChange,
|
||||||
@@ -105,7 +102,6 @@ export default function HeaderContainer({
|
|||||||
|
|
||||||
const props: StackHeaderProps = {
|
const props: StackHeaderProps = {
|
||||||
layout,
|
layout,
|
||||||
insets,
|
|
||||||
back: headerBack,
|
back: headerBack,
|
||||||
progress: scene.progress,
|
progress: scene.progress,
|
||||||
options: scene.descriptor.options,
|
options: scene.descriptor.options,
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ export default function HeaderSegment(props: Props) {
|
|||||||
headerBackTestID,
|
headerBackTestID,
|
||||||
headerBackAllowFontScaling,
|
headerBackAllowFontScaling,
|
||||||
headerBackTitleStyle,
|
headerBackTitleStyle,
|
||||||
|
headerTitleContainerStyle,
|
||||||
|
headerLeftContainerStyle,
|
||||||
|
headerRightContainerStyle,
|
||||||
|
headerBackgroundContainerStyle,
|
||||||
headerStyle: customHeaderStyle,
|
headerStyle: customHeaderStyle,
|
||||||
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
||||||
styleInterpolator,
|
styleInterpolator,
|
||||||
@@ -172,10 +176,13 @@ export default function HeaderSegment(props: Props) {
|
|||||||
layout={layout}
|
layout={layout}
|
||||||
headerTitle={headerTitle}
|
headerTitle={headerTitle}
|
||||||
headerLeft={headerLeft}
|
headerLeft={headerLeft}
|
||||||
headerTitleContainerStyle={titleStyle}
|
headerTitleContainerStyle={[titleStyle, headerTitleContainerStyle]}
|
||||||
headerLeftContainerStyle={leftButtonStyle}
|
headerLeftContainerStyle={[leftButtonStyle, headerLeftContainerStyle]}
|
||||||
headerRightContainerStyle={rightButtonStyle}
|
headerRightContainerStyle={[rightButtonStyle, headerRightContainerStyle]}
|
||||||
headerBackgroundContainerStyle={backgroundStyle}
|
headerBackgroundContainerStyle={[
|
||||||
|
backgroundStyle,
|
||||||
|
headerBackgroundContainerStyle,
|
||||||
|
]}
|
||||||
headerStyle={customHeaderStyle}
|
headerStyle={customHeaderStyle}
|
||||||
headerStatusBarHeight={headerStatusBarHeight}
|
headerStatusBarHeight={headerStatusBarHeight}
|
||||||
{...rest}
|
{...rest}
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
// @ts-expect-error: blurTextInput accepts both number and ref, but types say only ref
|
const input: InputRef = TextInput.State.currentlyFocusedInput();
|
||||||
const input: InputRef = TextInput.State.currentlyFocusedField();
|
|
||||||
|
|
||||||
// When a page change begins, blur the currently focused input
|
// When a page change begins, blur the currently focused input
|
||||||
input?.blur();
|
input?.blur();
|
||||||
|
|||||||
@@ -119,6 +119,8 @@ function CardContainer({
|
|||||||
scene,
|
scene,
|
||||||
transitionSpec,
|
transitionSpec,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
const { route } = scene.descriptor;
|
const { route } = scene.descriptor;
|
||||||
|
|
||||||
@@ -263,7 +265,9 @@ function CardContainer({
|
|||||||
<HeaderShownContext.Provider
|
<HeaderShownContext.Provider
|
||||||
value={isParentHeaderShown || headerShown !== false}
|
value={isParentHeaderShown || headerShown !== false}
|
||||||
>
|
>
|
||||||
<HeaderHeightContext.Provider value={headerHeight}>
|
<HeaderHeightContext.Provider
|
||||||
|
value={headerShown ? headerHeight : parentHeaderHeight}
|
||||||
|
>
|
||||||
{renderScene({ route: scene.descriptor.route })}
|
{renderScene({ route: scene.descriptor.route })}
|
||||||
</HeaderHeightContext.Provider>
|
</HeaderHeightContext.Provider>
|
||||||
</HeaderShownContext.Provider>
|
</HeaderShownContext.Provider>
|
||||||
@@ -274,7 +278,6 @@ function CardContainer({
|
|||||||
{renderHeader({
|
{renderHeader({
|
||||||
mode: 'screen',
|
mode: 'screen',
|
||||||
layout,
|
layout,
|
||||||
insets,
|
|
||||||
scenes: [previousScene, scene],
|
scenes: [previousScene, scene],
|
||||||
getPreviousScene,
|
getPreviousScene,
|
||||||
getFocusedRoute,
|
getFocusedRoute,
|
||||||
|
|||||||
@@ -108,13 +108,8 @@ const getHeaderHeights = (
|
|||||||
const height =
|
const height =
|
||||||
typeof style.height === 'number' ? style.height : previous[curr.key];
|
typeof style.height === 'number' ? style.height : previous[curr.key];
|
||||||
|
|
||||||
const safeAreaInsets = {
|
|
||||||
...insets,
|
|
||||||
...options.safeAreaInsets,
|
|
||||||
};
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
headerStatusBarHeight = isParentHeaderShown ? 0 : safeAreaInsets.top,
|
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
acc[curr.key] =
|
acc[curr.key] =
|
||||||
@@ -420,13 +415,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
|
||||||
top = insets.top,
|
|
||||||
right = insets.right,
|
|
||||||
bottom = insets.bottom,
|
|
||||||
left = insets.left,
|
|
||||||
} = focusedOptions.safeAreaInsets || {};
|
|
||||||
|
|
||||||
let activeScreensLimit = 1;
|
let activeScreensLimit = 1;
|
||||||
|
|
||||||
for (let i = scenes.length - 1; i >= 0; i--) {
|
for (let i = scenes.length - 1; i >= 0; i--) {
|
||||||
@@ -465,7 +453,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
{renderHeader({
|
{renderHeader({
|
||||||
mode: 'float',
|
mode: 'float',
|
||||||
layout,
|
layout,
|
||||||
insets: { top, right, bottom, left },
|
|
||||||
scenes,
|
scenes,
|
||||||
getPreviousScene: this.getPreviousScene,
|
getPreviousScene: this.getPreviousScene,
|
||||||
getFocusedRoute: this.getFocusedRoute,
|
getFocusedRoute: this.getFocusedRoute,
|
||||||
@@ -540,7 +527,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
safeAreaInsets,
|
|
||||||
headerShown = true,
|
headerShown = true,
|
||||||
headerTransparent,
|
headerTransparent,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
@@ -598,12 +584,10 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const safeAreaInsetTop = insets.top;
|
||||||
top: safeAreaInsetTop = insets.top,
|
const safeAreaInsetRight = insets.right;
|
||||||
right: safeAreaInsetRight = insets.right,
|
const safeAreaInsetBottom = insets.bottom;
|
||||||
bottom: safeAreaInsetBottom = insets.bottom,
|
const safeAreaInsetLeft = insets.left;
|
||||||
left: safeAreaInsetLeft = insets.left,
|
|
||||||
} = safeAreaInsets || {};
|
|
||||||
|
|
||||||
const headerHeight =
|
const headerHeight =
|
||||||
headerShown !== false ? headerHeights[route.key] : 0;
|
headerShown !== false ? headerHeights[route.key] : 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user