mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-14 22:37:48 +08:00
Compare commits
28 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5473982859 | ||
|
|
de805a3ebf | ||
|
|
cbaabc1288 | ||
|
|
dd48fe9b15 | ||
|
|
48851c9ebd | ||
|
|
197c916a23 | ||
|
|
31caaf3071 | ||
|
|
5bcce9926a | ||
|
|
aacc1b525d | ||
|
|
3ad2bcbaf8 | ||
|
|
faee245d2e | ||
|
|
e1ab06d3d7 | ||
|
|
a204edd012 | ||
|
|
78b00bd814 | ||
|
|
923722cbb0 | ||
|
|
2c1adc9043 | ||
|
|
40439ccb42 | ||
|
|
24b3f739da | ||
|
|
2c8401d5cb | ||
|
|
6cc463f20d | ||
|
|
e6c6cc8331 | ||
|
|
8a6511c491 | ||
|
|
bfd6eb79c3 | ||
|
|
ebcd077626 | ||
|
|
5d0c7ea6d4 | ||
|
|
038eb87c42 | ||
|
|
72f90b50d2 | ||
|
|
0fce8eb2a1 |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -50,7 +50,7 @@
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"babel-preset-expo": "8.3.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"expo-cli": "^4.2.1",
|
||||
"expo-cli": "^4.3.0",
|
||||
"jest": "^26.6.3",
|
||||
"jest-dev-server": "^4.4.0",
|
||||
"mock-require-assets": "^0.0.1",
|
||||
|
||||
159
example/src/Screens/MixedHeaderMode.tsx
Normal file
159
example/src/Screens/MixedHeaderMode.tsx
Normal file
@@ -0,0 +1,159 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet, ScrollView } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
TransitionPresets,
|
||||
HeaderStyleInterpolators,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import Albums from '../Shared/Albums';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
export type SimpleStackParams = {
|
||||
Article: { author: string } | undefined;
|
||||
NewsFeed: { date: number };
|
||||
Albums: undefined;
|
||||
};
|
||||
|
||||
const scrollEnabled = Platform.select({ web: true, default: false });
|
||||
|
||||
const ArticleScreen = ({
|
||||
navigation,
|
||||
route,
|
||||
}: StackScreenProps<SimpleStackParams, 'Article'>) => {
|
||||
return (
|
||||
<ScrollView>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('NewsFeed', { date: Date.now() })}
|
||||
style={styles.button}
|
||||
>
|
||||
Push feed
|
||||
</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => navigation.pop()}
|
||||
style={styles.button}
|
||||
>
|
||||
Pop screen
|
||||
</Button>
|
||||
</View>
|
||||
<Article
|
||||
author={{ name: route.params?.author ?? 'Unknown' }}
|
||||
scrollEnabled={scrollEnabled}
|
||||
/>
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
const NewsFeedScreen = ({
|
||||
route,
|
||||
navigation,
|
||||
}: StackScreenProps<SimpleStackParams, 'NewsFeed'>) => {
|
||||
return (
|
||||
<ScrollView>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('Albums')}
|
||||
style={styles.button}
|
||||
>
|
||||
Navigate to album
|
||||
</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => navigation.pop()}
|
||||
style={styles.button}
|
||||
>
|
||||
Pop screen
|
||||
</Button>
|
||||
</View>
|
||||
<NewsFeed scrollEnabled={scrollEnabled} date={route.params.date} />
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
const AlbumsScreen = ({
|
||||
navigation,
|
||||
}: StackScreenProps<SimpleStackParams, 'Albums'>) => {
|
||||
return (
|
||||
<ScrollView>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
mode="contained"
|
||||
onPress={() => navigation.push('Article', { author: 'Babel fish' })}
|
||||
style={styles.button}
|
||||
>
|
||||
Push article
|
||||
</Button>
|
||||
<Button
|
||||
mode="outlined"
|
||||
onPress={() => navigation.pop()}
|
||||
style={styles.button}
|
||||
>
|
||||
Pop screen
|
||||
</Button>
|
||||
</View>
|
||||
<Albums scrollEnabled={scrollEnabled} />
|
||||
</ScrollView>
|
||||
);
|
||||
};
|
||||
|
||||
const SimpleStack = createStackNavigator<SimpleStackParams>();
|
||||
|
||||
export default function SimpleStackScreen({
|
||||
navigation,
|
||||
}: StackScreenProps<ParamListBase>) {
|
||||
React.useLayoutEffect(() => {
|
||||
navigation.setOptions({
|
||||
headerShown: false,
|
||||
});
|
||||
}, [navigation]);
|
||||
|
||||
return (
|
||||
<SimpleStack.Navigator
|
||||
screenOptions={{
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
headerMode: 'float',
|
||||
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
|
||||
}}
|
||||
>
|
||||
<SimpleStack.Screen
|
||||
name="Article"
|
||||
component={ArticleScreen}
|
||||
options={({ route }) => ({
|
||||
title: `Article by ${route.params?.author ?? 'Unknown'}`,
|
||||
})}
|
||||
initialParams={{ author: 'Gandalf' }}
|
||||
/>
|
||||
<SimpleStack.Screen
|
||||
name="NewsFeed"
|
||||
component={NewsFeedScreen}
|
||||
options={{ title: 'Feed' }}
|
||||
/>
|
||||
<SimpleStack.Screen
|
||||
name="Albums"
|
||||
component={AlbumsScreen}
|
||||
options={{
|
||||
...TransitionPresets.ModalSlideFromBottomIOS,
|
||||
headerMode: 'screen',
|
||||
title: 'Albums',
|
||||
}}
|
||||
/>
|
||||
</SimpleStack.Navigator>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
buttons: {
|
||||
flexDirection: 'row',
|
||||
padding: 8,
|
||||
},
|
||||
button: {
|
||||
margin: 8,
|
||||
},
|
||||
});
|
||||
@@ -86,8 +86,7 @@ const AlbumsScreen = ({ navigation }: StackScreenProps<SimpleStackParams>) => {
|
||||
|
||||
const SimpleStack = createStackNavigator<SimpleStackParams>();
|
||||
|
||||
type Props = Partial<React.ComponentProps<typeof SimpleStack.Navigator>> &
|
||||
StackScreenProps<ParamListBase>;
|
||||
type Props = StackScreenProps<ParamListBase>;
|
||||
|
||||
function CustomHeader(props: StackHeaderProps) {
|
||||
const { current, next } = props.progress;
|
||||
@@ -108,7 +107,7 @@ function CustomHeader(props: StackHeaderProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export default function SimpleStackScreen({ navigation, ...rest }: Props) {
|
||||
export default function HeaderCustomizationScreen({ navigation }: Props) {
|
||||
React.useLayoutEffect(() => {
|
||||
navigation.setOptions({
|
||||
headerShown: false,
|
||||
@@ -119,13 +118,13 @@ export default function SimpleStackScreen({ navigation, ...rest }: Props) {
|
||||
const [headerTitleCentered, setHeaderTitleCentered] = React.useState(true);
|
||||
|
||||
return (
|
||||
<SimpleStack.Navigator {...rest}>
|
||||
<SimpleStack.Navigator screenOptions={{ headerMode: 'float' }}>
|
||||
<SimpleStack.Screen
|
||||
name="Article"
|
||||
component={ArticleScreen}
|
||||
options={({ route }) => ({
|
||||
title: `Article by ${route.params?.author}`,
|
||||
header: CustomHeader,
|
||||
header: (props) => <CustomHeader {...props} />,
|
||||
headerTintColor: '#fff',
|
||||
headerStyle: { backgroundColor: '#ff005d' },
|
||||
headerBackTitleVisible: false,
|
||||
|
||||
@@ -42,6 +42,7 @@ import LinkingPrefixes from './LinkingPrefixes';
|
||||
import SettingsItem from './Shared/SettingsItem';
|
||||
import SimpleStack from './Screens/SimpleStack';
|
||||
import ModalStack from './Screens/ModalStack';
|
||||
import MixedHeaderMode from './Screens/MixedHeaderMode';
|
||||
import StackTransparent from './Screens/StackTransparent';
|
||||
import StackHeaderCustomization from './Screens/StackHeaderCustomization';
|
||||
import BottomTabs from './Screens/BottomTabs';
|
||||
@@ -70,6 +71,10 @@ const SCREENS = {
|
||||
title: 'Modal Stack',
|
||||
component: ModalStack,
|
||||
},
|
||||
MixedHeaderMode: {
|
||||
title: 'Float + Screen Header Stack',
|
||||
component: MixedHeaderMode,
|
||||
},
|
||||
StackTransparent: {
|
||||
title: 'Transparent Stack',
|
||||
component: StackTransparent,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"version": "independent",
|
||||
"command": {
|
||||
"publish": {
|
||||
"allowBranch": "6.x",
|
||||
"allowBranch": "main",
|
||||
"conventionalCommits": true,
|
||||
"createRelease": "github",
|
||||
"message": "chore: publish",
|
||||
|
||||
@@ -3,6 +3,80 @@
|
||||
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/bottom-tabs@6.0.0-next.2...@react-navigation/bottom-tabs@6.0.0-next.3) (2021-03-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use tab role on Android for accessibility ([de805a3](https://github.com/react-navigation/react-navigation/commit/de805a3ebf35db81cb7b7bcbf5cfd4a03e69c567))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a Background component ([cbaabc1](https://github.com/react-navigation/react-navigation/commit/cbaabc1288e780698e499a00b9ca06ab9746a0da))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
* drop usage of Dimensions in favor of metrics from safe-area-context ([12b893d](https://github.com/react-navigation/react-navigation/commit/12b893d7ca8cdb726b973972797658ac9c7d17d7))
|
||||
* enable detachInactiveScreens by default on web for better a11y ([4954d6a](https://github.com/react-navigation/react-navigation/commit/4954d6aae3cdbb5855d44ff17d80d16b81fb224e))
|
||||
* fix drawer and bottom tabs not being visible on web. closes [#9225](https://github.com/react-navigation/react-navigation/issues/9225) ([b735de1](https://github.com/react-navigation/react-navigation/commit/b735de153ca650240625dba6d8b5c8d16b913bac))
|
||||
* fix drawer screen content not being interactable on Android ([865d8b3](https://github.com/react-navigation/react-navigation/commit/865d8b3e51e117a01243966c160b7cd147d236ac))
|
||||
* fix initial metrics on server ([69d333f](https://github.com/react-navigation/react-navigation/commit/69d333f6c23e0c37eaf4d3f8b413e8f96d6827f8))
|
||||
* fix pointerEvents in ResourceSavingScene ([af53dd6](https://github.com/react-navigation/react-navigation/commit/af53dd6548630124f831446e0eee468da5d9bf5e)), closes [#9241](https://github.com/react-navigation/react-navigation/issues/9241) [#9242](https://github.com/react-navigation/react-navigation/issues/9242)
|
||||
* show a missing icon symbol instead of empty area in bottom tab bar ([2bc4882](https://github.com/react-navigation/react-navigation/commit/2bc4882692be9f02d781639892e1f98b891811c4))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* don't use deprecated APIs from react-native-safe-area-context ([ddf27bf](https://github.com/react-navigation/react-navigation/commit/ddf27bf41a2efc5d1573aad0f8fe6c27a98c32b3))
|
||||
* drop support for tabBarVisible option ([a97a43a](https://github.com/react-navigation/react-navigation/commit/a97a43aa1d2a615074ade93f1addebcee1dbfb65))
|
||||
* move `tabBarOptions` to `options` for bottom tabs ([f7ff1ad](https://github.com/react-navigation/react-navigation/commit/f7ff1adee7654b2d624dee4ae8844be217f23026))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* initial implementation of @react-navigation/elements ([07ba7a9](https://github.com/react-navigation/react-navigation/commit/07ba7a96870efdb8acf99eb82ba0b1d3eac90bab))
|
||||
* move lazy to options for bottom-tabs and drawer ([068a9a4](https://github.com/react-navigation/react-navigation/commit/068a9a456c31a08104097f2a8434c66c30a5be99))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* The lazy prop now can be configured per screen instead of for the whole navigator. To keep previous behavior, you can specify it in screenOptions
|
||||
* This commit moves options from `tabBarOptions` to regular `options` in order to reduce confusion between the two, as well as to make it more flexible to configure the tab bar based on a per screen basis.
|
||||
* We now require newer versions of safe area context library.
|
||||
* We need to add support for specifying style for tab bar in options to support the use cases which need this.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.11.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.0...@react-navigation/bottom-tabs@5.11.1) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
@@ -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/bottom-tab-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/bottom-tab-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/bottom-tabs",
|
||||
"description": "Bottom tab navigator following iOS design guidelines",
|
||||
"version": "5.11.1",
|
||||
"version": "6.0.0-next.3",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -37,12 +37,12 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/elements": "^1.0.0",
|
||||
"@react-navigation/elements": "^1.0.0-next.3",
|
||||
"color": "^3.1.3",
|
||||
"warn-once": "^0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-safe-area-context": ">= 3.0.0",
|
||||
|
||||
@@ -285,7 +285,11 @@ export default function BottomTabBar({
|
||||
]}
|
||||
pointerEvents={isTabBarHidden ? 'none' : 'auto'}
|
||||
>
|
||||
<View style={styles.content} onLayout={handleLayout}>
|
||||
<View
|
||||
accessibilityRole="tablist"
|
||||
style={styles.content}
|
||||
onLayout={handleLayout}
|
||||
>
|
||||
{routes.map((route, index) => {
|
||||
const focused = index === state.index;
|
||||
const { options } = descriptors[route.key];
|
||||
@@ -322,7 +326,7 @@ export default function BottomTabBar({
|
||||
const accessibilityLabel =
|
||||
options.tabBarAccessibilityLabel !== undefined
|
||||
? options.tabBarAccessibilityLabel
|
||||
: typeof label === 'string'
|
||||
: typeof label === 'string' && Platform.OS === 'ios'
|
||||
? `${label}, tab, ${index + 1} of ${routes.length}`
|
||||
: undefined;
|
||||
|
||||
|
||||
@@ -263,7 +263,8 @@ export default function BottomTabBarItem({
|
||||
onLongPress,
|
||||
testID,
|
||||
accessibilityLabel,
|
||||
accessibilityRole: 'button',
|
||||
// FIXME: accessibilityRole: 'tab' doesn't seem to work as expected on iOS
|
||||
accessibilityRole: Platform.select({ ios: 'button', default: 'tab' }),
|
||||
accessibilityState: { selected: focused },
|
||||
// @ts-expect-error: keep for compatibility with older React Native versions
|
||||
accessibilityStates: focused ? ['selected'] : [],
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import { ScreenContainer } from 'react-native-screens';
|
||||
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
||||
import {
|
||||
NavigationHelpersContext,
|
||||
ParamListBase,
|
||||
TabNavigationState,
|
||||
useTheme,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
Header,
|
||||
@@ -34,28 +33,6 @@ type Props = BottomTabNavigationConfig & {
|
||||
descriptors: BottomTabDescriptorMap;
|
||||
};
|
||||
|
||||
function SceneContent({
|
||||
isFocused,
|
||||
children,
|
||||
style,
|
||||
}: {
|
||||
isFocused: boolean;
|
||||
children: React.ReactNode;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
return (
|
||||
<View
|
||||
accessibilityElementsHidden={!isFocused}
|
||||
importantForAccessibility={isFocused ? 'auto' : 'no-hide-descendants'}
|
||||
style={[styles.content, { backgroundColor: colors.background }, style]}
|
||||
>
|
||||
{children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default function BottomTabView(props: Props) {
|
||||
const {
|
||||
tabBar = (props: BottomTabBarProps) => <BottomTabBar {...props} />,
|
||||
@@ -150,26 +127,26 @@ export default function BottomTabView(props: Props) {
|
||||
visible={isFocused}
|
||||
enabled={detachInactiveScreens}
|
||||
>
|
||||
<SceneContent isFocused={isFocused} style={sceneContainerStyle}>
|
||||
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
|
||||
<Screen
|
||||
route={descriptor.route}
|
||||
navigation={descriptor.navigation}
|
||||
headerShown={descriptor.options.headerShown}
|
||||
headerStatusBarHeight={
|
||||
descriptor.options.headerStatusBarHeight
|
||||
}
|
||||
header={header({
|
||||
layout: dimensions,
|
||||
route: descriptor.route,
|
||||
navigation: descriptor.navigation as BottomTabNavigationProp<ParamListBase>,
|
||||
options: descriptor.options,
|
||||
})}
|
||||
>
|
||||
{descriptor.render()}
|
||||
</Screen>
|
||||
</BottomTabBarHeightContext.Provider>
|
||||
</SceneContent>
|
||||
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
|
||||
<Screen
|
||||
focused={isFocused}
|
||||
route={descriptor.route}
|
||||
navigation={descriptor.navigation}
|
||||
headerShown={descriptor.options.headerShown}
|
||||
headerStatusBarHeight={
|
||||
descriptor.options.headerStatusBarHeight
|
||||
}
|
||||
header={header({
|
||||
layout: dimensions,
|
||||
route: descriptor.route,
|
||||
navigation: descriptor.navigation as BottomTabNavigationProp<ParamListBase>,
|
||||
options: descriptor.options,
|
||||
})}
|
||||
style={sceneContainerStyle}
|
||||
>
|
||||
{descriptor.render()}
|
||||
</Screen>
|
||||
</BottomTabBarHeightContext.Provider>
|
||||
</ScreenFallback>
|
||||
);
|
||||
})}
|
||||
@@ -187,7 +164,4 @@ const styles = StyleSheet.create({
|
||||
flex: 1,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
content: {
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
// @ts-ignore
|
||||
shouldUseActivityState,
|
||||
} from 'react-native-screens';
|
||||
import { ResourceSavingScene } from '@react-navigation/elements';
|
||||
import { ResourceSavingView } from '@react-navigation/elements';
|
||||
|
||||
type Props = {
|
||||
visible: boolean;
|
||||
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<ResourceSavingScene visible={visible} {...rest}>
|
||||
<ResourceSavingView visible={visible} {...rest}>
|
||||
{children}
|
||||
</ResourceSavingScene>
|
||||
</ResourceSavingView>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,63 @@
|
||||
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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
* check duplicate names only for immediate nested screens ([36a9b4f](https://github.com/react-navigation/react-navigation/commit/36a9b4f866c49d6f7350405c54b86bd77e374eb5))
|
||||
* don't merge params on navigation ([366d018](https://github.com/react-navigation/react-navigation/commit/366d0181dc02597b8d11e343f37fc77bee164c70))
|
||||
* drop dangerously prefix from getState and getParent ([227f133](https://github.com/react-navigation/react-navigation/commit/227f133536af85dc5ff85eeb269b76ed80cd3f05))
|
||||
* drop support for legacy linking config ([0e13e8d](https://github.com/react-navigation/react-navigation/commit/0e13e8d23cc2ea74f3b0fce9334ee5c8be2484f4))
|
||||
* fix default screen options not being respected ([03ba1f2](https://github.com/react-navigation/react-navigation/commit/03ba1f2930cb731266e6bc3044c67fb267837ed1))
|
||||
* fix incorrect state change events in independent nested container ([b82a912](https://github.com/react-navigation/react-navigation/commit/b82a9126bb91a84e21473723ce40da0cce732a39)), closes [#9080](https://github.com/react-navigation/react-navigation/issues/9080)
|
||||
* print an error when passing a second argument to useFocusEffect ([c361795](https://github.com/react-navigation/react-navigation/commit/c361795d97eb20150913ddc3fbf139e095d25830))
|
||||
* remove the state property from route prop ([ebab518](https://github.com/react-navigation/react-navigation/commit/ebab5183522f5ae03f50f88289c0e7acc208dc02))
|
||||
* show redbox instead of crash if navigation isn't initialized ([13d8553](https://github.com/react-navigation/react-navigation/commit/13d85530ae684eb956d3c4df25919572caf0ec1a))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a way to specify an unique ID for screens ([15b8bb3](https://github.com/react-navigation/react-navigation/commit/15b8bb34584db3cb166f6aafd45f0b95f14fde62))
|
||||
* add an option to specify default options for the navigator ([c85f2ff](https://github.com/react-navigation/react-navigation/commit/c85f2ff47a2b3d403a3cbe993b46d04914358ba5))
|
||||
* allow returning null or undefined to skip actions with dispatch ([d6466b7](https://github.com/react-navigation/react-navigation/commit/d6466b7a4b5d3087981dbd50a5f5f56a6092edb3))
|
||||
* associate path with the route it opens when deep linking ([#9384](https://github.com/react-navigation/react-navigation/issues/9384)) ([86e64fd](https://github.com/react-navigation/react-navigation/commit/86e64fdcd81a57cf3f3bdab4c9035b52984e7009)), closes [#9102](https://github.com/react-navigation/react-navigation/issues/9102)
|
||||
* warn on duplicate screen names across navigators ([02a031e](https://github.com/react-navigation/react-navigation/commit/02a031e46eac432fc3e26c5de30c7bdf0a81ce49))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* This commit drops support for legacy linking config which allowed screens to be specified without the screens property in the config.
|
||||
* Previous versions of React Navigation merged params on navigation which caused confusion. This commit changes params not to be merged.
|
||||
|
||||
The old behaviour can still be achieved by passing `merge: true` explicitly:
|
||||
|
||||
```js
|
||||
CommonActions.navigate({
|
||||
name: 'bar',
|
||||
params: { fruit: 'orange' },
|
||||
merge: true,
|
||||
})
|
||||
```
|
||||
`initialParams` specified for the screen are always merged.
|
||||
* any code which relies on `route.state` will break.
|
||||
|
||||
Previous versions printed a warning on accessing `route.state`. This commit removes the property entirely. Accessing this property isn't safe since child navigator state isn't gurranteed to be in sync with parent navigator state and cause subtle bugs in apps.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.14.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.14.2...@react-navigation/core@5.14.3) (2020-11-10)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/core",
|
||||
"description": "Core utilities for building navigators",
|
||||
"version": "5.14.3",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
@@ -36,7 +36,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^5.6.2",
|
||||
"@react-navigation/routers": "^6.0.0-next.1",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"nanoid": "^3.1.20",
|
||||
"query-string": "^6.14.1",
|
||||
|
||||
@@ -3,6 +3,22 @@
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.1.17](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.16...@react-navigation/devtools@5.1.17) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/devtools
|
||||
|
||||
@@ -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/devtools).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/devtools).
|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/devtools",
|
||||
"description": "Developer tools for React Navigation",
|
||||
"version": "5.1.17",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
@@ -37,7 +37,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/core": "^5.14.3",
|
||||
"@react-navigation/core": "^6.0.0-next.1",
|
||||
"deep-equal": "^2.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -3,6 +3,89 @@
|
||||
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/drawer@6.0.0-next.2...@react-navigation/drawer@6.0.0-next.3) (2021-03-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a Background component ([cbaabc1](https://github.com/react-navigation/react-navigation/commit/cbaabc1288e780698e499a00b9ca06ab9746a0da))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
* drop usage of Dimensions in favor of metrics from safe-area-context ([12b893d](https://github.com/react-navigation/react-navigation/commit/12b893d7ca8cdb726b973972797658ac9c7d17d7))
|
||||
* enable detachInactiveScreens by default on web for better a11y ([4954d6a](https://github.com/react-navigation/react-navigation/commit/4954d6aae3cdbb5855d44ff17d80d16b81fb224e))
|
||||
* fix drawer and bottom tabs not being visible on web. closes [#9225](https://github.com/react-navigation/react-navigation/issues/9225) ([b735de1](https://github.com/react-navigation/react-navigation/commit/b735de153ca650240625dba6d8b5c8d16b913bac))
|
||||
* fix drawer screen content not being interactable on Android ([865d8b3](https://github.com/react-navigation/react-navigation/commit/865d8b3e51e117a01243966c160b7cd147d236ac))
|
||||
* fix initial metrics on server ([69d333f](https://github.com/react-navigation/react-navigation/commit/69d333f6c23e0c37eaf4d3f8b413e8f96d6827f8))
|
||||
* fix pointerEvents in ResourceSavingScene ([af53dd6](https://github.com/react-navigation/react-navigation/commit/af53dd6548630124f831446e0eee468da5d9bf5e)), closes [#9241](https://github.com/react-navigation/react-navigation/issues/9241) [#9242](https://github.com/react-navigation/react-navigation/issues/9242)
|
||||
* fix typo for default prop in drawer ([b376e9c](https://github.com/react-navigation/react-navigation/commit/b376e9c5ed7097cea25c957d1de75f84cc9ea9f0))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* don't use a boolean for drawer status ([cda6397](https://github.com/react-navigation/react-navigation/commit/cda6397b8989c552824eca4175577527c9d72f93))
|
||||
* don't use absolute position for header ([79a85a4](https://github.com/react-navigation/react-navigation/commit/79a85a431ce0859ae35a13858b23c3919795e560))
|
||||
* don't use deprecated APIs from react-native-safe-area-context ([ddf27bf](https://github.com/react-navigation/react-navigation/commit/ddf27bf41a2efc5d1573aad0f8fe6c27a98c32b3))
|
||||
* drop drawerOpen and drawerClose events ([5648e1a](https://github.com/react-navigation/react-navigation/commit/5648e1a7b355068d105a2da79861d0add4717ff4))
|
||||
* move drawerContentOptions to options ([15e5678](https://github.com/react-navigation/react-navigation/commit/15e5678037bc6656d891724b4262cb542d6aad0d))
|
||||
* simplify props for stack and drawer headers ([4cad132](https://github.com/react-navigation/react-navigation/commit/4cad132c2c3daa6370a6916977f1f1db0036d4e4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add pressColor and pressOpacity props to drawerItem ([#8834](https://github.com/react-navigation/react-navigation/issues/8834)) ([52dbe4b](https://github.com/react-navigation/react-navigation/commit/52dbe4bd6663430745b07ea379d44d4d4f2944a0))
|
||||
* initial implementation of @react-navigation/elements ([07ba7a9](https://github.com/react-navigation/react-navigation/commit/07ba7a96870efdb8acf99eb82ba0b1d3eac90bab))
|
||||
* move lazy to options for bottom-tabs and drawer ([068a9a4](https://github.com/react-navigation/react-navigation/commit/068a9a456c31a08104097f2a8434c66c30a5be99))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drawer status is now a union ('open', 'closed') instead of a boolean. This will let us implement more types of status in future.
|
||||
|
||||
Following this the following exports have been renamed as well:
|
||||
- getIsDrawerOpenFromState -> getDrawerStatusFromState
|
||||
- useIsDrawerOpen -> useDrawerStatus
|
||||
* We now use flexbox for header elements which could break some existing style code which relied on absolute positioning.
|
||||
* The lazy prop now can be configured per screen instead of for the whole navigator. To keep previous behavior, you can specify it in screenOptions
|
||||
* This commit moves options from `drawerContentOptions` to regular `options` in order to reduce confusion between the two, as well as to make it more flexible to configure the drawer on a per screen basis.
|
||||
* We now require newer versions of safe area context library.
|
||||
* drawer's status can be queried through the isDrawerOpen hook. no need for the events
|
||||
* Previously, the stack header accepted scene and previous scene which contained things such as descriptor, navigation prop, progress etc. The commit simplifies them to pass `route`, `navigation`, `options` and `progress` directly to the header. Similaryly, the `previous` argument now contains `options`, `route` and `progress`.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.11.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.1...@react-navigation/drawer@5.11.2) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/drawer
|
||||
|
||||
@@ -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/drawer-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/drawer-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/drawer",
|
||||
"description": "Drawer navigator component with animated transitions and gesturess",
|
||||
"version": "5.11.2",
|
||||
"version": "6.0.0-next.3",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -42,12 +42,12 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/elements": "^1.0.0",
|
||||
"@react-navigation/elements": "^1.0.0-next.3",
|
||||
"color": "^3.1.3",
|
||||
"warn-once": "^0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-gesture-handler": ">= 1.0.0",
|
||||
|
||||
@@ -11,6 +11,7 @@ export { default as DrawerItem } from './views/DrawerItem';
|
||||
export { default as DrawerItemList } from './views/DrawerItemList';
|
||||
export { default as DrawerContent } from './views/DrawerContent';
|
||||
export { default as DrawerContentScrollView } from './views/DrawerContentScrollView';
|
||||
export { default as DrawerToggleButton } from './views/DrawerToggleButton';
|
||||
|
||||
/**
|
||||
* Utilities
|
||||
|
||||
@@ -93,7 +93,6 @@ type Props = {
|
||||
statusBarAnimation: 'slide' | 'none' | 'fade';
|
||||
overlayStyle?: StyleProp<ViewStyle>;
|
||||
drawerStyle?: StyleProp<ViewStyle>;
|
||||
sceneContainerStyle?: StyleProp<ViewStyle>;
|
||||
renderDrawerContent: Renderer;
|
||||
renderSceneContent: Renderer;
|
||||
gestureHandlerProps?: React.ComponentProps<typeof PanGestureHandler>;
|
||||
@@ -573,7 +572,6 @@ export default class DrawerView extends React.Component<Props> {
|
||||
drawerPosition,
|
||||
drawerType,
|
||||
swipeEdgeWidth,
|
||||
sceneContainerStyle,
|
||||
drawerStyle,
|
||||
overlayStyle,
|
||||
renderDrawerContent,
|
||||
@@ -642,7 +640,6 @@ export default class DrawerView extends React.Component<Props> {
|
||||
style={[
|
||||
styles.content,
|
||||
{ transform: [{ translateX: contentTranslateX }] },
|
||||
sceneContainerStyle as any,
|
||||
]}
|
||||
>
|
||||
<View
|
||||
|
||||
@@ -89,7 +89,6 @@ function DrawerViewBase({
|
||||
gestureHandlerProps,
|
||||
keyboardDismissMode = 'on-drag',
|
||||
overlayColor = 'rgba(0, 0, 0, 0.5)',
|
||||
sceneContainerStyle,
|
||||
swipeEdgeWidth,
|
||||
swipeEnabled,
|
||||
swipeMinDistance,
|
||||
@@ -181,6 +180,7 @@ function DrawerViewBase({
|
||||
}
|
||||
/>
|
||||
),
|
||||
sceneContainerStyle,
|
||||
} = descriptor.options;
|
||||
|
||||
return (
|
||||
@@ -191,6 +191,7 @@ function DrawerViewBase({
|
||||
enabled={detachInactiveScreens}
|
||||
>
|
||||
<Screen
|
||||
focused={isFocused}
|
||||
route={descriptor.route}
|
||||
navigation={descriptor.navigation}
|
||||
headerShown={descriptor.options.headerShown}
|
||||
@@ -201,6 +202,7 @@ function DrawerViewBase({
|
||||
navigation: descriptor.navigation as DrawerNavigationProp<ParamListBase>,
|
||||
options: descriptor.options,
|
||||
})}
|
||||
style={sceneContainerStyle}
|
||||
>
|
||||
{descriptor.render()}
|
||||
</Screen>
|
||||
@@ -222,10 +224,6 @@ function DrawerViewBase({
|
||||
gestureHandlerProps={gestureHandlerProps}
|
||||
drawerType={drawerType}
|
||||
drawerPosition={drawerPosition}
|
||||
sceneContainerStyle={[
|
||||
{ backgroundColor: colors.background },
|
||||
sceneContainerStyle,
|
||||
]}
|
||||
drawerStyle={[
|
||||
{
|
||||
width: getDefaultDrawerWidth(dimensions),
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
// @ts-ignore
|
||||
shouldUseActivityState,
|
||||
} from 'react-native-screens';
|
||||
import { ResourceSavingScene } from '@react-navigation/elements';
|
||||
import { ResourceSavingView } from '@react-navigation/elements';
|
||||
|
||||
type Props = {
|
||||
visible: boolean;
|
||||
@@ -34,8 +34,8 @@ export default function ScreenFallback({ visible, children, ...rest }: Props) {
|
||||
}
|
||||
|
||||
return (
|
||||
<ResourceSavingScene visible={visible} {...rest}>
|
||||
<ResourceSavingView visible={visible} {...rest}>
|
||||
{children}
|
||||
</ResourceSavingScene>
|
||||
</ResourceSavingView>
|
||||
);
|
||||
}
|
||||
|
||||
54
packages/elements/CHANGELOG.md
Normal file
54
packages/elements/CHANGELOG.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Change Log
|
||||
|
||||
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.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/elements@1.0.0-next.2...@react-navigation/elements@1.0.0-next.3) (2021-03-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a Background component ([cbaabc1](https://github.com/react-navigation/react-navigation/commit/cbaabc1288e780698e499a00b9ca06ab9746a0da))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* show a missing icon symbol instead of empty area in bottom tab bar ([2bc4882](https://github.com/react-navigation/react-navigation/commit/2bc4882692be9f02d781639892e1f98b891811c4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* initial implementation of @react-navigation/elements ([07ba7a9](https://github.com/react-navigation/react-navigation/commit/07ba7a96870efdb8acf99eb82ba0b1d3eac90bab))
|
||||
@@ -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/elements/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/elements/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/elements",
|
||||
"description": "UI Components for React Navigation",
|
||||
"version": "0.0.1",
|
||||
"version": "1.0.0-next.3",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
"react-navigation",
|
||||
@@ -39,7 +39,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-masked-view/masked-view": "^0.2.2",
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-safe-area-context": ">= 3.0.0"
|
||||
|
||||
18
packages/elements/src/Background.tsx
Normal file
18
packages/elements/src/Background.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as React from 'react';
|
||||
import { View, ViewProps } from 'react-native';
|
||||
import { useTheme } from '@react-navigation/native';
|
||||
|
||||
type Props = ViewProps & {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export default function Background({ style, ...rest }: Props) {
|
||||
const { colors } = useTheme();
|
||||
|
||||
return (
|
||||
<View
|
||||
{...rest}
|
||||
style={[{ flex: 1, backgroundColor: colors.background }, style]}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -22,7 +22,8 @@ export default function HeaderBackButton({
|
||||
labelVisible = Platform.OS === 'ios',
|
||||
onLabelLayout,
|
||||
onPress,
|
||||
pressColorAndroid: customPressColorAndroid,
|
||||
pressColor,
|
||||
pressOpacity,
|
||||
screenLayout,
|
||||
tintColor: customTintColor,
|
||||
titleLayout,
|
||||
@@ -31,7 +32,7 @@ export default function HeaderBackButton({
|
||||
testID,
|
||||
style,
|
||||
}: HeaderBackButtonProps) {
|
||||
const { dark, colors } = useTheme();
|
||||
const { colors } = useTheme();
|
||||
|
||||
const [initialLabelWidth, setInitialLabelWidth] = React.useState<
|
||||
undefined | number
|
||||
@@ -45,13 +46,6 @@ 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);
|
||||
|
||||
@@ -156,7 +150,8 @@ export default function HeaderBackButton({
|
||||
accessibilityLabel={accessibilityLabel}
|
||||
testID={testID}
|
||||
onPress={disabled ? undefined : handlePress}
|
||||
pressColor={pressColorAndroid}
|
||||
pressColor={pressColor}
|
||||
pressOpacity={pressOpacity}
|
||||
android_ripple={{ borderless: true }}
|
||||
style={[styles.container, disabled && styles.disabled, style]}
|
||||
hitSlop={Platform.select({
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Platform, Pressable, PressableProps } from 'react-native';
|
||||
import { useTheme } from '@react-navigation/native';
|
||||
|
||||
export type Props = PressableProps & {
|
||||
pressColor?: string;
|
||||
@@ -12,24 +13,30 @@ const ANDROID_SUPPORTS_RIPPLE =
|
||||
Platform.OS === 'android' && Platform.Version >= ANDROID_VERSION_LOLLIPOP;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
||||
*/
|
||||
export default function PlatformPressable({
|
||||
android_ripple,
|
||||
pressColor = 'rgba(0, 0, 0, .32)',
|
||||
pressColor,
|
||||
pressOpacity,
|
||||
style,
|
||||
...rest
|
||||
}: Props) {
|
||||
const { dark } = useTheme();
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
android_ripple={
|
||||
ANDROID_SUPPORTS_RIPPLE
|
||||
? { color: pressColor, ...android_ripple }
|
||||
? {
|
||||
color:
|
||||
pressColor !== undefined
|
||||
? pressColor
|
||||
: dark
|
||||
? 'rgba(255, 255, 255, .32)'
|
||||
: 'rgba(0, 0, 0, .32)',
|
||||
...android_ripple,
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
style={({ pressed }) => [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||
import {
|
||||
useSafeAreaFrame,
|
||||
useSafeAreaInsets,
|
||||
@@ -12,16 +12,19 @@ import {
|
||||
ParamListBase,
|
||||
} from '@react-navigation/native';
|
||||
|
||||
import Background from './Background';
|
||||
import HeaderShownContext from './Header/HeaderShownContext';
|
||||
import HeaderHeightContext from './Header/HeaderHeightContext';
|
||||
import getDefaultHeaderHeight from './Header/getDefaultHeaderHeight';
|
||||
|
||||
type Props = {
|
||||
focused: boolean;
|
||||
navigation: NavigationProp<ParamListBase>;
|
||||
route: RouteProp<ParamListBase, string>;
|
||||
header: React.ReactNode;
|
||||
headerShown?: boolean;
|
||||
headerStatusBarHeight?: number;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
@@ -30,14 +33,17 @@ export default function Screen(props: Props) {
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
const isParentHeaderShown = React.useContext(HeaderShownContext);
|
||||
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
||||
|
||||
const {
|
||||
focused,
|
||||
header,
|
||||
headerShown = true,
|
||||
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
||||
children,
|
||||
navigation,
|
||||
route,
|
||||
children,
|
||||
style,
|
||||
} = props;
|
||||
|
||||
const [headerHeight, setHeaderHeight] = React.useState(() =>
|
||||
@@ -45,12 +51,18 @@ export default function Screen(props: Props) {
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Background
|
||||
accessibilityElementsHidden={!focused}
|
||||
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
|
||||
style={[styles.container, style]}
|
||||
>
|
||||
<View style={styles.content}>
|
||||
<HeaderShownContext.Provider
|
||||
value={isParentHeaderShown || headerShown !== false}
|
||||
>
|
||||
<HeaderHeightContext.Provider value={headerShown ? headerHeight : 0}>
|
||||
<HeaderHeightContext.Provider
|
||||
value={headerShown ? headerHeight : parentHeaderHeight}
|
||||
>
|
||||
{children}
|
||||
</HeaderHeightContext.Provider>
|
||||
</HeaderShownContext.Provider>
|
||||
@@ -70,7 +82,7 @@ export default function Screen(props: Props) {
|
||||
</NavigationRouteContext.Provider>
|
||||
</NavigationContext.Provider>
|
||||
) : null}
|
||||
</View>
|
||||
</Background>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ export { default as getHeaderTitle } from './Header/getHeaderTitle';
|
||||
|
||||
export { default as MissingIcon } from './MissingIcon';
|
||||
export { default as PlatformPressable } from './PlatformPressable';
|
||||
export { default as ResourceSavingScene } from './ResourceSavingScene';
|
||||
export { default as ResourceSavingView } from './ResourceSavingView';
|
||||
export { default as SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|
||||
export { default as Screen } from './Screen';
|
||||
export { default as Background } from './Background';
|
||||
|
||||
export const Assets = [
|
||||
// eslint-disable-next-line import/no-commonjs
|
||||
|
||||
@@ -127,13 +127,16 @@ 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).
|
||||
*/
|
||||
pressColorAndroid?: string;
|
||||
pressColor?: string;
|
||||
/**
|
||||
* Opacity when the button is pressed, used when ripple is not supported.
|
||||
*/
|
||||
pressOpacity?: number;
|
||||
/**
|
||||
* Function which returns a React Element to display custom image in header's back button.
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,28 @@
|
||||
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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.3.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.8...@react-navigation/material-bottom-tabs@5.3.9) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||
|
||||
@@ -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/material-bottom-tab-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-bottom-tab-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/material-bottom-tabs",
|
||||
"description": "Integration for bottom navigation component from react-native-paper",
|
||||
"version": "5.3.9",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -42,7 +42,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-paper": ">= 3.0.0",
|
||||
|
||||
@@ -3,6 +3,39 @@
|
||||
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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* move lazy to options for material-top-tabs ([cfd1c9b](https://github.com/react-navigation/react-navigation/commit/cfd1c9b6efb528c7737fb68766873f9c564196d7))
|
||||
* upgrade to latest react-native-tab-view using ViewPager ([2261001](https://github.com/react-navigation/react-navigation/commit/22610014b3b1e649b368a63fd021362235ee585d))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* The lazy prop now can be configured per screen instead of for the whole navigator. To keep previous behavior, you can specify it in screenOptions
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.3.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.8...@react-navigation/material-top-tabs@5.3.9) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||
|
||||
@@ -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/react-native-community/react-native-tab-view).
|
||||
React Navigation integration for animated tab view component from [`react-native-tab-view`](https://github.com/satya164/react-native-tab-view).
|
||||
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/material-top-tab-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/material-top-tab-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/material-top-tabs",
|
||||
"description": "Integration for the animated tab view component from react-native-tab-view",
|
||||
"version": "5.3.9",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -46,7 +46,7 @@
|
||||
"warn-once": "^0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-pager-view": ">= 1.0.0",
|
||||
"react-native-pager-view": ">= 4.0.0",
|
||||
"react-native-tab-view": ">= 3.0.0"
|
||||
},
|
||||
"react-native-builder-bob": {
|
||||
|
||||
@@ -3,6 +3,41 @@
|
||||
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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* address breaking change in react-native for Linking ([61c6bb0](https://github.com/react-navigation/react-navigation/commit/61c6bb01b9e3aacaf93ecc7398b6c45834a2216d))
|
||||
* default to backBehavior: firstRoute for TabRouter ([8bdc6c6](https://github.com/react-navigation/react-navigation/commit/8bdc6c6b9bc957a00a01eec2fcf6f971998c9380))
|
||||
* drop dangerously prefix from getState and getParent ([227f133](https://github.com/react-navigation/react-navigation/commit/227f133536af85dc5ff85eeb269b76ed80cd3f05))
|
||||
* normalize prefix when parsing. fixes [#9081](https://github.com/react-navigation/react-navigation/issues/9081) ([fd034fe](https://github.com/react-navigation/react-navigation/commit/fd034fea35cd0ae23dac979d90d8fc8598dadcc3))
|
||||
* support sync getInitialURL in native useLinking ([52dd4e7](https://github.com/react-navigation/react-navigation/commit/52dd4e7ac92e3e176ac9f106e646ff6e300f3412))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* associate path with the route it opens when deep linking ([#9384](https://github.com/react-navigation/react-navigation/issues/9384)) ([86e64fd](https://github.com/react-navigation/react-navigation/commit/86e64fdcd81a57cf3f3bdab4c9035b52984e7009)), closes [#9102](https://github.com/react-navigation/react-navigation/issues/9102)
|
||||
* stop exporting useLinking hook ([5a9a1ed](https://github.com/react-navigation/react-navigation/commit/5a9a1edae7366d26af3494de341d9503a011974a))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Returning to first route after pressing back seems more common in apps. This commit changes the default for tab and drawer navigators to follow this common practice. To preserve previous behavior, you can pass backBehavior=history to tab and drawer navigators.
|
||||
* we have added linking prop for the same use case which is easier to use. so no need to export useLinking anymore.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.8.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.8...@react-navigation/native@5.8.9) (2020-11-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/native
|
||||
|
||||
@@ -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/getting-started/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/getting-started/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/native",
|
||||
"description": "React Native integration for React Navigation",
|
||||
"version": "5.8.9",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
"react-navigation",
|
||||
@@ -38,7 +38,7 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/core": "^5.14.3",
|
||||
"@react-navigation/core": "^6.0.0-next.1",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"nanoid": "^3.1.20"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,63 @@
|
||||
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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* default to backBehavior: firstRoute for TabRouter ([8bdc6c6](https://github.com/react-navigation/react-navigation/commit/8bdc6c6b9bc957a00a01eec2fcf6f971998c9380))
|
||||
* don't merge params on navigation ([366d018](https://github.com/react-navigation/react-navigation/commit/366d0181dc02597b8d11e343f37fc77bee164c70))
|
||||
* fix getId being called for incorrect routes. closes [#9343](https://github.com/react-navigation/react-navigation/issues/9343) ([61e653d](https://github.com/react-navigation/react-navigation/commit/61e653d7c484e8ff09045e8635cce4f566a141b4))
|
||||
* fix StackRouter incorrectly handling invalid route if key is present ([3367ddf](https://github.com/react-navigation/react-navigation/commit/3367ddf9df5696c2b596deee7342040b8ea50763))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* don't use a boolean for drawer status ([cda6397](https://github.com/react-navigation/react-navigation/commit/cda6397b8989c552824eca4175577527c9d72f93))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a new backBehavior: firstRoute for TabRouter ([7c1cd26](https://github.com/react-navigation/react-navigation/commit/7c1cd261bfe70f14294daa598a5c72c777c911d3))
|
||||
* add a way to specify an unique ID for screens ([15b8bb3](https://github.com/react-navigation/react-navigation/commit/15b8bb34584db3cb166f6aafd45f0b95f14fde62))
|
||||
* add pressColor and pressOpacity props to drawerItem ([#8834](https://github.com/react-navigation/react-navigation/issues/8834)) ([52dbe4b](https://github.com/react-navigation/react-navigation/commit/52dbe4bd6663430745b07ea379d44d4d4f2944a0))
|
||||
* associate path with the route it opens when deep linking ([#9384](https://github.com/react-navigation/react-navigation/issues/9384)) ([86e64fd](https://github.com/react-navigation/react-navigation/commit/86e64fdcd81a57cf3f3bdab4c9035b52984e7009)), closes [#9102](https://github.com/react-navigation/react-navigation/issues/9102)
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Drawer status is now a union ('open', 'closed') instead of a boolean. This will let us implement more types of status in future.
|
||||
|
||||
Following this the following exports have been renamed as well:
|
||||
- getIsDrawerOpenFromState -> getDrawerStatusFromState
|
||||
- useIsDrawerOpen -> useDrawerStatus
|
||||
* Returning to first route after pressing back seems more common in apps. This commit changes the default for tab and drawer navigators to follow this common practice. To preserve previous behavior, you can pass backBehavior=history to tab and drawer navigators.
|
||||
* Previous versions of React Navigation merged params on navigation which caused confusion. This commit changes params not to be merged.
|
||||
|
||||
The old behaviour can still be achieved by passing `merge: true` explicitly:
|
||||
|
||||
```js
|
||||
CommonActions.navigate({
|
||||
name: 'bar',
|
||||
params: { fruit: 'orange' },
|
||||
merge: true,
|
||||
})
|
||||
```
|
||||
`initialParams` specified for the screen are always merged.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.6.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.6.1...@react-navigation/routers@5.6.2) (2020-11-09)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/routers
|
||||
|
||||
@@ -14,4 +14,4 @@ yarn add @react-navigation/routers
|
||||
|
||||
## Usage
|
||||
|
||||
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/custom-routers/).
|
||||
Documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/custom-routers/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/routers",
|
||||
"description": "Routers to help build custom navigators",
|
||||
"version": "5.6.2",
|
||||
"version": "6.0.0-next.1",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
|
||||
@@ -3,6 +3,153 @@
|
||||
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.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.7...@react-navigation/stack@6.0.0-next.8) (2021-03-22)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a Background component ([cbaabc1](https://github.com/react-navigation/react-navigation/commit/cbaabc1288e780698e499a00b9ca06ab9746a0da))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.6...@react-navigation/stack@6.0.0-next.7) (2021-03-22)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* make gestureResponseDistance a number ([48851c9](https://github.com/react-navigation/react-navigation/commit/48851c9ebdcf1b835bbcb673adeb88e56b989443))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* now we need to pass a number instead of an object
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.6](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.5...@react-navigation/stack@6.0.0-next.6) (2021-03-14)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/stack
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.4...@react-navigation/stack@6.0.0-next.5) (2021-03-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* consider header colors when managing statusbar ([3ad2bcb](https://github.com/react-navigation/react-navigation/commit/3ad2bcbaf85996ce0d5e1e961081978a32448899))
|
||||
* consider header colors when managing statusbar ([faee245](https://github.com/react-navigation/react-navigation/commit/faee245d2ec8c59f9e9033d96ae21c5e60d95ba6))
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* move headerMode to options ([aacc1b5](https://github.com/react-navigation/react-navigation/commit/aacc1b525d86f0e0b1bad8016fd85e82024f16e9))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* headerMode is now moved to options instead of props
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@6.0.0-next.3...@react-navigation/stack@6.0.0-next.4) (2021-03-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add special statusbar handling to modal presentation ([a204edd](https://github.com/react-navigation/react-navigation/commit/a204edd012060f0816eddee7a093183aa379d049))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [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)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add missing helper types in descriptors ([21a1154](https://github.com/react-navigation/react-navigation/commit/21a11543bf41c4559c2570d5accc0bbb3b67eb8d))
|
||||
* drop support for headerMode='none' ([0c55803](https://github.com/react-navigation/react-navigation/commit/0c55803b32c5d20216b91aa7a355b042051ae638))
|
||||
* drop usage of Dimensions in favor of metrics from safe-area-context ([12b893d](https://github.com/react-navigation/react-navigation/commit/12b893d7ca8cdb726b973972797658ac9c7d17d7))
|
||||
* enable detachInactiveScreens by default on web for better a11y ([4954d6a](https://github.com/react-navigation/react-navigation/commit/4954d6aae3cdbb5855d44ff17d80d16b81fb224e))
|
||||
* fix initial metrics on server ([69d333f](https://github.com/react-navigation/react-navigation/commit/69d333f6c23e0c37eaf4d3f8b413e8f96d6827f8))
|
||||
* fix transparent modal on web ([c345ef1](https://github.com/react-navigation/react-navigation/commit/c345ef1d0b82e0c0ec1ebd3a3ced4ed5b5e835e4))
|
||||
* force dismiss keyboard if there was no gesture ([14ac256](https://github.com/react-navigation/react-navigation/commit/14ac256af363f3bc10ba6cb4ce2d67f347116042)), closes [#9078](https://github.com/react-navigation/react-navigation/issues/9078)
|
||||
|
||||
|
||||
### Code Refactoring
|
||||
|
||||
* don't use absolute position for header ([79a85a4](https://github.com/react-navigation/react-navigation/commit/79a85a431ce0859ae35a13858b23c3919795e560))
|
||||
* don't use deprecated APIs from react-native-safe-area-context ([ddf27bf](https://github.com/react-navigation/react-navigation/commit/ddf27bf41a2efc5d1573aad0f8fe6c27a98c32b3))
|
||||
* simplify props for stack and drawer headers ([4cad132](https://github.com/react-navigation/react-navigation/commit/4cad132c2c3daa6370a6916977f1f1db0036d4e4))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add a slide animation for modals on Android ([6f326cf](https://github.com/react-navigation/react-navigation/commit/6f326cf0c5098a722176aedd2051d29e12c95592))
|
||||
* add an option to specify default options for the navigator ([c85f2ff](https://github.com/react-navigation/react-navigation/commit/c85f2ff47a2b3d403a3cbe993b46d04914358ba5))
|
||||
* add pressColor and pressOpacity props to drawerItem ([#8834](https://github.com/react-navigation/react-navigation/issues/8834)) ([52dbe4b](https://github.com/react-navigation/react-navigation/commit/52dbe4bd6663430745b07ea379d44d4d4f2944a0))
|
||||
* don't hardcode header back test ID ([22a8afa](https://github.com/react-navigation/react-navigation/commit/22a8afac7454cfb776a550abc498ed47c299261d))
|
||||
* export TransitionPreset for custom TransitionPresets ([#9173](https://github.com/react-navigation/react-navigation/issues/9173)) ([6c3cccf](https://github.com/react-navigation/react-navigation/commit/6c3cccf87715ccb0a6c4bca6544f29c1b30e9611))
|
||||
* initial implementation of @react-navigation/elements ([07ba7a9](https://github.com/react-navigation/react-navigation/commit/07ba7a96870efdb8acf99eb82ba0b1d3eac90bab))
|
||||
* use modal presentation style for modals on iOS by default ([8a63f19](https://github.com/react-navigation/react-navigation/commit/8a63f193bf26c35546aa45af01d89b7a7216657d))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* We now use flexbox for header elements which could break some existing style code which relied on absolute positioning.
|
||||
* Now the back button test ID can be customized using headerBackTestID option
|
||||
* We now require newer versions of safe area context library.
|
||||
* Previously, the stack header accepted scene and previous scene which contained things such as descriptor, navigation prop, progress etc. The commit simplifies them to pass `route`, `navigation`, `options` and `progress` directly to the header. Similaryly, the `previous` argument now contains `options`, `route` and `progress`.
|
||||
* The header can be hidden with `headerShown: false` already. Using both `headerMode='none'` and `headerShown` together causes confusion. So it's time to drop the unnecessary `headerMode` prop.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [5.12.6](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.5...@react-navigation/stack@5.12.6) (2020-11-10)
|
||||
|
||||
|
||||
|
||||
@@ -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/stack-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/stack-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/stack",
|
||||
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
||||
"version": "5.12.6",
|
||||
"version": "6.0.0-next.8",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -41,13 +41,13 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/elements": "^1.0.0",
|
||||
"@react-navigation/elements": "^1.0.0-next.3",
|
||||
"color": "^3.1.3",
|
||||
"react-native-iphone-x-helper": "^1.3.0",
|
||||
"warn-once": "^0.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^5.8.9",
|
||||
"@react-navigation/native": "^6.0.0-next.1",
|
||||
"@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": "^5.0.5",
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-gesture-handler": ">= 1.0.0",
|
||||
|
||||
@@ -160,6 +160,10 @@ export function forModalPresentationIOS({
|
||||
overflow: 'hidden',
|
||||
borderTopLeftRadius: borderRadius,
|
||||
borderTopRightRadius: borderRadius,
|
||||
// We don't need these for the animation
|
||||
// But different border radius for corners improves animation perf
|
||||
borderBottomLeftRadius: isIphoneX() ? borderRadius : 0,
|
||||
borderBottomRightRadius: isIphoneX() ? borderRadius : 0,
|
||||
marginTop: index === 0 ? 0 : statusBarHeight,
|
||||
marginBottom: index === 0 ? 0 : topOffset,
|
||||
transform: [{ translateY }, { scale }],
|
||||
|
||||
@@ -18,6 +18,7 @@ import type {
|
||||
StackNavigationConfig,
|
||||
StackNavigationOptions,
|
||||
StackNavigationEventMap,
|
||||
StackHeaderMode,
|
||||
} from '../types';
|
||||
|
||||
type Props = DefaultNavigatorOptions<StackNavigationOptions> &
|
||||
@@ -31,13 +32,18 @@ function StackNavigator({
|
||||
...rest
|
||||
}: Props) {
|
||||
// @ts-expect-error: headerMode='none' is deprecated
|
||||
const isHeaderModeNone = rest.headerMode === 'none';
|
||||
const headerMode = rest.headerMode as StackHeaderMode | 'none' | undefined;
|
||||
|
||||
warnOnce(
|
||||
isHeaderModeNone,
|
||||
headerMode === 'none',
|
||||
`Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.`
|
||||
);
|
||||
|
||||
warnOnce(
|
||||
headerMode && headerMode !== 'none',
|
||||
`Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.`
|
||||
);
|
||||
|
||||
const { state, descriptors, navigation } = useNavigationBuilder<
|
||||
StackNavigationState<ParamListBase>,
|
||||
StackRouterOptions,
|
||||
@@ -48,14 +54,22 @@ function StackNavigator({
|
||||
initialRouteName,
|
||||
children,
|
||||
screenOptions,
|
||||
defaultScreenOptions: {
|
||||
headerShown: !isHeaderModeNone,
|
||||
defaultScreenOptions: ({ options }) => ({
|
||||
headerShown: headerMode ? headerMode !== 'none' : true,
|
||||
headerMode:
|
||||
headerMode && headerMode !== 'none'
|
||||
? headerMode
|
||||
: rest.mode !== 'modal' &&
|
||||
Platform.OS === 'ios' &&
|
||||
options.header === undefined
|
||||
? 'float'
|
||||
: 'screen',
|
||||
gestureEnabled: Platform.OS === 'ios',
|
||||
animationEnabled:
|
||||
Platform.OS !== 'web' &&
|
||||
Platform.OS !== 'windows' &&
|
||||
Platform.OS !== 'macos',
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
React.useEffect(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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,
|
||||
@@ -149,10 +148,6 @@ 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.
|
||||
*/
|
||||
@@ -203,7 +198,12 @@ export type StackNavigationOptions = StackHeaderOptions &
|
||||
*/
|
||||
header?: (props: StackHeaderProps) => React.ReactNode;
|
||||
/**
|
||||
* Whether to show the header. The header is shown by default unless `headerMode` was set to `none`.
|
||||
* Whether the header floats above the screen or part of the screen.
|
||||
* Defaults to `float` on iOS for non-modals, and `screen` for the rest.
|
||||
*/
|
||||
headerMode?: StackHeaderMode;
|
||||
/**
|
||||
* Whether to show the header. The header is shown by default.
|
||||
* Setting this to `false` hides the header.
|
||||
*/
|
||||
headerShown?: boolean;
|
||||
@@ -249,35 +249,15 @@ export type StackNavigationOptions = StackHeaderOptions &
|
||||
*/
|
||||
gestureEnabled?: boolean;
|
||||
/**
|
||||
* Object to override the distance of touch start from the edge of the screen to recognize gestures.
|
||||
* Distance of touch start from the edge of the screen to recognize gestures.
|
||||
* Not supported on Web.
|
||||
*/
|
||||
gestureResponseDistance?: {
|
||||
/**
|
||||
* Distance for vertical direction. Defaults to 135.
|
||||
*/
|
||||
vertical?: number;
|
||||
/**
|
||||
* Distance for horizontal direction. Defaults to 25.
|
||||
*/
|
||||
horizontal?: number;
|
||||
};
|
||||
gestureResponseDistance?: number;
|
||||
/**
|
||||
* Number which determines the relevance of velocity for the gesture. Defaults to 0.3.
|
||||
* 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.
|
||||
@@ -289,7 +269,6 @@ export type StackNavigationOptions = StackHeaderOptions &
|
||||
|
||||
export type StackNavigationConfig = {
|
||||
mode?: StackCardMode;
|
||||
headerMode?: StackHeaderMode;
|
||||
/**
|
||||
* If `false`, the keyboard will NOT automatically dismiss when navigating to a new screen.
|
||||
* Defaults to `true`.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
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';
|
||||
|
||||
@@ -10,13 +11,14 @@ 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
|
||||
@@ -47,7 +49,11 @@ export default React.memo(function Header({
|
||||
);
|
||||
|
||||
const statusBarHeight =
|
||||
(isModal && !isFirstRouteInParent) || isParentHeaderShown ? 0 : insets.top;
|
||||
options.headerStatusBarHeight !== undefined
|
||||
? options.headerStatusBarHeight
|
||||
: (isModal && !isFirstRouteInParent) || isParentHeaderShown
|
||||
? 0
|
||||
: insets.top;
|
||||
|
||||
return (
|
||||
<HeaderSegment
|
||||
|
||||
@@ -7,7 +7,6 @@ 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 {
|
||||
@@ -22,13 +21,11 @@ import type {
|
||||
StackHeaderStyleInterpolator,
|
||||
StackNavigationProp,
|
||||
StackHeaderProps,
|
||||
GestureDirection,
|
||||
} from '../../types';
|
||||
|
||||
export type Props = {
|
||||
mode: 'float' | 'screen';
|
||||
layout: Layout;
|
||||
insets: EdgeInsets;
|
||||
scenes: (Scene | undefined)[];
|
||||
getPreviousScene: (props: { route: Route<string> }) => Scene | undefined;
|
||||
getFocusedRoute: () => Route<string>;
|
||||
@@ -37,7 +34,6 @@ export type Props = {
|
||||
height: number;
|
||||
}) => void;
|
||||
styleInterpolator: StackHeaderStyleInterpolator;
|
||||
gestureDirection: GestureDirection;
|
||||
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||
};
|
||||
|
||||
@@ -45,11 +41,9 @@ export default function HeaderContainer({
|
||||
mode,
|
||||
scenes,
|
||||
layout,
|
||||
insets,
|
||||
getPreviousScene,
|
||||
getFocusedRoute,
|
||||
onContentHeightChange,
|
||||
gestureDirection,
|
||||
styleInterpolator,
|
||||
style,
|
||||
}: Props) {
|
||||
@@ -63,10 +57,10 @@ export default function HeaderContainer({
|
||||
return null;
|
||||
}
|
||||
|
||||
const { header, headerShown = true, headerTransparent } =
|
||||
const { header, headerMode, headerShown = true, headerTransparent } =
|
||||
scene.descriptor.options || {};
|
||||
|
||||
if (!headerShown) {
|
||||
if (headerMode !== mode || !headerShown) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -90,22 +84,27 @@ export default function HeaderContainer({
|
||||
const previousDescriptor = self[i - 1]?.descriptor;
|
||||
const nextDescriptor = self[i + 1]?.descriptor;
|
||||
|
||||
const { headerShown: previousHeaderShown = true } =
|
||||
previousDescriptor?.options || {};
|
||||
const {
|
||||
headerShown: previousHeaderShown = true,
|
||||
headerMode: previousHeaderMode,
|
||||
} = previousDescriptor?.options || {};
|
||||
|
||||
const { headerShown: nextHeaderShown = true } =
|
||||
nextDescriptor?.options || {};
|
||||
const {
|
||||
headerShown: nextHeaderShown = true,
|
||||
headerMode: nextHeaderMode,
|
||||
gestureDirection: nextGestureDirection,
|
||||
} = nextDescriptor?.options || {};
|
||||
|
||||
const isHeaderStatic =
|
||||
(previousHeaderShown === false &&
|
||||
((previousHeaderShown === false || previousHeaderMode === 'screen') &&
|
||||
// We still need to animate when coming back from next scene
|
||||
// A hacky way to check this is if the next scene exists
|
||||
!nextDescriptor) ||
|
||||
nextHeaderShown === false;
|
||||
nextHeaderShown === false ||
|
||||
nextHeaderMode === 'screen';
|
||||
|
||||
const props: StackHeaderProps = {
|
||||
layout,
|
||||
insets,
|
||||
back: headerBack,
|
||||
progress: scene.progress,
|
||||
options: scene.descriptor.options,
|
||||
@@ -115,10 +114,10 @@ export default function HeaderContainer({
|
||||
styleInterpolator:
|
||||
mode === 'float'
|
||||
? isHeaderStatic
|
||||
? gestureDirection === 'vertical' ||
|
||||
gestureDirection === 'vertical-inverted'
|
||||
? nextGestureDirection === 'vertical' ||
|
||||
nextGestureDirection === 'vertical-inverted'
|
||||
? forSlideUp
|
||||
: gestureDirection === 'horizontal-inverted'
|
||||
: nextGestureDirection === 'horizontal-inverted'
|
||||
? forSlideRight
|
||||
: forSlideLeft
|
||||
: styleInterpolator
|
||||
|
||||
@@ -111,6 +111,10 @@ export default function HeaderSegment(props: Props) {
|
||||
headerBackTestID,
|
||||
headerBackAllowFontScaling,
|
||||
headerBackTitleStyle,
|
||||
headerTitleContainerStyle,
|
||||
headerLeftContainerStyle,
|
||||
headerRightContainerStyle,
|
||||
headerBackgroundContainerStyle,
|
||||
headerStyle: customHeaderStyle,
|
||||
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
||||
styleInterpolator,
|
||||
@@ -172,10 +176,13 @@ export default function HeaderSegment(props: Props) {
|
||||
layout={layout}
|
||||
headerTitle={headerTitle}
|
||||
headerLeft={headerLeft}
|
||||
headerTitleContainerStyle={titleStyle}
|
||||
headerLeftContainerStyle={leftButtonStyle}
|
||||
headerRightContainerStyle={rightButtonStyle}
|
||||
headerBackgroundContainerStyle={backgroundStyle}
|
||||
headerTitleContainerStyle={[titleStyle, headerTitleContainerStyle]}
|
||||
headerLeftContainerStyle={[leftButtonStyle, headerLeftContainerStyle]}
|
||||
headerRightContainerStyle={[rightButtonStyle, headerRightContainerStyle]}
|
||||
headerBackgroundContainerStyle={[
|
||||
backgroundStyle,
|
||||
headerBackgroundContainerStyle,
|
||||
]}
|
||||
headerStyle={customHeaderStyle}
|
||||
headerStatusBarHeight={headerStatusBarHeight}
|
||||
{...rest}
|
||||
|
||||
@@ -37,8 +37,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
||||
|
||||
this.clearKeyboardTimeout();
|
||||
|
||||
// @ts-expect-error: blurTextInput accepts both number and ref, but types say only ref
|
||||
const input: InputRef = TextInput.State.currentlyFocusedField();
|
||||
const input: InputRef = TextInput.State.currentlyFocusedInput();
|
||||
|
||||
// When a page change begins, blur the currently focused input
|
||||
input?.blur();
|
||||
|
||||
58
packages/stack/src/views/ModalStatusBarManager.tsx
Normal file
58
packages/stack/src/views/ModalStatusBarManager.tsx
Normal file
@@ -0,0 +1,58 @@
|
||||
import * as React from 'react';
|
||||
import { StatusBar, StyleSheet } from 'react-native';
|
||||
import { useTheme } from '@react-navigation/native';
|
||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||
import type { Layout } from '../types';
|
||||
|
||||
type Props = {
|
||||
dark: boolean | undefined;
|
||||
layout: Layout;
|
||||
insets: EdgeInsets;
|
||||
style: any;
|
||||
};
|
||||
|
||||
export default function ModalStatusBarManager({
|
||||
dark,
|
||||
layout,
|
||||
insets,
|
||||
style,
|
||||
}: Props) {
|
||||
const { dark: darkTheme } = useTheme();
|
||||
const [overlapping, setOverlapping] = React.useState(true);
|
||||
|
||||
const enabled = layout.width && layout.height > layout.width;
|
||||
const scale = 1 - 20 / layout.width;
|
||||
const offset = (insets.top - 34) * scale;
|
||||
|
||||
const flattenedStyle = StyleSheet.flatten(style);
|
||||
const translateY = flattenedStyle?.transform?.find(
|
||||
(s: any) => s.translateY !== undefined
|
||||
)?.translateY;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const listener = ({ value }: { value: number }) => {
|
||||
setOverlapping(value < offset);
|
||||
};
|
||||
|
||||
const sub = translateY?.addListener(listener);
|
||||
|
||||
return () => translateY?.removeListener(sub);
|
||||
}, [enabled, offset, translateY]);
|
||||
|
||||
if (!enabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const darkContent = dark ?? !darkTheme;
|
||||
|
||||
return (
|
||||
<StatusBar
|
||||
animated
|
||||
barStyle={overlapping && darkContent ? 'dark-content' : 'light-content'}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -18,6 +18,8 @@ import {
|
||||
GestureState,
|
||||
PanGestureHandlerGestureEvent,
|
||||
} from '../GestureHandler';
|
||||
import ModalStatusBarManager from '../ModalStatusBarManager';
|
||||
import { forModalPresentationIOS } from '../../TransitionConfigs/CardStyleInterpolators';
|
||||
import CardAnimationContext from '../../utils/CardAnimationContext';
|
||||
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
||||
import getInvertedMultiplier from '../../utils/getInvertedMultiplier';
|
||||
@@ -37,6 +39,7 @@ type Props = ViewProps & {
|
||||
gesture: Animated.Value;
|
||||
layout: Layout;
|
||||
insets: EdgeInsets;
|
||||
headerDarkContent: boolean | undefined;
|
||||
pageOverflowEnabled: boolean;
|
||||
gestureDirection: GestureDirection;
|
||||
onOpen: () => void;
|
||||
@@ -52,10 +55,7 @@ type Props = ViewProps & {
|
||||
overlayEnabled: boolean;
|
||||
shadowEnabled: boolean;
|
||||
gestureEnabled: boolean;
|
||||
gestureResponseDistance?: {
|
||||
vertical?: number;
|
||||
horizontal?: number;
|
||||
};
|
||||
gestureResponseDistance?: number;
|
||||
gestureVelocityImpact: number;
|
||||
transitionSpec: {
|
||||
open: TransitionSpec;
|
||||
@@ -406,13 +406,11 @@ export default class Card extends React.Component<Props> {
|
||||
const { layout, gestureDirection, gestureResponseDistance } = this.props;
|
||||
|
||||
const distance =
|
||||
gestureDirection === 'vertical' ||
|
||||
gestureDirection === 'vertical-inverted'
|
||||
? gestureResponseDistance?.vertical !== undefined
|
||||
? gestureResponseDistance.vertical
|
||||
: GESTURE_RESPONSE_DISTANCE_VERTICAL
|
||||
: gestureResponseDistance?.horizontal !== undefined
|
||||
? gestureResponseDistance.horizontal
|
||||
gestureResponseDistance !== undefined
|
||||
? gestureResponseDistance
|
||||
: gestureDirection === 'vertical' ||
|
||||
gestureDirection === 'vertical-inverted'
|
||||
? GESTURE_RESPONSE_DISTANCE_VERTICAL
|
||||
: GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
||||
|
||||
if (gestureDirection === 'vertical') {
|
||||
@@ -464,6 +462,7 @@ export default class Card extends React.Component<Props> {
|
||||
gestureEnabled,
|
||||
gestureDirection,
|
||||
pageOverflowEnabled,
|
||||
headerDarkContent,
|
||||
children,
|
||||
containerStyle: customContainerStyle,
|
||||
contentStyle,
|
||||
@@ -523,6 +522,22 @@ export default class Card extends React.Component<Props> {
|
||||
|
||||
return (
|
||||
<CardAnimationContext.Provider value={animationContext}>
|
||||
{
|
||||
// StatusBar messes with translucent status bar on Android
|
||||
// So we should only enable it on iOS
|
||||
Platform.OS === 'ios' &&
|
||||
overlayEnabled &&
|
||||
index === 0 &&
|
||||
next &&
|
||||
styleInterpolator === forModalPresentationIOS ? (
|
||||
<ModalStatusBarManager
|
||||
dark={headerDarkContent}
|
||||
layout={layout}
|
||||
insets={insets}
|
||||
style={cardStyle}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
<Animated.View
|
||||
style={{
|
||||
// This is a dummy style that doesn't actually change anything visually.
|
||||
|
||||
@@ -27,6 +27,7 @@ type Props = TransitionPreset & {
|
||||
layout: Layout;
|
||||
gesture: Animated.Value;
|
||||
scene: Scene;
|
||||
headerDarkContent: boolean | undefined;
|
||||
safeAreaInsetTop: number;
|
||||
safeAreaInsetRight: number;
|
||||
safeAreaInsetBottom: number;
|
||||
@@ -55,15 +56,12 @@ type Props = TransitionPreset & {
|
||||
onGestureEnd?: (props: { route: Route<string> }) => void;
|
||||
onGestureCancel?: (props: { route: Route<string> }) => void;
|
||||
gestureEnabled?: boolean;
|
||||
gestureResponseDistance?: {
|
||||
vertical?: number;
|
||||
horizontal?: number;
|
||||
};
|
||||
gestureResponseDistance?: number;
|
||||
gestureVelocityImpact?: number;
|
||||
mode: StackCardMode;
|
||||
headerMode: StackHeaderMode;
|
||||
headerShown: boolean;
|
||||
hasAbsoluteHeader: boolean;
|
||||
hasAbsoluteFloatHeader: boolean;
|
||||
headerHeight: number;
|
||||
onHeaderHeightChange: (props: {
|
||||
route: Route<string>;
|
||||
@@ -91,10 +89,11 @@ function CardContainer({
|
||||
getPreviousScene,
|
||||
getFocusedRoute,
|
||||
mode,
|
||||
headerDarkContent,
|
||||
headerMode,
|
||||
headerShown,
|
||||
headerStyleInterpolator,
|
||||
hasAbsoluteHeader,
|
||||
hasAbsoluteFloatHeader,
|
||||
headerHeight,
|
||||
onHeaderHeightChange,
|
||||
isParentHeaderShown,
|
||||
@@ -119,6 +118,8 @@ function CardContainer({
|
||||
scene,
|
||||
transitionSpec,
|
||||
}: Props) {
|
||||
const parentHeaderHeight = React.useContext(HeaderHeightContext);
|
||||
|
||||
const handleOpen = () => {
|
||||
const { route } = scene.descriptor;
|
||||
|
||||
@@ -246,7 +247,12 @@ function CardContainer({
|
||||
importantForAccessibility={focused ? 'auto' : 'no-hide-descendants'}
|
||||
pointerEvents={active ? 'box-none' : pointerEvents}
|
||||
pageOverflowEnabled={headerMode !== 'float' && mode === 'card'}
|
||||
containerStyle={hasAbsoluteHeader ? { marginTop: headerHeight } : null}
|
||||
headerDarkContent={headerDarkContent}
|
||||
containerStyle={
|
||||
hasAbsoluteFloatHeader && headerMode !== 'screen'
|
||||
? { marginTop: headerHeight }
|
||||
: null
|
||||
}
|
||||
contentStyle={[{ backgroundColor: colors.background }, cardStyle]}
|
||||
style={[
|
||||
{
|
||||
@@ -263,7 +269,9 @@ function CardContainer({
|
||||
<HeaderShownContext.Provider
|
||||
value={isParentHeaderShown || headerShown !== false}
|
||||
>
|
||||
<HeaderHeightContext.Provider value={headerHeight}>
|
||||
<HeaderHeightContext.Provider
|
||||
value={headerShown ? headerHeight : parentHeaderHeight}
|
||||
>
|
||||
{renderScene({ route: scene.descriptor.route })}
|
||||
</HeaderHeightContext.Provider>
|
||||
</HeaderShownContext.Provider>
|
||||
@@ -274,11 +282,9 @@ function CardContainer({
|
||||
{renderHeader({
|
||||
mode: 'screen',
|
||||
layout,
|
||||
insets,
|
||||
scenes: [previousScene, scene],
|
||||
getPreviousScene,
|
||||
getFocusedRoute,
|
||||
gestureDirection,
|
||||
styleInterpolator: headerStyleInterpolator,
|
||||
onContentHeightChange: onHeaderHeightChange,
|
||||
})}
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||
import Color from 'color';
|
||||
import type {
|
||||
ParamListBase,
|
||||
Route,
|
||||
@@ -14,6 +15,7 @@ import type {
|
||||
import {
|
||||
getDefaultHeaderHeight,
|
||||
SafeAreaProviderCompat,
|
||||
Background,
|
||||
} from '@react-navigation/elements';
|
||||
|
||||
import {
|
||||
@@ -27,12 +29,10 @@ import {
|
||||
DefaultTransition,
|
||||
ModalTransition,
|
||||
} from '../../TransitionConfigs/TransitionPresets';
|
||||
import { forNoAnimation as forNoAnimationHeader } from '../../TransitionConfigs/HeaderStyleInterpolators';
|
||||
import { forNoAnimation as forNoAnimationCard } from '../../TransitionConfigs/CardStyleInterpolators';
|
||||
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
||||
import type {
|
||||
Layout,
|
||||
StackHeaderMode,
|
||||
StackCardMode,
|
||||
StackDescriptorMap,
|
||||
StackNavigationOptions,
|
||||
@@ -60,7 +60,6 @@ type Props = {
|
||||
getGesturesEnabled: (props: { route: Route<string> }) => boolean;
|
||||
renderHeader: (props: HeaderContainerProps) => React.ReactNode;
|
||||
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||
headerMode: StackHeaderMode;
|
||||
isParentHeaderShown: boolean;
|
||||
onTransitionStart: (
|
||||
props: { route: Route<string> },
|
||||
@@ -108,13 +107,8 @@ const getHeaderHeights = (
|
||||
const height =
|
||||
typeof style.height === 'number' ? style.height : previous[curr.key];
|
||||
|
||||
const safeAreaInsets = {
|
||||
...insets,
|
||||
...options.safeAreaInsets,
|
||||
};
|
||||
|
||||
const {
|
||||
headerStatusBarHeight = isParentHeaderShown ? 0 : safeAreaInsets.top,
|
||||
headerStatusBarHeight = isParentHeaderShown ? 0 : insets.top,
|
||||
} = options;
|
||||
|
||||
acc[curr.key] =
|
||||
@@ -386,7 +380,6 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
getGesturesEnabled,
|
||||
renderHeader,
|
||||
renderScene,
|
||||
headerMode,
|
||||
isParentHeaderShown,
|
||||
onTransitionStart,
|
||||
onTransitionEnd,
|
||||
@@ -413,20 +406,6 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
let defaultTransitionPreset =
|
||||
mode === 'modal' ? ModalTransition : DefaultTransition;
|
||||
|
||||
if (headerMode !== 'float') {
|
||||
defaultTransitionPreset = {
|
||||
...defaultTransitionPreset,
|
||||
headerStyleInterpolator: forNoAnimationHeader,
|
||||
};
|
||||
}
|
||||
|
||||
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--) {
|
||||
@@ -444,54 +423,52 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const isFloatHeaderAbsolute =
|
||||
headerMode === 'float'
|
||||
? this.state.scenes.slice(-2).some((scene) => {
|
||||
const { descriptor } = scene;
|
||||
const options = descriptor ? descriptor.options : {};
|
||||
const { headerTransparent, headerShown = true } = options;
|
||||
const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some((scene) => {
|
||||
const options = scene.descriptor.options ?? {};
|
||||
const {
|
||||
headerMode = 'screen',
|
||||
headerTransparent,
|
||||
headerShown = true,
|
||||
} = options;
|
||||
|
||||
if (headerTransparent || headerShown === false) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
headerTransparent ||
|
||||
headerShown === false ||
|
||||
headerMode === 'screen'
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
: false;
|
||||
return false;
|
||||
});
|
||||
|
||||
const floatingHeader =
|
||||
headerMode === 'float' ? (
|
||||
<React.Fragment key="header">
|
||||
{renderHeader({
|
||||
mode: 'float',
|
||||
layout,
|
||||
insets: { top, right, bottom, left },
|
||||
scenes,
|
||||
getPreviousScene: this.getPreviousScene,
|
||||
getFocusedRoute: this.getFocusedRoute,
|
||||
onContentHeightChange: this.handleHeaderLayout,
|
||||
gestureDirection:
|
||||
focusedOptions.gestureDirection !== undefined
|
||||
? focusedOptions.gestureDirection
|
||||
: defaultTransitionPreset.gestureDirection,
|
||||
styleInterpolator:
|
||||
focusedOptions.headerStyleInterpolator !== undefined
|
||||
? focusedOptions.headerStyleInterpolator
|
||||
: defaultTransitionPreset.headerStyleInterpolator,
|
||||
style: [
|
||||
styles.floating,
|
||||
isFloatHeaderAbsolute && [
|
||||
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
||||
{ height: focusedHeaderHeight },
|
||||
styles.absolute,
|
||||
],
|
||||
const floatingHeader = (
|
||||
<React.Fragment key="header">
|
||||
{renderHeader({
|
||||
mode: 'float',
|
||||
layout,
|
||||
scenes,
|
||||
getPreviousScene: this.getPreviousScene,
|
||||
getFocusedRoute: this.getFocusedRoute,
|
||||
onContentHeightChange: this.handleHeaderLayout,
|
||||
styleInterpolator:
|
||||
focusedOptions.headerStyleInterpolator !== undefined
|
||||
? focusedOptions.headerStyleInterpolator
|
||||
: defaultTransitionPreset.headerStyleInterpolator,
|
||||
style: [
|
||||
styles.floating,
|
||||
isFloatHeaderAbsolute && [
|
||||
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
||||
{ height: focusedHeaderHeight },
|
||||
styles.absolute,
|
||||
],
|
||||
})}
|
||||
</React.Fragment>
|
||||
) : null;
|
||||
],
|
||||
})}
|
||||
</React.Fragment>
|
||||
);
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Background>
|
||||
{isFloatHeaderAbsolute ? null : floatingHeader}
|
||||
<MaybeScreenContainer
|
||||
enabled={detachInactiveScreens}
|
||||
@@ -540,9 +517,11 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
const {
|
||||
safeAreaInsets,
|
||||
headerShown = true,
|
||||
headerMode = 'screen',
|
||||
headerTransparent,
|
||||
headerStyle,
|
||||
headerTintColor,
|
||||
cardShadowEnabled,
|
||||
cardOverlayEnabled = Platform.OS !== 'ios' || mode === 'modal',
|
||||
cardOverlay,
|
||||
@@ -598,16 +577,27 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
top: safeAreaInsetTop = insets.top,
|
||||
right: safeAreaInsetRight = insets.right,
|
||||
bottom: safeAreaInsetBottom = insets.bottom,
|
||||
left: safeAreaInsetLeft = insets.left,
|
||||
} = safeAreaInsets || {};
|
||||
const safeAreaInsetTop = insets.top;
|
||||
const safeAreaInsetRight = insets.right;
|
||||
const safeAreaInsetBottom = insets.bottom;
|
||||
const safeAreaInsetLeft = insets.left;
|
||||
|
||||
const headerHeight =
|
||||
headerShown !== false ? headerHeights[route.key] : 0;
|
||||
|
||||
const { backgroundColor: headerBackgroundColor } =
|
||||
StyleSheet.flatten(headerStyle) || {};
|
||||
|
||||
let headerDarkContent: boolean | undefined;
|
||||
|
||||
if (headerShown) {
|
||||
if (headerTintColor) {
|
||||
headerDarkContent = Color(headerTintColor).isDark();
|
||||
} else if (typeof headerBackgroundColor === 'string') {
|
||||
headerDarkContent = !Color(headerBackgroundColor).isDark();
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<MaybeScreen
|
||||
key={route.key}
|
||||
@@ -647,7 +637,8 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
mode={mode}
|
||||
headerMode={headerMode}
|
||||
headerShown={headerShown}
|
||||
hasAbsoluteHeader={
|
||||
headerDarkContent={headerDarkContent}
|
||||
hasAbsoluteFloatHeader={
|
||||
isFloatHeaderAbsolute && !headerTransparent
|
||||
}
|
||||
renderHeader={renderHeader}
|
||||
@@ -665,7 +656,7 @@ export default class CardStack extends React.Component<Props, State> {
|
||||
})}
|
||||
</MaybeScreenContainer>
|
||||
{isFloatHeaderAbsolute ? floatingHeader : null}
|
||||
</React.Fragment>
|
||||
</Background>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet } from 'react-native';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import {
|
||||
SafeAreaInsetsContext,
|
||||
EdgeInsets,
|
||||
@@ -439,9 +439,6 @@ export default class StackView extends React.Component<Props, State> {
|
||||
navigation,
|
||||
keyboardHandlingEnabled,
|
||||
mode = 'card',
|
||||
headerMode = mode === 'card' && Platform.OS === 'ios'
|
||||
? 'float'
|
||||
: 'screen',
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
descriptors: _,
|
||||
...rest
|
||||
@@ -479,7 +476,6 @@ export default class StackView extends React.Component<Props, State> {
|
||||
onTransitionEnd={this.handleTransitionEnd}
|
||||
renderHeader={this.renderHeader}
|
||||
renderScene={this.renderScene}
|
||||
headerMode={headerMode}
|
||||
state={state}
|
||||
descriptors={descriptors}
|
||||
onGestureStart={this.handleGestureStart}
|
||||
|
||||
153
yarn.lock
153
yarn.lock
@@ -2003,6 +2003,26 @@
|
||||
xcode "^2.1.0"
|
||||
xml2js "^0.4.23"
|
||||
|
||||
"@expo/config-plugins@1.0.21":
|
||||
version "1.0.21"
|
||||
resolved "https://registry.yarnpkg.com/@expo/config-plugins/-/config-plugins-1.0.21.tgz#5a6f5c818dd7bccc2f3e381cbf8b0657c38bb302"
|
||||
integrity sha512-sMTF0/lx52ovJPz9iH5l0aKRpPFFtYoAQ+38AYhXI890Sswr1UU4Pq3IA5RMdvtOTkTzNREr21WvEHd7X8D1dA==
|
||||
dependencies:
|
||||
"@expo/config-types" "^40.0.0-beta.2"
|
||||
"@expo/configure-splash-screen" "0.3.4"
|
||||
"@expo/image-utils" "0.3.10"
|
||||
"@expo/json-file" "8.2.28-alpha.0"
|
||||
"@expo/plist" "0.0.11"
|
||||
find-up "~5.0.0"
|
||||
fs-extra "9.0.0"
|
||||
getenv "0.7.0"
|
||||
glob "7.1.6"
|
||||
resolve-from "^5.0.0"
|
||||
slash "^3.0.0"
|
||||
slugify "^1.3.4"
|
||||
xcode "^2.1.0"
|
||||
xml2js "^0.4.23"
|
||||
|
||||
"@expo/config-types@^40.0.0-beta.2":
|
||||
version "40.0.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@expo/config-types/-/config-types-40.0.0-beta.2.tgz#4fea4ef5654d02218b02b0b3772529a9ce5b0471"
|
||||
@@ -2046,6 +2066,26 @@
|
||||
semver "7.3.2"
|
||||
slugify "^1.3.4"
|
||||
|
||||
"@expo/config@3.3.31":
|
||||
version "3.3.31"
|
||||
resolved "https://registry.yarnpkg.com/@expo/config/-/config-3.3.31.tgz#6651a06230589bb93f031529537fd2b2b36e566e"
|
||||
integrity sha512-LRNWctdc9TI7C2BIrqShS97LT+Oe2TuazWh5uFdvxT1gMe7N4TslyLwaYHPiOgetukRtTAOP5+ekXXyc656VdA==
|
||||
dependencies:
|
||||
"@babel/core" "7.9.0"
|
||||
"@babel/plugin-proposal-class-properties" "~7.12.13"
|
||||
"@babel/preset-env" "~7.12.13"
|
||||
"@babel/preset-typescript" "~7.12.13"
|
||||
"@expo/config-plugins" "1.0.21"
|
||||
"@expo/config-types" "^40.0.0-beta.2"
|
||||
"@expo/json-file" "8.2.28-alpha.0"
|
||||
fs-extra "9.0.0"
|
||||
getenv "0.7.0"
|
||||
glob "7.1.6"
|
||||
require-from-string "^2.0.2"
|
||||
resolve-from "^5.0.0"
|
||||
semver "7.3.2"
|
||||
slugify "^1.3.4"
|
||||
|
||||
"@expo/configure-splash-screen@0.3.4":
|
||||
version "0.3.4"
|
||||
resolved "https://registry.yarnpkg.com/@expo/configure-splash-screen/-/configure-splash-screen-0.3.4.tgz#b91d8f08fd96272bd3d7aaa9b51d6189b932c7cc"
|
||||
@@ -2062,24 +2102,24 @@
|
||||
xcode "^3.0.0"
|
||||
xml-js "^1.6.11"
|
||||
|
||||
"@expo/dev-server@0.1.56":
|
||||
version "0.1.56"
|
||||
resolved "https://registry.yarnpkg.com/@expo/dev-server/-/dev-server-0.1.56.tgz#010fc8552f8d98d2b56137c000151d531d559b0a"
|
||||
integrity sha512-BXKJW6KB7AckjJkDIM4mmuMhbiP9GQtmfsNoEsXg9Ci1NxJxu4vc/UdaL4tC+SLlDNpKgSIBvSNDY0AdPKUAeA==
|
||||
"@expo/dev-server@0.1.57":
|
||||
version "0.1.57"
|
||||
resolved "https://registry.yarnpkg.com/@expo/dev-server/-/dev-server-0.1.57.tgz#9c4af2efc591dd3093fbf14123c51c415e601cf3"
|
||||
integrity sha512-0N5RArNt1qnkGbUqW2MWC4+FlxbyVuzn2e/QeICBq6mdSC+LT+J0jatbpSGD7Mk76tZtDGduHQBR0MA9Vdqgew==
|
||||
dependencies:
|
||||
"@expo/bunyan" "4.0.0"
|
||||
"@expo/metro-config" "0.1.56"
|
||||
"@expo/metro-config" "0.1.57"
|
||||
"@react-native-community/cli-server-api" "4.9.0"
|
||||
body-parser "1.19.0"
|
||||
resolve-from "^5.0.0"
|
||||
serialize-error "6.0.0"
|
||||
|
||||
"@expo/dev-tools@0.13.84":
|
||||
version "0.13.84"
|
||||
resolved "https://registry.yarnpkg.com/@expo/dev-tools/-/dev-tools-0.13.84.tgz#f9fd737c228aca17d777f88dcc76e2ee1af08183"
|
||||
integrity sha512-HmN5Gb+uSpLxIhHKjPgRSLZaAEJW8UmV6h2eQmVUrpc+VoT0M4roCHd50xJQv+OqLllgo9ZmmyWHnNckOd+RJA==
|
||||
"@expo/dev-tools@0.13.85":
|
||||
version "0.13.85"
|
||||
resolved "https://registry.yarnpkg.com/@expo/dev-tools/-/dev-tools-0.13.85.tgz#c5739202340ed75dfc892294d378923eb959dbb0"
|
||||
integrity sha512-brTPqUyk+J+jYrwupCcTDEXXpmQ2cDVYd9tDvpKLZGj8VnuUj2u2miAeJc4rSiKE+N6YYeRwJRF7gghd2NBVkw==
|
||||
dependencies:
|
||||
"@expo/config" "3.3.30"
|
||||
"@expo/config" "3.3.31"
|
||||
base64url "3.0.1"
|
||||
express "4.16.4"
|
||||
freeport-async "2.0.0"
|
||||
@@ -2146,12 +2186,12 @@
|
||||
json5 "^1.0.1"
|
||||
write-file-atomic "^2.3.0"
|
||||
|
||||
"@expo/metro-config@0.1.56":
|
||||
version "0.1.56"
|
||||
resolved "https://registry.yarnpkg.com/@expo/metro-config/-/metro-config-0.1.56.tgz#b200397b765f002d2101079f2df1e41f45d41697"
|
||||
integrity sha512-h7IBc8GWzqKhdv2OWqU9tU3i5ZMpoXU1gao+kZzvi02dEAV5GzKxvGPiZu9nsvXeeRlCIpzTHvzFPh5n5mtSnA==
|
||||
"@expo/metro-config@0.1.57":
|
||||
version "0.1.57"
|
||||
resolved "https://registry.yarnpkg.com/@expo/metro-config/-/metro-config-0.1.57.tgz#ac06d55fc0bc79e126278be25a3a50e81004a252"
|
||||
integrity sha512-SyUDmjIpSy5DE0h32ckdVwB0XbB8jgbbW28MYILUASSLzfC3DmaOqdcNl18jIaewG5hw2eHc2gikd/0TwLN2Vw==
|
||||
dependencies:
|
||||
"@expo/config" "3.3.30"
|
||||
"@expo/config" "3.3.31"
|
||||
chalk "^4.1.0"
|
||||
getenv "^0.7.0"
|
||||
metro-react-native-babel-transformer "^0.59.0"
|
||||
@@ -2248,7 +2288,47 @@
|
||||
lodash.pick "^4.4.0"
|
||||
lodash.template "^4.5.0"
|
||||
|
||||
"@expo/webpack-config@0.12.60", "@expo/webpack-config@~0.12.60":
|
||||
"@expo/webpack-config@0.12.61":
|
||||
version "0.12.61"
|
||||
resolved "https://registry.yarnpkg.com/@expo/webpack-config/-/webpack-config-0.12.61.tgz#f378945b164a85b8c094fe21844499d0edaf2e1a"
|
||||
integrity sha512-Ymx+DiBtBIo8+PoJ+dw1QEhgvGfJZvRUAIQ6JLxVPzApHMg6J0UUCrtWYByC8+Ax8QcrdSFjphoCGcFfL45/9w==
|
||||
dependencies:
|
||||
"@babel/core" "7.9.0"
|
||||
"@babel/runtime" "7.9.0"
|
||||
"@expo/config" "3.3.31"
|
||||
"@pmmmwh/react-refresh-webpack-plugin" "^0.3.3"
|
||||
babel-loader "8.1.0"
|
||||
chalk "^4.0.0"
|
||||
clean-webpack-plugin "^3.0.0"
|
||||
copy-webpack-plugin "~6.0.3"
|
||||
css-loader "~3.6.0"
|
||||
expo-pwa "0.0.67"
|
||||
file-loader "~6.0.0"
|
||||
find-yarn-workspace-root "~2.0.0"
|
||||
getenv "^0.7.0"
|
||||
html-loader "~1.1.0"
|
||||
html-webpack-plugin "~4.3.0"
|
||||
is-wsl "^2.0.0"
|
||||
mini-css-extract-plugin "^0.5.0"
|
||||
node-html-parser "^1.2.12"
|
||||
optimize-css-assets-webpack-plugin "^5.0.3"
|
||||
pnp-webpack-plugin "^1.5.0"
|
||||
postcss-safe-parser "^4.0.2"
|
||||
progress "^2.0.3"
|
||||
react-dev-utils "~11.0.1"
|
||||
react-refresh "^0.8.2"
|
||||
semver "~7.3.2"
|
||||
style-loader "~1.2.1"
|
||||
terser-webpack-plugin "^3.0.6"
|
||||
url-loader "~4.1.0"
|
||||
webpack "4.43.0"
|
||||
webpack-deep-scope-plugin "1.6.0"
|
||||
webpack-manifest-plugin "~2.2.0"
|
||||
webpackbar "^4.0.0"
|
||||
workbox-webpack-plugin "^3.6.3"
|
||||
worker-loader "^2.0.0"
|
||||
|
||||
"@expo/webpack-config@~0.12.60":
|
||||
version "0.12.60"
|
||||
resolved "https://registry.yarnpkg.com/@expo/webpack-config/-/webpack-config-0.12.60.tgz#382a12b6a256a6cd8528f9969672c5d308ca370e"
|
||||
integrity sha512-UieL5oLo4rm0jNx/Gzz6gs4fZ37THSdptvy4dQFsHGQrvZgxd1lCHEe4NNv56/Zs3H/FrX7vczpZ2fwS/LXvmQ==
|
||||
@@ -2299,14 +2379,14 @@
|
||||
pouchdb-collections "^1.0.1"
|
||||
tiny-queue "^0.2.1"
|
||||
|
||||
"@expo/xdl@59.0.24":
|
||||
version "59.0.24"
|
||||
resolved "https://registry.yarnpkg.com/@expo/xdl/-/xdl-59.0.24.tgz#b84d3c41ca223b3a5cf9a62dfc8e35e3bcdf0426"
|
||||
integrity sha512-rl0lJ3z4v0VPu8Z37Vl2sTYSupAVjD6MxUHAJd+FRKgQMb7kyJUTpWvBAlbYCgMM+WH5XZZSvgWdwCTLocwPtw==
|
||||
"@expo/xdl@59.0.25":
|
||||
version "59.0.25"
|
||||
resolved "https://registry.yarnpkg.com/@expo/xdl/-/xdl-59.0.25.tgz#f6f5ddaf1292b5ae40e08cfeabb8d91e82c33b8e"
|
||||
integrity sha512-can8RKDHBAq8NtGMbg25EmJ2RexJJhefTvvIQec4B6aWrydBYzRa2O//zFBP4VX56DyuwajPOk5gLejWEWeHNw==
|
||||
dependencies:
|
||||
"@expo/bunyan" "4.0.0"
|
||||
"@expo/config" "3.3.30"
|
||||
"@expo/dev-server" "0.1.56"
|
||||
"@expo/config" "3.3.31"
|
||||
"@expo/dev-server" "0.1.57"
|
||||
"@expo/devcert" "^1.0.0"
|
||||
"@expo/json-file" "8.2.28-alpha.0"
|
||||
"@expo/osascript" "2.0.24"
|
||||
@@ -2314,7 +2394,7 @@
|
||||
"@expo/plist" "0.0.11"
|
||||
"@expo/schemer" "1.3.27-alpha.0"
|
||||
"@expo/spawn-async" "1.5.0"
|
||||
"@expo/webpack-config" "0.12.60"
|
||||
"@expo/webpack-config" "0.12.61"
|
||||
"@hapi/joi" "^17.1.1"
|
||||
"@types/text-table" "^0.2.1"
|
||||
analytics-node "3.5.0"
|
||||
@@ -8874,16 +8954,16 @@ expo-blur@~9.0.0:
|
||||
resolved "https://registry.yarnpkg.com/expo-blur/-/expo-blur-9.0.0.tgz#6447a65dba3f14532406d9c5227622b3e7d1abf7"
|
||||
integrity sha512-zqZENclTYBtVAZOsnDROT5PQ9MbMxa5A36J+aU2NiV6MqLYlUh/b/FnR0JPAuY4F6jS6U7sYiAlStzIXpLd7XQ==
|
||||
|
||||
expo-cli@^4.2.1:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/expo-cli/-/expo-cli-4.2.1.tgz#6e17ef32e3485b19ab8f89c06b2a42b2fe0b5281"
|
||||
integrity sha512-3qgir7nj1jD7L+ETEUBYQfwsd57GaOTLhJ+6rzwvRwSXdU04oM+nfiZHMyabgKHMzslyHpVnvOod9OjKVWTtuQ==
|
||||
expo-cli@^4.3.0:
|
||||
version "4.3.0"
|
||||
resolved "https://registry.yarnpkg.com/expo-cli/-/expo-cli-4.3.0.tgz#d31106689ed1b95d7b8cd6e62578d121475da0ea"
|
||||
integrity sha512-JZTWP7YajZD48VDAMqDmT7cLDqi+9blR/WzTXDlgiUgjYANYPAC8eMZxyuOnEvt0d9hSfEKuq1/mknUogXgjNA==
|
||||
dependencies:
|
||||
"@expo/apple-utils" "0.0.0-alpha.17"
|
||||
"@expo/bunyan" "4.0.0"
|
||||
"@expo/config" "3.3.30"
|
||||
"@expo/config-plugins" "1.0.20"
|
||||
"@expo/dev-tools" "0.13.84"
|
||||
"@expo/config" "3.3.31"
|
||||
"@expo/config-plugins" "1.0.21"
|
||||
"@expo/dev-tools" "0.13.85"
|
||||
"@expo/json-file" "8.2.28-alpha.0"
|
||||
"@expo/osascript" "2.0.24"
|
||||
"@expo/package-manager" "0.0.39-alpha.0"
|
||||
@@ -8891,7 +8971,7 @@ expo-cli@^4.2.1:
|
||||
"@expo/results" "^1.0.0"
|
||||
"@expo/simple-spinner" "1.0.2"
|
||||
"@expo/spawn-async" "1.5.0"
|
||||
"@expo/xdl" "59.0.24"
|
||||
"@expo/xdl" "59.0.25"
|
||||
"@hapi/joi" "^17.1.1"
|
||||
babel-runtime "6.26.0"
|
||||
base32.js "0.1.0"
|
||||
@@ -9027,6 +9107,17 @@ expo-pwa@0.0.66:
|
||||
commander "2.20.0"
|
||||
update-check "1.5.3"
|
||||
|
||||
expo-pwa@0.0.67:
|
||||
version "0.0.67"
|
||||
resolved "https://registry.yarnpkg.com/expo-pwa/-/expo-pwa-0.0.67.tgz#035a3b05dcd78311a0841e6193daf034ca51cd7c"
|
||||
integrity sha512-fyp624qENbSSDkW7So9Je5kDmCKf51leHqvO4Oqro2Yfv58XYJqv/j3MGMXd8rnraTJ0ktsfy0rSwA5/tqpmrQ==
|
||||
dependencies:
|
||||
"@expo/config" "3.3.31"
|
||||
"@expo/image-utils" "0.3.10"
|
||||
chalk "^4.0.0"
|
||||
commander "2.20.0"
|
||||
update-check "1.5.3"
|
||||
|
||||
expo-secure-store@~9.3.0:
|
||||
version "9.3.0"
|
||||
resolved "https://registry.yarnpkg.com/expo-secure-store/-/expo-secure-store-9.3.0.tgz#b716d5d115cc50a34037d1afef84fe4b8ea0745c"
|
||||
|
||||
Reference in New Issue
Block a user