Compare commits

..

1 Commits

Author SHA1 Message Date
Satyajit Sahoo
41736641c1 chore: publish
- @react-navigation/bottom-tabs@6.0.0-next.0
 - @react-navigation/core@6.0.0-next.0
 - @react-navigation/devtools@6.0.0-next.0
 - @react-navigation/drawer@6.0.0-next.0
 - @react-navigation/elements@1.0.0-next.0
 - @react-navigation/material-bottom-tabs@6.0.0-next.0
 - @react-navigation/material-top-tabs@6.0.0-next.0
 - @react-navigation/native@6.0.0-next.0
 - @react-navigation/routers@6.0.0-next.0
 - @react-navigation/stack@6.0.0-next.0
2021-03-09 17:44:47 +01:00
46 changed files with 119 additions and 264 deletions

View File

@@ -8,7 +8,7 @@
"version": "independent",
"command": {
"publish": {
"allowBranch": "main",
"allowBranch": "6.x",
"conventionalCommits": true,
"createRelease": "github",
"message": "chore: publish",

View File

@@ -3,25 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -2,4 +2,4 @@
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/6.x/bottom-tab-navigator/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/bottom-tab-navigator/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/bottom-tabs",
"description": "Bottom tab navigator following iOS design guidelines",
"version": "6.0.0-next.2",
"version": "6.0.0-next.0",
"keywords": [
"react-native-component",
"react-component",
@@ -37,12 +37,12 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/elements": "^1.0.0-next.2",
"@react-navigation/elements": "^1.0.0",
"color": "^3.1.3",
"warn-once": "^0.0.1"
},
"devDependencies": {
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/color": "^3.0.1",
"@types/react": "^16.9.53",
@@ -56,7 +56,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-safe-area-context": ">= 3.0.0",

View File

@@ -6,7 +6,7 @@ import {
// @ts-ignore
shouldUseActivityState,
} from 'react-native-screens';
import { ResourceSavingView } from '@react-navigation/elements';
import { ResourceSavingScene } from '@react-navigation/elements';
type Props = {
visible: boolean;
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
}
return (
<ResourceSavingView visible={visible} {...rest}>
<ResourceSavingScene visible={visible} {...rest}>
{children}
</ResourceSavingView>
</ResourceSavingScene>
);
}

View File

@@ -3,14 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/core",
"description": "Core utilities for building navigators",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react",
"react-native",
@@ -36,7 +36,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/routers": "^6.0.0-next.1",
"@react-navigation/routers": "^6.0.0-next.0",
"escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.20",
"query-string": "^6.14.1",

View File

@@ -3,14 +3,6 @@
All notable changes to this project will be documented in this file.
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)
**Note:** Version bump only for package @react-navigation/devtools

View File

@@ -2,7 +2,7 @@
Developer tools for React Navigation.
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/devtools).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/devtools).
## Installation

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/devtools",
"description": "Developer tools for React Navigation",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react",
"react-native",
@@ -37,7 +37,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/core": "^6.0.0-next.1",
"@react-navigation/core": "^6.0.0-next.0",
"deep-equal": "^2.0.5"
},
"devDependencies": {

View File

@@ -3,28 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -1,5 +1,5 @@
# `@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/6.x/drawer-navigator/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/drawer-navigator/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/drawer",
"description": "Drawer navigator component with animated transitions and gesturess",
"version": "6.0.0-next.2",
"version": "6.0.0-next.0",
"keywords": [
"react-native-component",
"react-component",
@@ -42,12 +42,12 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/elements": "^1.0.0-next.2",
"@react-navigation/elements": "^1.0.0",
"color": "^3.1.3",
"warn-once": "^0.0.1"
},
"devDependencies": {
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/react": "^16.9.53",
"@types/react-native": "~0.63.51",
@@ -62,7 +62,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-gesture-handler": ">= 1.0.0",

View File

@@ -11,7 +11,6 @@ export { default as DrawerItem } from './views/DrawerItem';
export { default as DrawerItemList } from './views/DrawerItemList';
export { default as DrawerContent } from './views/DrawerContent';
export { default as DrawerContentScrollView } from './views/DrawerContentScrollView';
export { default as DrawerToggleButton } from './views/DrawerToggleButton';
/**
* Utilities

View File

@@ -6,7 +6,7 @@ import {
// @ts-ignore
shouldUseActivityState,
} from 'react-native-screens';
import { ResourceSavingView } from '@react-navigation/elements';
import { ResourceSavingScene } from '@react-navigation/elements';
type Props = {
visible: boolean;
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
}
return (
<ResourceSavingView visible={visible} {...rest}>
<ResourceSavingScene visible={visible} {...rest}>
{children}
</ResourceSavingView>
</ResourceSavingScene>
);
}

View File

@@ -3,33 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -2,4 +2,4 @@
UI Components for React Navigation.
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/elements/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/elements/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/elements",
"description": "UI Components for React Navigation",
"version": "1.0.0-next.2",
"version": "1.0.0-next.0",
"keywords": [
"react-native",
"react-navigation",
@@ -39,7 +39,7 @@
},
"devDependencies": {
"@react-native-masked-view/masked-view": "^0.2.2",
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/react": "^16.9.53",
"@types/react-native": "~0.63.51",
@@ -50,7 +50,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-safe-area-context": ">= 3.0.0"

View File

@@ -22,8 +22,7 @@ export default function HeaderBackButton({
labelVisible = Platform.OS === 'ios',
onLabelLayout,
onPress,
pressColor,
pressOpacity,
pressColorAndroid: customPressColorAndroid,
screenLayout,
tintColor: customTintColor,
titleLayout,
@@ -32,7 +31,7 @@ export default function HeaderBackButton({
testID,
style,
}: HeaderBackButtonProps) {
const { colors } = useTheme();
const { dark, colors } = useTheme();
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
undefined | number
@@ -46,6 +45,13 @@ export default function HeaderBackButton({
default: colors.text,
});
const pressColorAndroid =
customPressColorAndroid !== undefined
? customPressColorAndroid
: dark
? 'rgba(255, 255, 255, .32)'
: 'rgba(0, 0, 0, .32)';
const handleLabelLayout = (e: LayoutChangeEvent) => {
onLabelLayout?.(e);
@@ -150,8 +156,7 @@ export default function HeaderBackButton({
accessibilityLabel={accessibilityLabel}
testID={testID}
onPress={disabled ? undefined : handlePress}
pressColor={pressColor}
pressOpacity={pressOpacity}
pressColor={pressColorAndroid}
android_ripple={{ borderless: true }}
style={[styles.container, disabled && styles.disabled, style]}
hitSlop={Platform.select({

View File

@@ -1,6 +1,5 @@
import * as React from 'react';
import { Platform, Pressable, PressableProps } from 'react-native';
import { useTheme } from '@react-navigation/native';
export type Props = PressableProps & {
pressColor?: string;
@@ -13,30 +12,24 @@ const ANDROID_SUPPORTS_RIPPLE =
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
/**
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
* PlatformPressable provides an abstraction on top of TouchableNativeFeedback and
* 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({
android_ripple,
pressColor,
pressColor = 'rgba(0, 0, 0, .32)',
pressOpacity,
style,
...rest
}: Props) {
const { dark } = useTheme();
return (
<Pressable
android_ripple={
ANDROID_SUPPORTS_RIPPLE
? {
color:
pressColor !== undefined
? pressColor
: dark
? 'rgba(255, 255, 255, .32)'
: 'rgba(0, 0, 0, .32)',
...android_ripple,
}
? { color: pressColor, ...android_ripple }
: undefined
}
style={({ pressed }) => [

View File

@@ -30,7 +30,6 @@ export default function Screen(props: Props) {
const insets = useSafeAreaInsets();
const isParentHeaderShown = React.useContext(HeaderShownContext);
const parentHeaderHeight = React.useContext(HeaderHeightContext);
const {
header,
@@ -51,9 +50,7 @@ export default function Screen(props: Props) {
<HeaderShownContext.Provider
value={isParentHeaderShown || headerShown !== false}
>
<HeaderHeightContext.Provider
value={headerShown ? headerHeight : parentHeaderHeight}
>
<HeaderHeightContext.Provider value={headerShown ? headerHeight : 0}>
{children}
</HeaderHeightContext.Provider>
</HeaderShownContext.Provider>

View File

@@ -11,7 +11,7 @@ export { default as getHeaderTitle } from './Header/getHeaderTitle';
export { default as MissingIcon } from './MissingIcon';
export { default as PlatformPressable } from './PlatformPressable';
export { default as ResourceSavingView } from './ResourceSavingView';
export { default as ResourceSavingScene } from './ResourceSavingScene';
export { default as SafeAreaProviderCompat } from './SafeAreaProviderCompat';
export { default as Screen } from './Screen';

View File

@@ -127,16 +127,13 @@ export type HeaderBackButtonProps = {
disabled?: boolean;
/**
* Callback to call when the button is pressed.
* By default, this triggers `goBack`.
*/
onPress?: () => void;
/**
* Color for material ripple (Android >= 5.0 only).
*/
pressColor?: string;
/**
* Opacity when the button is pressed, used when ripple is not supported.
*/
pressOpacity?: number;
pressColorAndroid?: string;
/**
* Function which returns a React Element to display custom image in header's back button.
*/

View File

@@ -3,17 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -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).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-bottom-tab-navigator/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-bottom-tab-navigator/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/material-bottom-tabs",
"description": "Integration for bottom navigation component from react-native-paper",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react-native-component",
"react-component",
@@ -42,7 +42,7 @@
"clean": "del lib"
},
"devDependencies": {
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/react": "^16.9.53",
"@types/react-native": "~0.63.51",
@@ -56,7 +56,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-paper": ">= 3.0.0",

View File

@@ -3,17 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -1,5 +1,5 @@
# `@react-navigation/material-top-tabs`
React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/satya164/react-native-tab-view).
React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/react-native-community/react-native-tab-view).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-top-tab-navigator/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-top-tab-navigator/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/material-top-tabs",
"description": "Integration for the animated tab view component from react-native-tab-view",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react-native-component",
"react-component",
@@ -46,7 +46,7 @@
"warn-once": "^0.0.1"
},
"devDependencies": {
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/react": "^16.9.53",
"@types/react-native": "~0.63.51",
@@ -59,10 +59,10 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-pager-view": ">= 4.0.0",
"react-native-pager-view": ">= 1.0.0",
"react-native-tab-view": ">= 3.0.0"
},
"react-native-builder-bob": {

View File

@@ -3,14 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -2,4 +2,4 @@
React Native integration for React Navigation.
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/getting-started/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/getting-started/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/native",
"description": "React Native integration for React Navigation",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react-native",
"react-navigation",
@@ -38,7 +38,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/core": "^6.0.0-next.1",
"@react-navigation/core": "^6.0.0-next.0",
"escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.20"
},

View File

@@ -3,14 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -14,4 +14,4 @@ yarn add @react-navigation/routers
## Usage
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/custom-routers/).
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/custom-routers/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/routers",
"description": "Routers to help build custom navigators",
"version": "6.0.0-next.1",
"version": "6.0.0-next.0",
"keywords": [
"react",
"react-native",

View File

@@ -3,41 +3,6 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -2,4 +2,4 @@
Stack navigator for React Navigation.
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/stack-navigator/).
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/stack-navigator/).

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/stack",
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
"version": "6.0.0-next.3",
"version": "6.0.0-next.0",
"keywords": [
"react-native-component",
"react-component",
@@ -41,13 +41,13 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/elements": "^1.0.0-next.2",
"@react-navigation/elements": "^1.0.0",
"color": "^3.1.3",
"react-native-iphone-x-helper": "^1.3.0",
"warn-once": "^0.0.1"
},
"devDependencies": {
"@react-navigation/native": "^6.0.0-next.1",
"@react-navigation/native": "^6.0.0-next.0",
"@testing-library/react-native": "^7.2.0",
"@types/color": "^3.0.1",
"@types/react": "^16.9.53",
@@ -62,7 +62,7 @@
"typescript": "^4.2.3"
},
"peerDependencies": {
"@react-navigation/native": "^6.0.0",
"@react-navigation/native": "^5.0.5",
"react": "*",
"react-native": "*",
"react-native-gesture-handler": ">= 1.0.0",

View File

@@ -1,5 +1,6 @@
import type * as React from 'react';
import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
import type { EdgeInsets } from 'react-native-safe-area-context';
import type {
NavigationProp,
ParamListBase,
@@ -148,6 +149,10 @@ export type StackHeaderProps = {
* Layout of the screen.
*/
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.
*/
@@ -262,6 +267,17 @@ export type StackNavigationOptions = StackHeaderOptions &
* Not supported on Web.
*/
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.
* Set it to `false` if you need the previous screen to be seen through the active screen.

View File

@@ -1,5 +1,4 @@
import * as React from 'react';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { StackActions, useNavigationState } from '@react-navigation/native';
import { getHeaderTitle, HeaderShownContext } from '@react-navigation/elements';
@@ -11,14 +10,13 @@ import type { StackHeaderProps } from '../../types';
export default React.memo(function Header({
back,
layout,
insets,
progress,
options,
route,
navigation,
styleInterpolator,
}: StackHeaderProps) {
const insets = useSafeAreaInsets();
let previousTitle;
// The label for the left back button shows the title of the previous screen
@@ -49,11 +47,7 @@ export default React.memo(function Header({
);
const statusBarHeight =
options.headerStatusBarHeight !== undefined
? options.headerStatusBarHeight
: (isModal && !isFirstRouteInParent) || isParentHeaderShown
? 0
: insets.top;
(isModal && !isFirstRouteInParent) || isParentHeaderShown ? 0 : insets.top;
return (
<HeaderSegment

View File

@@ -7,6 +7,7 @@ import {
ParamListBase,
} from '@react-navigation/native';
import { HeaderBackContext, getHeaderTitle } from '@react-navigation/elements';
import type { EdgeInsets } from 'react-native-safe-area-context';
import Header from './Header';
import {
@@ -27,6 +28,7 @@ import type {
export type Props = {
mode: 'float' | 'screen';
layout: Layout;
insets: EdgeInsets;
scenes: (Scene | undefined)[];
getPreviousScene: (props: { route: Route<string> }) => Scene | undefined;
getFocusedRoute: () => Route<string>;
@@ -43,6 +45,7 @@ export default function HeaderContainer({
mode,
scenes,
layout,
insets,
getPreviousScene,
getFocusedRoute,
onContentHeightChange,
@@ -102,6 +105,7 @@ export default function HeaderContainer({
const props: StackHeaderProps = {
layout,
insets,
back: headerBack,
progress: scene.progress,
options: scene.descriptor.options,

View File

@@ -111,10 +111,6 @@ export default function HeaderSegment(props: Props) {
headerBackTestID,
headerBackAllowFontScaling,
headerBackTitleStyle,
headerTitleContainerStyle,
headerLeftContainerStyle,
headerRightContainerStyle,
headerBackgroundContainerStyle,
headerStyle: customHeaderStyle,
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
styleInterpolator,
@@ -176,13 +172,10 @@ export default function HeaderSegment(props: Props) {
layout={layout}
headerTitle={headerTitle}
headerLeft={headerLeft}
headerTitleContainerStyle={[titleStyle, headerTitleContainerStyle]}
headerLeftContainerStyle={[leftButtonStyle, headerLeftContainerStyle]}
headerRightContainerStyle={[rightButtonStyle, headerRightContainerStyle]}
headerBackgroundContainerStyle={[
backgroundStyle,
headerBackgroundContainerStyle,
]}
headerTitleContainerStyle={titleStyle}
headerLeftContainerStyle={leftButtonStyle}
headerRightContainerStyle={rightButtonStyle}
headerBackgroundContainerStyle={backgroundStyle}
headerStyle={customHeaderStyle}
headerStatusBarHeight={headerStatusBarHeight}
{...rest}

View File

@@ -37,7 +37,8 @@ export default class KeyboardManager extends React.Component<Props> {
this.clearKeyboardTimeout();
const input: InputRef = TextInput.State.currentlyFocusedInput();
// @ts-expect-error: blurTextInput accepts both number and ref, but types say only ref
const input: InputRef = TextInput.State.currentlyFocusedField();
// When a page change begins, blur the currently focused input
input?.blur();

View File

@@ -119,8 +119,6 @@ function CardContainer({
scene,
transitionSpec,
}: Props) {
const parentHeaderHeight = React.useContext(HeaderHeightContext);
const handleOpen = () => {
const { route } = scene.descriptor;
@@ -265,9 +263,7 @@ function CardContainer({
<HeaderShownContext.Provider
value={isParentHeaderShown || headerShown !== false}
>
<HeaderHeightContext.Provider
value={headerShown ? headerHeight : parentHeaderHeight}
>
<HeaderHeightContext.Provider value={headerHeight}>
{renderScene({ route: scene.descriptor.route })}
</HeaderHeightContext.Provider>
</HeaderShownContext.Provider>
@@ -278,6 +274,7 @@ function CardContainer({
{renderHeader({
mode: 'screen',
layout,
insets,
scenes: [previousScene, scene],
getPreviousScene,
getFocusedRoute,

View File

@@ -108,8 +108,13 @@ const getHeaderHeights = (
const height =
typeof style.height === 'number' ? style.height : previous[curr.key];
const safeAreaInsets = {
...insets,
...options.safeAreaInsets,
};
const {
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
headerStatusBarHeight = isParentHeaderShown ? 0 : safeAreaInsets.top,
} = options;
acc[curr.key] =
@@ -415,6 +420,13 @@ 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;
for (let i = scenes.length - 1; i >= 0; i--) {
@@ -453,6 +465,7 @@ export default class CardStack extends React.Component<Props, State> {
{renderHeader({
mode: 'float',
layout,
insets: { top, right, bottom, left },
scenes,
getPreviousScene: this.getPreviousScene,
getFocusedRoute: this.getFocusedRoute,
@@ -527,6 +540,7 @@ export default class CardStack extends React.Component<Props, State> {
}
const {
safeAreaInsets,
headerShown = true,
headerTransparent,
cardShadowEnabled,
@@ -584,10 +598,12 @@ export default class CardStack extends React.Component<Props, State> {
}
}
const safeAreaInsetTop = insets.top;
const safeAreaInsetRight = insets.right;
const safeAreaInsetBottom = insets.bottom;
const safeAreaInsetLeft = insets.left;
const {
top: safeAreaInsetTop = insets.top,
right: safeAreaInsetRight = insets.right,
bottom: safeAreaInsetBottom = insets.bottom,
left: safeAreaInsetLeft = insets.left,
} = safeAreaInsets || {};
const headerHeight =
headerShown !== false ? headerHeights[route.key] : 0;