mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-24 12:58:15 +08:00
Compare commits
11 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65b6a3d864 | ||
|
|
211f1f2c0e | ||
|
|
22b7c3f6c1 | ||
|
|
6ebe0824df | ||
|
|
82900cceff | ||
|
|
dc4ffc0171 | ||
|
|
9c30c42c0b | ||
|
|
ea8ea20127 | ||
|
|
2f282f1070 | ||
|
|
5165eb76aa | ||
|
|
7c722d2028 |
@@ -4,42 +4,41 @@ beforeEach(async () => {
|
|||||||
await page.click('[data-testid=LinkComponent]');
|
await page.click('[data-testid=LinkComponent]');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('loads the article page', async () => {
|
const getPageInfo = async () => ({
|
||||||
expect(await page.evaluate(() => location.pathname + location.search)).toBe(
|
url: await page.evaluate(() => location.pathname + location.search),
|
||||||
'/link-component/article/gandalf'
|
title: await page.evaluate(() => document.title),
|
||||||
);
|
heading: (await page.accessibility.snapshot())?.children?.find(
|
||||||
|
(it) => it.role === 'heading'
|
||||||
|
)?.name,
|
||||||
|
});
|
||||||
|
|
||||||
expect(
|
it('loads the article page', async () => {
|
||||||
((await page.accessibility.snapshot()) as any)?.children?.find(
|
const { url, title, heading } = await getPageInfo();
|
||||||
(it: any) => it.role === 'heading'
|
|
||||||
)?.name
|
expect(url).toBe('/link-component/article/gandalf');
|
||||||
).toBe('Article by Gandalf');
|
expect(title).toBe('Article by Gandalf - React Navigation Example');
|
||||||
|
expect(heading).toBe('Article by Gandalf');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('goes to the album page and goes back', async () => {
|
it('goes to the album page and goes back', async () => {
|
||||||
await page.click('[href="/link-component/music"]');
|
await page.click('[href="/link-component/music"]');
|
||||||
|
|
||||||
expect(await page.evaluate(() => location.pathname + location.search)).toBe(
|
{
|
||||||
'/link-component/music'
|
const { url, title, heading } = await getPageInfo();
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
expect(url).toBe('/link-component/music');
|
||||||
((await page.accessibility.snapshot()) as any)?.children?.find(
|
expect(title).toBe('Albums - React Navigation Example');
|
||||||
(it: any) => it.role === 'heading'
|
expect(heading).toBe('Albums');
|
||||||
)?.name
|
}
|
||||||
).toBe('Albums');
|
|
||||||
|
|
||||||
await page.click('[aria-label="Article by Gandalf, back"]');
|
await page.click('[aria-label="Article by Gandalf, back"]');
|
||||||
|
|
||||||
await page.waitForNavigation();
|
await page.waitForNavigation();
|
||||||
|
|
||||||
expect(await page.evaluate(() => location.pathname + location.search)).toBe(
|
{
|
||||||
'/link-component/article/gandalf'
|
const { url, title, heading } = await getPageInfo();
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
expect(url).toBe('/link-component/article/gandalf');
|
||||||
((await page.accessibility.snapshot()) as any)?.children?.find(
|
expect(title).toBe('Article by Gandalf - React Navigation Example');
|
||||||
(it: any) => it.role === 'heading'
|
expect(heading).toBe('Article by Gandalf');
|
||||||
)?.name
|
}
|
||||||
).toBe('Article by Gandalf');
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
"@types/cheerio": "^0.22.28",
|
"@types/cheerio": "^0.22.28",
|
||||||
"@types/jest-dev-server": "^4.2.0",
|
"@types/jest-dev-server": "^4.2.0",
|
||||||
"@types/koa": "^2.13.1",
|
"@types/koa": "^2.13.1",
|
||||||
|
"@types/mock-require": "^2.0.0",
|
||||||
"@types/node-fetch": "^2.5.9",
|
"@types/node-fetch": "^2.5.9",
|
||||||
"@types/react": "~16.9.35",
|
"@types/react": "~16.9.35",
|
||||||
"@types/react-dom": "~16.9.8",
|
"@types/react-dom": "~16.9.8",
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
"expo-cli": "^4.4.4",
|
"expo-cli": "^4.4.4",
|
||||||
"jest": "^26.6.3",
|
"jest": "^26.6.3",
|
||||||
"jest-dev-server": "^4.4.0",
|
"jest-dev-server": "^4.4.0",
|
||||||
|
"mock-require": "^3.0.3",
|
||||||
"mock-require-assets": "^0.0.1",
|
"mock-require-assets": "^0.0.1",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'mock-require-assets';
|
import 'mock-require-assets';
|
||||||
|
|
||||||
|
import mock from 'mock-require';
|
||||||
import Module from 'module';
|
import Module from 'module';
|
||||||
|
|
||||||
// We need to make sure that .web.xx extensions are resolved before .xx
|
// We need to make sure that .web.xx extensions are resolved before .xx
|
||||||
@@ -10,3 +11,14 @@ Module._extensions = Object.fromEntries(
|
|||||||
return b[0].split('.').length - a[0].split('.').length;
|
return b[0].split('.').length - a[0].split('.').length;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Set __DEV__ that expo needs
|
||||||
|
// @ts-expect-error
|
||||||
|
global.__DEV__ = process.env.NODE_ENV !== 'production';
|
||||||
|
|
||||||
|
// Reanimated doesn't support SSR :(
|
||||||
|
mock(
|
||||||
|
'react-native-reanimated',
|
||||||
|
// eslint-disable-next-line import/no-commonjs
|
||||||
|
{ ...require('react-native-reanimated/mock').default, call() {} }
|
||||||
|
);
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import { ScrollView, StyleSheet } from 'react-native';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
|
import { BlurView } from 'expo-blur';
|
||||||
import {
|
import {
|
||||||
getFocusedRouteNameFromRoute,
|
getFocusedRouteNameFromRoute,
|
||||||
ParamListBase,
|
ParamListBase,
|
||||||
NavigatorScreenParams,
|
NavigatorScreenParams,
|
||||||
} from '@react-navigation/native';
|
} from '@react-navigation/native';
|
||||||
import type { StackScreenProps } from '@react-navigation/stack';
|
import type { StackScreenProps } from '@react-navigation/stack';
|
||||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
import {
|
||||||
|
createBottomTabNavigator,
|
||||||
|
useBottomTabBarHeight,
|
||||||
|
} from '@react-navigation/bottom-tabs';
|
||||||
import { HeaderBackButton } from '@react-navigation/elements';
|
import { HeaderBackButton } from '@react-navigation/elements';
|
||||||
import Albums from '../Shared/Albums';
|
import Albums from '../Shared/Albums';
|
||||||
import Contacts from '../Shared/Contacts';
|
import Contacts from '../Shared/Contacts';
|
||||||
@@ -28,6 +33,16 @@ type BottomTabParams = {
|
|||||||
TabChat: undefined;
|
TabChat: undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const AlbumsScreen = () => {
|
||||||
|
const tabBarHeight = useBottomTabBarHeight();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScrollView contentContainerStyle={{ paddingBottom: tabBarHeight }}>
|
||||||
|
<Albums scrollEnabled={false} />
|
||||||
|
</ScrollView>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const BottomTabs = createBottomTabNavigator<BottomTabParams>();
|
const BottomTabs = createBottomTabNavigator<BottomTabParams>();
|
||||||
|
|
||||||
export default function BottomTabsScreen({
|
export default function BottomTabsScreen({
|
||||||
@@ -78,10 +93,18 @@ export default function BottomTabsScreen({
|
|||||||
/>
|
/>
|
||||||
<BottomTabs.Screen
|
<BottomTabs.Screen
|
||||||
name="TabAlbums"
|
name="TabAlbums"
|
||||||
component={Albums}
|
component={AlbumsScreen}
|
||||||
options={{
|
options={{
|
||||||
title: 'Albums',
|
title: 'Albums',
|
||||||
tabBarIcon: getTabBarIcon('image-album'),
|
tabBarIcon: getTabBarIcon('image-album'),
|
||||||
|
tabBarStyle: { position: 'absolute' },
|
||||||
|
tabBarBackground: () => (
|
||||||
|
<BlurView
|
||||||
|
tint="light"
|
||||||
|
intensity={100}
|
||||||
|
style={StyleSheet.absoluteFill}
|
||||||
|
/>
|
||||||
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</BottomTabs.Navigator>
|
</BottomTabs.Navigator>
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ export default function App() {
|
|||||||
return () => Dimensions.removeEventListener('change', onDimensionsChange);
|
return () => Dimensions.removeEventListener('change', onDimensionsChange);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const navigationRef = useNavigationContainerRef<RootStackParamList>();
|
const navigationRef = useNavigationContainerRef();
|
||||||
|
|
||||||
useReduxDevToolsExtension(navigationRef);
|
useReduxDevToolsExtension(navigationRef);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
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.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.10...@react-navigation/bottom-tabs@6.0.0-next.11) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix tab bar height including extra bottom inset ([7c722d2](https://github.com/react-navigation/react-navigation/commit/7c722d2028e914e8f143b9385ebf5e1c00131a01))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add a tabBarBackground option to bottom tabs ([2f282f1](https://github.com/react-navigation/react-navigation/commit/2f282f107053a65b69f80edb5d9c858cfa569aa2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.9...@react-navigation/bottom-tabs@6.0.0-next.10) (2021-05-10)
|
# [6.0.0-next.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.9...@react-navigation/bottom-tabs@6.0.0-next.10) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.10",
|
"version": "6.0.0-next.11",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -36,12 +36,12 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0-next.9",
|
"@react-navigation/elements": "^1.0.0-next.10",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"warn-once": "^0.1.0"
|
"warn-once": "^0.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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",
|
||||||
|
|||||||
@@ -229,6 +229,15 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
|||||||
*/
|
*/
|
||||||
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component to use as background for the tab bar.
|
||||||
|
* You could render an image, a gradient, blur view etc.
|
||||||
|
*
|
||||||
|
* When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.
|
||||||
|
* You'd also need to use `useBottomTabBarHeight()` to add a bottom padding to your content.
|
||||||
|
*/
|
||||||
|
tabBarBackground?: () => React.ReactNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this screen should be unmounted when navigating away from it.
|
* Whether this screen should be unmounted when navigating away from it.
|
||||||
* Defaults to `false`.
|
* Defaults to `false`.
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ export default function BottomTabBar({
|
|||||||
tabBarHideOnKeyboard = false,
|
tabBarHideOnKeyboard = false,
|
||||||
tabBarVisibilityAnimationConfig,
|
tabBarVisibilityAnimationConfig,
|
||||||
tabBarStyle,
|
tabBarStyle,
|
||||||
|
tabBarBackground,
|
||||||
} = focusedOptions;
|
} = focusedOptions;
|
||||||
|
|
||||||
const dimensions = useSafeAreaFrame();
|
const dimensions = useSafeAreaFrame();
|
||||||
@@ -211,15 +212,7 @@ export default function BottomTabBar({
|
|||||||
const handleLayout = (e: LayoutChangeEvent) => {
|
const handleLayout = (e: LayoutChangeEvent) => {
|
||||||
const { height, width } = e.nativeEvent.layout;
|
const { height, width } = e.nativeEvent.layout;
|
||||||
|
|
||||||
const topBorderWidth =
|
onHeightChange?.(height);
|
||||||
// @ts-ignore
|
|
||||||
StyleSheet.flatten([styles.tabBar, tabBarStyle])?.borderTopWidth;
|
|
||||||
|
|
||||||
onHeightChange?.(
|
|
||||||
height +
|
|
||||||
paddingBottom +
|
|
||||||
(typeof topBorderWidth === 'number' ? topBorderWidth : 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
setLayout((layout) => {
|
setLayout((layout) => {
|
||||||
if (height === layout.height && width === layout.width) {
|
if (height === layout.height && width === layout.width) {
|
||||||
@@ -252,12 +245,15 @@ export default function BottomTabBar({
|
|||||||
layout,
|
layout,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tabBarBackgroundElement = tabBarBackground?.();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Animated.View
|
<Animated.View
|
||||||
style={[
|
style={[
|
||||||
styles.tabBar,
|
styles.tabBar,
|
||||||
{
|
{
|
||||||
backgroundColor: colors.card,
|
backgroundColor:
|
||||||
|
tabBarBackgroundElement != null ? 'transparent' : colors.card,
|
||||||
borderTopColor: colors.border,
|
borderTopColor: colors.border,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -286,6 +282,9 @@ export default function BottomTabBar({
|
|||||||
pointerEvents={isTabBarHidden ? 'none' : 'auto'}
|
pointerEvents={isTabBarHidden ? 'none' : 'auto'}
|
||||||
onLayout={handleLayout}
|
onLayout={handleLayout}
|
||||||
>
|
>
|
||||||
|
<View pointerEvents="none" style={StyleSheet.absoluteFill}>
|
||||||
|
{tabBarBackgroundElement}
|
||||||
|
</View>
|
||||||
<View accessibilityRole="tablist" style={styles.content}>
|
<View accessibilityRole="tablist" style={styles.content}>
|
||||||
{routes.map((route, index) => {
|
{routes.map((route, index) => {
|
||||||
const focused = index === state.index;
|
const focused = index === state.index;
|
||||||
|
|||||||
@@ -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.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.7...@react-navigation/core@6.0.0-next.8) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix type error when passing unannotated navigation ref ([dc4ffc0](https://github.com/react-navigation/react-navigation/commit/dc4ffc0171b4535fe1b6e839b9d54350121bcf55))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.6...@react-navigation/core@6.0.0-next.7) (2021-05-10)
|
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.6...@react-navigation/core@6.0.0-next.7) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.7",
|
"version": "6.0.0-next.8",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import type { ParamListBase } from '@react-navigation/routers';
|
|
||||||
import createNavigationContainerRef from './createNavigationContainerRef';
|
import createNavigationContainerRef from './createNavigationContainerRef';
|
||||||
import type { NavigationContainerRefWithCurrent } from './types';
|
import type { NavigationContainerRefWithCurrent } from './types';
|
||||||
|
|
||||||
export default function useNavigationContainerRef<
|
export default function useNavigationContainerRef<
|
||||||
ParamList extends ParamListBase
|
ParamList extends {} = ReactNavigation.RootParamList
|
||||||
>(): NavigationContainerRefWithCurrent<ParamList> {
|
>(): NavigationContainerRefWithCurrent<ParamList> {
|
||||||
const navigation = React.useRef<NavigationContainerRefWithCurrent<ParamList> | null>(
|
const navigation = React.useRef<NavigationContainerRefWithCurrent<ParamList> | null>(
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -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.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@6.0.0-next.7...@react-navigation/devtools@6.0.0-next.8) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix type error when passing unannotated navigation ref ([dc4ffc0](https://github.com/react-navigation/react-navigation/commit/dc4ffc0171b4535fe1b6e839b9d54350121bcf55))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@6.0.0-next.6...@react-navigation/devtools@6.0.0-next.7) (2021-05-10)
|
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@6.0.0-next.6...@react-navigation/devtools@6.0.0-next.7) (2021-05-10)
|
||||||
|
|
||||||
**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": "6.0.0-next.7",
|
"version": "6.0.0-next.8",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^6.0.0-next.7",
|
"@react-navigation/core": "^6.0.0-next.8",
|
||||||
"deep-equal": "^2.0.5"
|
"deep-equal": "^2.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import type {
|
|||||||
NavigationContainerRef,
|
NavigationContainerRef,
|
||||||
NavigationState,
|
NavigationState,
|
||||||
NavigationAction,
|
NavigationAction,
|
||||||
ParamListBase,
|
|
||||||
} from '@react-navigation/core';
|
} from '@react-navigation/core';
|
||||||
import deepEqual from 'deep-equal';
|
import deepEqual from 'deep-equal';
|
||||||
|
|
||||||
@@ -23,7 +22,7 @@ type DevToolsExtension = {
|
|||||||
declare const __REDUX_DEVTOOLS_EXTENSION__: DevToolsExtension | undefined;
|
declare const __REDUX_DEVTOOLS_EXTENSION__: DevToolsExtension | undefined;
|
||||||
|
|
||||||
export default function useReduxDevToolsExtension(
|
export default function useReduxDevToolsExtension(
|
||||||
ref: React.RefObject<NavigationContainerRef<ParamListBase>>
|
ref: React.RefObject<NavigationContainerRef<any>>
|
||||||
) {
|
) {
|
||||||
const devToolsRef = React.useRef<DevToolsConnection>();
|
const devToolsRef = React.useRef<DevToolsConnection>();
|
||||||
|
|
||||||
|
|||||||
@@ -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.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@6.0.0-next.9...@react-navigation/drawer@6.0.0-next.10) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer content padding in RTL ([ea8ea20](https://github.com/react-navigation/react-navigation/commit/ea8ea20127d979d8c8ddbddf56de1bdfdf0243f9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@6.0.0-next.8...@react-navigation/drawer@6.0.0-next.9) (2021-05-10)
|
# [6.0.0-next.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@6.0.0-next.8...@react-navigation/drawer@6.0.0-next.9) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.9",
|
"version": "6.0.0-next.10",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -41,12 +41,12 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0-next.9",
|
"@react-navigation/elements": "^1.0.0-next.10",
|
||||||
"color": "^3.1.3",
|
"color": "^3.1.3",
|
||||||
"warn-once": "^0.1.0"
|
"warn-once": "^0.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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.64.4",
|
"@types/react-native": "~0.64.4",
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { ScrollView, StyleSheet, ScrollViewProps } from 'react-native';
|
import {
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
ScrollViewProps,
|
||||||
|
I18nManager,
|
||||||
|
} from 'react-native';
|
||||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import DrawerPositionContext from '../utils/DrawerPositionContext';
|
import DrawerPositionContext from '../utils/DrawerPositionContext';
|
||||||
|
|
||||||
@@ -16,14 +21,18 @@ export default function DrawerContentScrollView({
|
|||||||
const drawerPosition = React.useContext(DrawerPositionContext);
|
const drawerPosition = React.useContext(DrawerPositionContext);
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
|
const isRight = I18nManager.isRTL
|
||||||
|
? drawerPosition === 'left'
|
||||||
|
: drawerPosition === 'right';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
{...rest}
|
{...rest}
|
||||||
contentContainerStyle={[
|
contentContainerStyle={[
|
||||||
{
|
{
|
||||||
paddingTop: insets.top + 4,
|
paddingTop: insets.top + 4,
|
||||||
paddingLeft: drawerPosition === 'left' ? insets.left : 0,
|
paddingStart: !isRight ? insets.left : 0,
|
||||||
paddingRight: drawerPosition === 'right' ? insets.right : 0,
|
paddingEnd: isRight ? insets.right : 0,
|
||||||
},
|
},
|
||||||
contentContainerStyle,
|
contentContainerStyle,
|
||||||
]}
|
]}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
# [1.0.0-next.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0-next.9...@react-navigation/elements@1.0.0-next.10) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer content padding in RTL ([ea8ea20](https://github.com/react-navigation/react-navigation/commit/ea8ea20127d979d8c8ddbddf56de1bdfdf0243f9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [1.0.0-next.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0-next.8...@react-navigation/elements@1.0.0-next.9) (2021-05-10)
|
# [1.0.0-next.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0-next.8...@react-navigation/elements@1.0.0-next.9) (2021-05-10)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/elements
|
**Note:** Version bump only for package @react-navigation/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.9",
|
"version": "1.0.0-next.10",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-masked-view/masked-view": "^0.2.3",
|
"@react-native-masked-view/masked-view": "^0.2.3",
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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.64.4",
|
"@types/react-native": "~0.64.4",
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ export default function Header(props: Props) {
|
|||||||
style={[
|
style={[
|
||||||
styles.left,
|
styles.left,
|
||||||
headerTitleAlign === 'center' && styles.expand,
|
headerTitleAlign === 'center' && styles.expand,
|
||||||
{ marginLeft: insets.left },
|
{ marginStart: insets.left },
|
||||||
leftContainerStyle,
|
leftContainerStyle,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@@ -236,7 +236,7 @@ export default function Header(props: Props) {
|
|||||||
style={[
|
style={[
|
||||||
styles.right,
|
styles.right,
|
||||||
styles.expand,
|
styles.expand,
|
||||||
{ marginRight: insets.right },
|
{ marginEnd: insets.right },
|
||||||
rightContainerStyle,
|
rightContainerStyle,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -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.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@6.0.0-next.7...@react-navigation/material-bottom-tabs@6.0.0-next.8) (2021-05-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@6.0.0-next.6...@react-navigation/material-bottom-tabs@6.0.0-next.7) (2021-05-10)
|
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@6.0.0-next.6...@react-navigation/material-bottom-tabs@6.0.0-next.7) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.7",
|
"version": "6.0.0-next.8",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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.64.4",
|
"@types/react-native": "~0.64.4",
|
||||||
|
|||||||
@@ -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.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@6.0.0-next.8...@react-navigation/material-top-tabs@6.0.0-next.9) (2021-05-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@6.0.0-next.7...@react-navigation/material-top-tabs@6.0.0-next.8) (2021-05-10)
|
# [6.0.0-next.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@6.0.0-next.7...@react-navigation/material-top-tabs@6.0.0-next.8) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.8",
|
"version": "6.0.0-next.9",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"warn-once": "^0.1.0"
|
"warn-once": "^0.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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.64.4",
|
"@types/react-native": "~0.64.4",
|
||||||
|
|||||||
@@ -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.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@6.0.0-next.7...@react-navigation/native@6.0.0-next.8) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* add ability to pass generic params to Link ([9c30c42](https://github.com/react-navigation/react-navigation/commit/9c30c42c0bddbc90c58b79a8be6d57e57a131e77))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@6.0.0-next.6...@react-navigation/native@6.0.0-next.7) (2021-05-10)
|
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@6.0.0-next.6...@react-navigation/native@6.0.0-next.7) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.7",
|
"version": "6.0.0-next.8",
|
||||||
"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": "^6.0.0-next.7",
|
"@react-navigation/core": "^6.0.0-next.8",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.22"
|
"nanoid": "^3.1.22"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import type { NavigationAction } from '@react-navigation/core';
|
|||||||
import useLinkProps from './useLinkProps';
|
import useLinkProps from './useLinkProps';
|
||||||
import type { To } from './useLinkTo';
|
import type { To } from './useLinkTo';
|
||||||
|
|
||||||
type Props = {
|
type Props<ParamList extends ReactNavigation.RootParamList> = {
|
||||||
to: To;
|
to: To<ParamList>;
|
||||||
action?: NavigationAction;
|
action?: NavigationAction;
|
||||||
target?: string;
|
target?: string;
|
||||||
onPress?: (
|
onPress?: (
|
||||||
@@ -21,8 +21,12 @@ type Props = {
|
|||||||
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
||||||
* @param props.children Child elements to render the content.
|
* @param props.children Child elements to render the content.
|
||||||
*/
|
*/
|
||||||
export default function Link({ to, action, ...rest }: Props) {
|
export default function Link<ParamList extends ReactNavigation.RootParamList>({
|
||||||
const props = useLinkProps({ to, action });
|
to,
|
||||||
|
action,
|
||||||
|
...rest
|
||||||
|
}: Props<ParamList>) {
|
||||||
|
const props = useLinkProps<ParamList>({ to, action });
|
||||||
|
|
||||||
const onPress = (
|
const onPress = (
|
||||||
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ export * from '@react-navigation/core';
|
|||||||
|
|
||||||
export { default as NavigationContainer } from './NavigationContainer';
|
export { default as NavigationContainer } from './NavigationContainer';
|
||||||
|
|
||||||
export { default as useBackButton } from './useBackButton';
|
|
||||||
export { default as useScrollToTop } from './useScrollToTop';
|
export { default as useScrollToTop } from './useScrollToTop';
|
||||||
|
|
||||||
export { default as DefaultTheme } from './theming/DefaultTheme';
|
export { default as DefaultTheme } from './theming/DefaultTheme';
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import {
|
|||||||
} from '@react-navigation/core';
|
} from '@react-navigation/core';
|
||||||
import useLinkTo, { To } from './useLinkTo';
|
import useLinkTo, { To } from './useLinkTo';
|
||||||
|
|
||||||
type Props = {
|
type Props<ParamList extends ReactNavigation.RootParamList> = {
|
||||||
to: To;
|
to: To<ParamList>;
|
||||||
action?: NavigationAction;
|
action?: NavigationAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -17,9 +17,11 @@ type Props = {
|
|||||||
* @param props.to Absolute path to screen (e.g. `/feeds/hot`).
|
* @param props.to Absolute path to screen (e.g. `/feeds/hot`).
|
||||||
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
* @param props.action Optional action to use for in-page navigation. By default, the path is parsed to an action based on linking config.
|
||||||
*/
|
*/
|
||||||
export default function useLinkProps({ to, action }: Props) {
|
export default function useLinkProps<
|
||||||
|
ParamList extends ReactNavigation.RootParamList
|
||||||
|
>({ to, action }: Props<ParamList>) {
|
||||||
const navigation = React.useContext(NavigationHelpersContext);
|
const navigation = React.useContext(NavigationHelpersContext);
|
||||||
const linkTo = useLinkTo();
|
const linkTo = useLinkTo<ParamList>();
|
||||||
|
|
||||||
const onPress = (
|
const onPress = (
|
||||||
e?: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
e?: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
||||||
|
|||||||
@@ -21,12 +21,14 @@ export type To<
|
|||||||
params: ParamList[RouteName];
|
params: ParamList[RouteName];
|
||||||
});
|
});
|
||||||
|
|
||||||
export default function useLinkTo() {
|
export default function useLinkTo<
|
||||||
|
ParamList extends ReactNavigation.RootParamList
|
||||||
|
>() {
|
||||||
const navigation = React.useContext(NavigationContext);
|
const navigation = React.useContext(NavigationContext);
|
||||||
const linking = React.useContext(LinkingContext);
|
const linking = React.useContext(LinkingContext);
|
||||||
|
|
||||||
const linkTo = React.useCallback(
|
const linkTo = React.useCallback(
|
||||||
(to: To) => {
|
(to: To<ParamList>) => {
|
||||||
if (navigation === undefined) {
|
if (navigation === undefined) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"Couldn't find a navigation object. Is your component inside a screen in a navigator?"
|
"Couldn't find a navigation object. Is your component inside a screen in a navigator?"
|
||||||
@@ -42,6 +44,7 @@ export default function useLinkTo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof to !== 'string') {
|
if (typeof to !== 'string') {
|
||||||
|
// @ts-expect-error: This is fine
|
||||||
root.navigate(to.screen, to.params);
|
root.navigate(to.screen, to.params);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,19 @@
|
|||||||
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.16](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.15...@react-navigation/stack@6.0.0-next.16) (2021-05-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't enable animation & gestures for first screen ([6ebe082](https://github.com/react-navigation/react-navigation/commit/6ebe0824df3df4973190428a14286aab0d14d3c1))
|
||||||
|
* make stack screens accessible on web without screens ([22b7c3f](https://github.com/react-navigation/react-navigation/commit/22b7c3f6c18a73fc55b0289b91b8d3a96f5be29c))
|
||||||
|
* move keyboardHandlingEnabled to screen options ([82900cc](https://github.com/react-navigation/react-navigation/commit/82900cceffa3e338b7b93e831f9ba6cbb3784815))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [6.0.0-next.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.14...@react-navigation/stack@6.0.0-next.15) (2021-05-10)
|
# [6.0.0-next.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.14...@react-navigation/stack@6.0.0-next.15) (2021-05-10)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.15",
|
"version": "6.0.0-next.16",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -40,13 +40,13 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^1.0.0-next.9",
|
"@react-navigation/elements": "^1.0.0-next.10",
|
||||||
"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.1.0"
|
"warn-once": "^0.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^6.0.0-next.7",
|
"@react-navigation/native": "^6.0.0-next.8",
|
||||||
"@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",
|
||||||
|
|||||||
@@ -292,18 +292,19 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|||||||
* Defaults to `false` for the last screen for modals, otherwise `true`.
|
* Defaults to `false` for the last screen for modals, otherwise `true`.
|
||||||
*/
|
*/
|
||||||
detachPreviousScreen?: boolean;
|
detachPreviousScreen?: boolean;
|
||||||
|
/**
|
||||||
|
* If `false`, the keyboard will NOT automatically dismiss when navigating to a new screen from this screen.
|
||||||
|
* Defaults to `true`.
|
||||||
|
*/
|
||||||
|
keyboardHandlingEnabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationConfig = {
|
export type StackNavigationConfig = {
|
||||||
/**
|
|
||||||
* If `false`, the keyboard will NOT automatically dismiss when navigating to a new screen.
|
|
||||||
* Defaults to `true`.
|
|
||||||
*/
|
|
||||||
keyboardHandlingEnabled?: boolean;
|
|
||||||
/**
|
/**
|
||||||
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
* Whether inactive screens should be detached from the view hierarchy to save memory.
|
||||||
* Make sure to call `enableScreens` from `react-native-screens` to make it work.
|
* This will have no effect if you disable `react-native-screens`.
|
||||||
* Defaults to `true` on Android, depends on the version of `react-native-screens` on iOS.
|
*
|
||||||
|
* Defaults to `true`.
|
||||||
*/
|
*/
|
||||||
detachInactiveScreens?: boolean;
|
detachInactiveScreens?: boolean;
|
||||||
};
|
};
|
||||||
@@ -335,7 +336,7 @@ export type StackCardInterpolationProps = {
|
|||||||
progress: Animated.AnimatedInterpolation;
|
progress: Animated.AnimatedInterpolation;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Values for the current screen the screen after this one in the stack.
|
* Values for the screen after this one in the stack.
|
||||||
* This can be `undefined` in case the screen animating is the last one.
|
* This can be `undefined` in case the screen animating is the last one.
|
||||||
*/
|
*/
|
||||||
next?: {
|
next?: {
|
||||||
@@ -414,7 +415,7 @@ export type StackHeaderInterpolationProps = {
|
|||||||
progress: Animated.AnimatedInterpolation;
|
progress: Animated.AnimatedInterpolation;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Values for the current screen the screen after this one in the stack.
|
* Values for the screen after this one in the stack.
|
||||||
* This can be `undefined` in case the screen animating is the last one.
|
* This can be `undefined` in case the screen animating is the last one.
|
||||||
*/
|
*/
|
||||||
next?: {
|
next?: {
|
||||||
|
|||||||
105
packages/stack/src/utils/useKeyboardManager.tsx
Normal file
105
packages/stack/src/utils/useKeyboardManager.tsx
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { TextInput, Keyboard, HostComponent } from 'react-native';
|
||||||
|
|
||||||
|
type InputRef = React.ElementRef<HostComponent<unknown>> | undefined;
|
||||||
|
|
||||||
|
export default function useKeyboardManager(isEnabled: () => boolean) {
|
||||||
|
// Numeric id of the previously focused text input
|
||||||
|
// When a gesture didn't change the tab, we can restore the focused input with this
|
||||||
|
const previouslyFocusedTextInputRef = React.useRef<InputRef>(undefined);
|
||||||
|
const startTimestampRef = React.useRef<number>(0);
|
||||||
|
const keyboardTimeoutRef = React.useRef<any>();
|
||||||
|
|
||||||
|
const clearKeyboardTimeout = React.useCallback(() => {
|
||||||
|
if (keyboardTimeoutRef.current !== undefined) {
|
||||||
|
clearTimeout(keyboardTimeoutRef.current);
|
||||||
|
keyboardTimeoutRef.current = undefined;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onPageChangeStart = React.useCallback(() => {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearKeyboardTimeout();
|
||||||
|
|
||||||
|
const input: InputRef = TextInput.State.currentlyFocusedInput();
|
||||||
|
|
||||||
|
// When a page change begins, blur the currently focused input
|
||||||
|
input?.blur();
|
||||||
|
|
||||||
|
// Store the id of this input so we can refocus it if change was cancelled
|
||||||
|
previouslyFocusedTextInputRef.current = input;
|
||||||
|
|
||||||
|
// Store timestamp for touch start
|
||||||
|
startTimestampRef.current = Date.now();
|
||||||
|
}, [clearKeyboardTimeout, isEnabled]);
|
||||||
|
|
||||||
|
const onPageChangeConfirm = React.useCallback(
|
||||||
|
(force: boolean) => {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearKeyboardTimeout();
|
||||||
|
|
||||||
|
if (force) {
|
||||||
|
// Always dismiss input, even if we don't have a ref to it
|
||||||
|
// We might not have the ref if onPageChangeStart was never called
|
||||||
|
// This can happen if page change was not from a gesture
|
||||||
|
Keyboard.dismiss();
|
||||||
|
} else {
|
||||||
|
const input = previouslyFocusedTextInputRef.current;
|
||||||
|
|
||||||
|
// Dismiss the keyboard only if an input was a focused before
|
||||||
|
// This makes sure we don't dismiss input on going back and focusing an input
|
||||||
|
input?.blur();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup the ID on successful page change
|
||||||
|
previouslyFocusedTextInputRef.current = undefined;
|
||||||
|
},
|
||||||
|
[clearKeyboardTimeout, isEnabled]
|
||||||
|
);
|
||||||
|
|
||||||
|
const onPageChangeCancel = React.useCallback(() => {
|
||||||
|
if (!isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearKeyboardTimeout();
|
||||||
|
|
||||||
|
// The page didn't change, we should restore the focus of text input
|
||||||
|
const input = previouslyFocusedTextInputRef.current;
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
// If the interaction was super short we should make sure keyboard won't hide again.
|
||||||
|
|
||||||
|
// Too fast input refocus will result only in keyboard flashing on screen and hiding right away.
|
||||||
|
// During first ~100ms keyboard will be dismissed no matter what,
|
||||||
|
// so we have to make sure it won't interrupt input refocus logic.
|
||||||
|
// That's why when the interaction is shorter than 100ms we add delay so it won't hide once again.
|
||||||
|
// Subtracting timestamps makes us sure the delay is executed only when needed.
|
||||||
|
if (Date.now() - startTimestampRef.current < 100) {
|
||||||
|
keyboardTimeoutRef.current = setTimeout(() => {
|
||||||
|
input?.focus();
|
||||||
|
previouslyFocusedTextInputRef.current = undefined;
|
||||||
|
}, 100);
|
||||||
|
} else {
|
||||||
|
input?.focus();
|
||||||
|
previouslyFocusedTextInputRef.current = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [clearKeyboardTimeout, isEnabled]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
return () => clearKeyboardTimeout();
|
||||||
|
}, [clearKeyboardTimeout]);
|
||||||
|
|
||||||
|
return {
|
||||||
|
onPageChangeStart,
|
||||||
|
onPageChangeConfirm,
|
||||||
|
onPageChangeCancel,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,113 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { TextInput, Keyboard, HostComponent } from 'react-native';
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
enabled: boolean;
|
|
||||||
children: (props: {
|
|
||||||
onPageChangeStart: () => void;
|
|
||||||
onPageChangeConfirm: (force: boolean) => void;
|
|
||||||
onPageChangeCancel: () => void;
|
|
||||||
}) => React.ReactNode;
|
|
||||||
};
|
|
||||||
|
|
||||||
type InputRef = React.ElementRef<HostComponent<unknown>> | undefined;
|
|
||||||
|
|
||||||
export default class KeyboardManager extends React.Component<Props> {
|
|
||||||
componentWillUnmount() {
|
|
||||||
this.clearKeyboardTimeout();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Numeric id of the previously focused text input
|
|
||||||
// When a gesture didn't change the tab, we can restore the focused input with this
|
|
||||||
private previouslyFocusedTextInput: InputRef = undefined;
|
|
||||||
private startTimestamp: number = 0;
|
|
||||||
private keyboardTimeout: any;
|
|
||||||
|
|
||||||
private clearKeyboardTimeout = () => {
|
|
||||||
if (this.keyboardTimeout !== undefined) {
|
|
||||||
clearTimeout(this.keyboardTimeout);
|
|
||||||
this.keyboardTimeout = undefined;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private handlePageChangeStart = () => {
|
|
||||||
if (!this.props.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
|
||||||
|
|
||||||
const input: InputRef = TextInput.State.currentlyFocusedInput();
|
|
||||||
|
|
||||||
// When a page change begins, blur the currently focused input
|
|
||||||
input?.blur();
|
|
||||||
|
|
||||||
// Store the id of this input so we can refocus it if change was cancelled
|
|
||||||
this.previouslyFocusedTextInput = input;
|
|
||||||
|
|
||||||
// Store timestamp for touch start
|
|
||||||
this.startTimestamp = Date.now();
|
|
||||||
};
|
|
||||||
|
|
||||||
private handlePageChangeConfirm = (force: boolean) => {
|
|
||||||
if (!this.props.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
|
||||||
|
|
||||||
if (force) {
|
|
||||||
// Always dismiss input, even if we don't have a ref to it
|
|
||||||
// We might not have the ref if onPageChangeStart was never called
|
|
||||||
// This can happen if page change was not from a gesture
|
|
||||||
Keyboard.dismiss();
|
|
||||||
} else {
|
|
||||||
const input = this.previouslyFocusedTextInput;
|
|
||||||
|
|
||||||
// Dismiss the keyboard only if an input was a focused before
|
|
||||||
// This makes sure we don't dismiss input on going back and focusing an input
|
|
||||||
input?.blur();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cleanup the ID on successful page change
|
|
||||||
this.previouslyFocusedTextInput = undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
private handlePageChangeCancel = () => {
|
|
||||||
if (!this.props.enabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
|
||||||
|
|
||||||
// The page didn't change, we should restore the focus of text input
|
|
||||||
const input = this.previouslyFocusedTextInput;
|
|
||||||
|
|
||||||
if (input) {
|
|
||||||
// If the interaction was super short we should make sure keyboard won't hide again.
|
|
||||||
|
|
||||||
// Too fast input refocus will result only in keyboard flashing on screen and hiding right away.
|
|
||||||
// During first ~100ms keyboard will be dismissed no matter what,
|
|
||||||
// so we have to make sure it won't interrupt input refocus logic.
|
|
||||||
// That's why when the interaction is shorter than 100ms we add delay so it won't hide once again.
|
|
||||||
// Subtracting timestamps makes us sure the delay is executed only when needed.
|
|
||||||
if (Date.now() - this.startTimestamp < 100) {
|
|
||||||
this.keyboardTimeout = setTimeout(() => {
|
|
||||||
input?.focus();
|
|
||||||
this.previouslyFocusedTextInput = undefined;
|
|
||||||
}, 100);
|
|
||||||
} else {
|
|
||||||
input?.focus();
|
|
||||||
this.previouslyFocusedTextInput = undefined;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
|
||||||
return this.props.children({
|
|
||||||
onPageChangeStart: this.handlePageChangeStart,
|
|
||||||
onPageChangeConfirm: this.handlePageChangeConfirm,
|
|
||||||
onPageChangeCancel: this.handlePageChangeCancel,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,6 +11,7 @@ import type { Props as HeaderContainerProps } from '../Header/HeaderContainer';
|
|||||||
import Card from './Card';
|
import Card from './Card';
|
||||||
import { forModalPresentationIOS } from '../../TransitionConfigs/CardStyleInterpolators';
|
import { forModalPresentationIOS } from '../../TransitionConfigs/CardStyleInterpolators';
|
||||||
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
import ModalPresentationContext from '../../utils/ModalPresentationContext';
|
||||||
|
import useKeyboardManager from '../../utils/useKeyboardManager';
|
||||||
import type { Layout, Scene } from '../../types';
|
import type { Layout, Scene } from '../../types';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -37,9 +38,6 @@ type Props = {
|
|||||||
closing: boolean
|
closing: boolean
|
||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
onPageChangeStart?: () => void;
|
|
||||||
onPageChangeConfirm?: (force: boolean) => void;
|
|
||||||
onPageChangeCancel?: () => void;
|
|
||||||
onGestureStart?: (props: { route: Route<string> }) => void;
|
onGestureStart?: (props: { route: Route<string> }) => void;
|
||||||
onGestureEnd?: (props: { route: Route<string> }) => void;
|
onGestureEnd?: (props: { route: Route<string> }) => void;
|
||||||
onGestureCancel?: (props: { route: Route<string> }) => void;
|
onGestureCancel?: (props: { route: Route<string> }) => void;
|
||||||
@@ -70,9 +68,6 @@ function CardContainer({
|
|||||||
layout,
|
layout,
|
||||||
onCloseRoute,
|
onCloseRoute,
|
||||||
onOpenRoute,
|
onOpenRoute,
|
||||||
onPageChangeCancel,
|
|
||||||
onPageChangeConfirm,
|
|
||||||
onPageChangeStart,
|
|
||||||
onGestureCancel,
|
onGestureCancel,
|
||||||
onGestureEnd,
|
onGestureEnd,
|
||||||
onGestureStart,
|
onGestureStart,
|
||||||
@@ -88,6 +83,20 @@ function CardContainer({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
||||||
|
|
||||||
|
const {
|
||||||
|
onPageChangeStart,
|
||||||
|
onPageChangeCancel,
|
||||||
|
onPageChangeConfirm,
|
||||||
|
} = useKeyboardManager(
|
||||||
|
React.useCallback(() => {
|
||||||
|
const { options, navigation } = scene.descriptor;
|
||||||
|
|
||||||
|
return (
|
||||||
|
navigation.isFocused() && options.keyboardHandlingEnabled !== false
|
||||||
|
);
|
||||||
|
}, [scene.descriptor])
|
||||||
|
);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
const { route } = scene.descriptor;
|
const { route } = scene.descriptor;
|
||||||
|
|
||||||
@@ -171,6 +180,8 @@ function CardContainer({
|
|||||||
|
|
||||||
const {
|
const {
|
||||||
presentation,
|
presentation,
|
||||||
|
detachPreviousScreen,
|
||||||
|
animationEnabled,
|
||||||
cardOverlay,
|
cardOverlay,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
@@ -241,6 +252,15 @@ function CardContainer({
|
|||||||
// This is necessary to avoid unfocused larger pages increasing scroll area
|
// This is necessary to avoid unfocused larger pages increasing scroll area
|
||||||
// The issue can be seen on the web when a smaller screen is pushed over a larger one
|
// The issue can be seen on the web when a smaller screen is pushed over a larger one
|
||||||
overflow: active ? undefined : 'hidden',
|
overflow: active ? undefined : 'hidden',
|
||||||
|
display:
|
||||||
|
// Hide unfocused screens when animation isn't enabled
|
||||||
|
// This is also necessary for a11y on web
|
||||||
|
animationEnabled === false &&
|
||||||
|
detachPreviousScreen !== false &&
|
||||||
|
presentation !== 'modal' &&
|
||||||
|
!focused
|
||||||
|
? 'none'
|
||||||
|
: 'flex',
|
||||||
},
|
},
|
||||||
StyleSheet.absoluteFill,
|
StyleSheet.absoluteFill,
|
||||||
]}
|
]}
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ type Props = {
|
|||||||
closing: boolean
|
closing: boolean
|
||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
onPageChangeStart?: () => void;
|
|
||||||
onPageChangeConfirm?: (force: boolean) => void;
|
|
||||||
onPageChangeCancel?: () => void;
|
|
||||||
onGestureStart?: (props: { route: Route<string> }) => void;
|
onGestureStart?: (props: { route: Route<string> }) => void;
|
||||||
onGestureEnd?: (props: { route: Route<string> }) => void;
|
onGestureEnd?: (props: { route: Route<string> }) => void;
|
||||||
onGestureCancel?: (props: { route: Route<string> }) => void;
|
onGestureCancel?: (props: { route: Route<string> }) => void;
|
||||||
@@ -231,10 +228,13 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
: DefaultTransition;
|
: DefaultTransition;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
animationEnabled = Platform.OS !== 'web' &&
|
animationEnabled = index !== 0 &&
|
||||||
|
Platform.OS !== 'web' &&
|
||||||
Platform.OS !== 'windows' &&
|
Platform.OS !== 'windows' &&
|
||||||
Platform.OS !== 'macos',
|
Platform.OS !== 'macos',
|
||||||
gestureEnabled = Platform.OS === 'ios' && animationEnabled,
|
gestureEnabled = index !== 0 &&
|
||||||
|
Platform.OS === 'ios' &&
|
||||||
|
animationEnabled,
|
||||||
gestureDirection = defaultTransitionPreset.gestureDirection,
|
gestureDirection = defaultTransitionPreset.gestureDirection,
|
||||||
transitionSpec = defaultTransitionPreset.transitionSpec,
|
transitionSpec = defaultTransitionPreset.transitionSpec,
|
||||||
cardStyleInterpolator = animationEnabled === false
|
cardStyleInterpolator = animationEnabled === false
|
||||||
@@ -430,9 +430,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
isParentHeaderShown,
|
isParentHeaderShown,
|
||||||
onTransitionStart,
|
onTransitionStart,
|
||||||
onTransitionEnd,
|
onTransitionEnd,
|
||||||
onPageChangeStart,
|
|
||||||
onPageChangeConfirm,
|
|
||||||
onPageChangeCancel,
|
|
||||||
onGestureStart,
|
onGestureStart,
|
||||||
onGestureEnd,
|
onGestureEnd,
|
||||||
onGestureCancel,
|
onGestureCancel,
|
||||||
@@ -603,9 +600,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
safeAreaInsetRight={safeAreaInsetRight}
|
safeAreaInsetRight={safeAreaInsetRight}
|
||||||
safeAreaInsetBottom={safeAreaInsetBottom}
|
safeAreaInsetBottom={safeAreaInsetBottom}
|
||||||
safeAreaInsetLeft={safeAreaInsetLeft}
|
safeAreaInsetLeft={safeAreaInsetLeft}
|
||||||
onPageChangeStart={onPageChangeStart}
|
|
||||||
onPageChangeConfirm={onPageChangeConfirm}
|
|
||||||
onPageChangeCancel={onPageChangeCancel}
|
|
||||||
onGestureStart={onGestureStart}
|
onGestureStart={onGestureStart}
|
||||||
onGestureCancel={onGestureCancel}
|
onGestureCancel={onGestureCancel}
|
||||||
onGestureEnd={onGestureEnd}
|
onGestureEnd={onGestureEnd}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import {
|
|||||||
|
|
||||||
import { GestureHandlerRootView } from '../GestureHandler';
|
import { GestureHandlerRootView } from '../GestureHandler';
|
||||||
import CardStack from './CardStack';
|
import CardStack from './CardStack';
|
||||||
import KeyboardManager from '../KeyboardManager';
|
|
||||||
import HeaderContainer, {
|
import HeaderContainer, {
|
||||||
Props as HeaderContainerProps,
|
Props as HeaderContainerProps,
|
||||||
} from '../Header/HeaderContainer';
|
} from '../Header/HeaderContainer';
|
||||||
@@ -417,7 +416,6 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
state,
|
state,
|
||||||
keyboardHandlingEnabled,
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
descriptors: _,
|
descriptors: _,
|
||||||
...rest
|
...rest
|
||||||
@@ -435,35 +433,30 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
<SafeAreaProviderCompat>
|
<SafeAreaProviderCompat>
|
||||||
<SafeAreaInsetsContext.Consumer>
|
<SafeAreaInsetsContext.Consumer>
|
||||||
{(insets) => (
|
{(insets) => (
|
||||||
<KeyboardManager enabled={keyboardHandlingEnabled !== false}>
|
<HeaderShownContext.Consumer>
|
||||||
{(props) => (
|
{(isParentHeaderShown) => (
|
||||||
<HeaderShownContext.Consumer>
|
<CardStack
|
||||||
{(isParentHeaderShown) => (
|
insets={insets as EdgeInsets}
|
||||||
<CardStack
|
isParentHeaderShown={isParentHeaderShown}
|
||||||
insets={insets as EdgeInsets}
|
getPreviousRoute={this.getPreviousRoute}
|
||||||
isParentHeaderShown={isParentHeaderShown}
|
routes={routes}
|
||||||
getPreviousRoute={this.getPreviousRoute}
|
openingRouteKeys={openingRouteKeys}
|
||||||
routes={routes}
|
closingRouteKeys={closingRouteKeys}
|
||||||
openingRouteKeys={openingRouteKeys}
|
onOpenRoute={this.handleOpenRoute}
|
||||||
closingRouteKeys={closingRouteKeys}
|
onCloseRoute={this.handleCloseRoute}
|
||||||
onOpenRoute={this.handleOpenRoute}
|
onTransitionStart={this.handleTransitionStart}
|
||||||
onCloseRoute={this.handleCloseRoute}
|
onTransitionEnd={this.handleTransitionEnd}
|
||||||
onTransitionStart={this.handleTransitionStart}
|
renderHeader={this.renderHeader}
|
||||||
onTransitionEnd={this.handleTransitionEnd}
|
renderScene={this.renderScene}
|
||||||
renderHeader={this.renderHeader}
|
state={state}
|
||||||
renderScene={this.renderScene}
|
descriptors={descriptors}
|
||||||
state={state}
|
onGestureStart={this.handleGestureStart}
|
||||||
descriptors={descriptors}
|
onGestureEnd={this.handleGestureEnd}
|
||||||
onGestureStart={this.handleGestureStart}
|
onGestureCancel={this.handleGestureCancel}
|
||||||
onGestureEnd={this.handleGestureEnd}
|
{...rest}
|
||||||
onGestureCancel={this.handleGestureCancel}
|
/>
|
||||||
{...rest}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</HeaderShownContext.Consumer>
|
|
||||||
)}
|
)}
|
||||||
</KeyboardManager>
|
</HeaderShownContext.Consumer>
|
||||||
)}
|
)}
|
||||||
</SafeAreaInsetsContext.Consumer>
|
</SafeAreaInsetsContext.Consumer>
|
||||||
</SafeAreaProviderCompat>
|
</SafeAreaProviderCompat>
|
||||||
|
|||||||
22
yarn.lock
22
yarn.lock
@@ -3717,6 +3717,13 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256"
|
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.1.tgz#283f669ff76d7b8260df8ab7a4262cc83d988256"
|
||||||
integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==
|
integrity sha512-fZQQafSREFyuZcdWFAExYjBiCL7AUCdgsk80iO0q4yihYYdcIiH28CcuPTGFgLOCC8RlW49GSQxdHwZP+I7CNg==
|
||||||
|
|
||||||
|
"@types/mock-require@^2.0.0":
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/mock-require/-/mock-require-2.0.0.tgz#57a4f0db0b4b6274f610a2d2c20beb3c842181e1"
|
||||||
|
integrity sha512-nOgjoE5bBiDeiA+z41i95makyHUSMWQMOPocP+J67Pqx/68HAXaeWN1NFtrAYYV6LrISIZZ8vKHm/a50k0f6Sg==
|
||||||
|
dependencies:
|
||||||
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/node-fetch@^2.5.9":
|
"@types/node-fetch@^2.5.9":
|
||||||
version "2.5.9"
|
version "2.5.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.9.tgz#c04a12115aa436f189e39579272b305e477621b4"
|
resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.9.tgz#c04a12115aa436f189e39579272b305e477621b4"
|
||||||
@@ -9069,6 +9076,11 @@ gensync@^1.0.0-beta.1, gensync@^1.0.0-beta.2:
|
|||||||
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
|
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
|
||||||
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
|
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
|
||||||
|
|
||||||
|
get-caller-file@^1.0.2:
|
||||||
|
version "1.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a"
|
||||||
|
integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==
|
||||||
|
|
||||||
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
|
get-caller-file@^2.0.1, get-caller-file@^2.0.5:
|
||||||
version "2.0.5"
|
version "2.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e"
|
||||||
@@ -12847,6 +12859,14 @@ mock-require-assets@^0.0.1:
|
|||||||
resolved "https://registry.yarnpkg.com/mock-require-assets/-/mock-require-assets-0.0.1.tgz#94136f70e5b009c52c2df3b45724d15ab4f0cb98"
|
resolved "https://registry.yarnpkg.com/mock-require-assets/-/mock-require-assets-0.0.1.tgz#94136f70e5b009c52c2df3b45724d15ab4f0cb98"
|
||||||
integrity sha1-lBNvcOWwCcUsLfO0VyTRWrTwy5g=
|
integrity sha1-lBNvcOWwCcUsLfO0VyTRWrTwy5g=
|
||||||
|
|
||||||
|
mock-require@^3.0.3:
|
||||||
|
version "3.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/mock-require/-/mock-require-3.0.3.tgz#ccd544d9eae81dd576b3f219f69ec867318a1946"
|
||||||
|
integrity sha512-lLzfLHcyc10MKQnNUCv7dMcoY/2Qxd6wJfbqCcVk3LDb8An4hF6ohk5AztrvgKhJCqj36uyzi/p5se+tvyD+Wg==
|
||||||
|
dependencies:
|
||||||
|
get-caller-file "^1.0.2"
|
||||||
|
normalize-path "^2.1.1"
|
||||||
|
|
||||||
mockdate@^3.0.2:
|
mockdate@^3.0.2:
|
||||||
version "3.0.5"
|
version "3.0.5"
|
||||||
resolved "https://registry.yarnpkg.com/mockdate/-/mockdate-3.0.5.tgz#789be686deb3149e7df2b663d2bc4392bc3284fb"
|
resolved "https://registry.yarnpkg.com/mockdate/-/mockdate-3.0.5.tgz#789be686deb3149e7df2b663d2bc4392bc3284fb"
|
||||||
@@ -15280,7 +15300,7 @@ react-native-web@~0.15.0:
|
|||||||
prop-types "^15.6.0"
|
prop-types "^15.6.0"
|
||||||
react-timer-mixin "^0.13.4"
|
react-timer-mixin "^0.13.4"
|
||||||
|
|
||||||
"react-native@https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz", react-native@~0.63.2, react-native@~0.63.4:
|
"react-native@https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz", react-native@~0.63.4:
|
||||||
version "0.63.4"
|
version "0.63.4"
|
||||||
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.63.4.tgz#2210fdd404c94a5fa6b423c6de86f8e48810ec36"
|
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.63.4.tgz#2210fdd404c94a5fa6b423c6de86f8e48810ec36"
|
||||||
integrity sha512-I4kM8kYO2mWEYUFITMcpRulcy4/jd+j9T6PbIzR0FuMcz/xwd+JwHoLPa1HmCesvR1RDOw9o4D+OFLwuXXfmGw==
|
integrity sha512-I4kM8kYO2mWEYUFITMcpRulcy4/jd+j9T6PbIzR0FuMcz/xwd+JwHoLPa1HmCesvR1RDOw9o4D+OFLwuXXfmGw==
|
||||||
|
|||||||
Reference in New Issue
Block a user