mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-14 09:32:32 +08:00
Compare commits
6 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd5f355bd0 | ||
|
|
cab616069f | ||
|
|
f90e00cc93 | ||
|
|
731cf7d5b1 | ||
|
|
c6d0c19b49 | ||
|
|
442b95d9e4 |
@@ -3,6 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.15](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.14...@react-navigation/drawer@5.0.0-alpha.15) (2019-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix passing content options in drawer ([cab6160](https://github.com/react-navigation/navigation-ex/commit/cab6160))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.14](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.13...@react-navigation/drawer@5.0.0-alpha.14) (2019-10-15)
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"material",
|
||||
"drawer"
|
||||
],
|
||||
"version": "5.0.0-alpha.14",
|
||||
"version": "5.0.0-alpha.15",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -136,6 +136,7 @@ export default class DrawerView extends React.PureComponent<Props, State> {
|
||||
descriptors,
|
||||
drawerPosition,
|
||||
contentComponent: ContentComponent,
|
||||
contentOptions,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@@ -145,6 +146,7 @@ export default class DrawerView extends React.PureComponent<Props, State> {
|
||||
navigation={navigation}
|
||||
descriptors={descriptors}
|
||||
drawerPosition={drawerPosition}
|
||||
{...contentOptions}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.14](https://github.com/satya164/navigation-ex/compare/@react-navigation/example@5.0.0-alpha.13...@react-navigation/example@5.0.0-alpha.14) (2019-10-17)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/example
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.13](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/example@5.0.0-alpha.12...@react-navigation/example@5.0.0-alpha.13) (2019-10-15)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/example",
|
||||
"description": "Demo app to showcase various functionality of React Navigation",
|
||||
"version": "5.0.0-alpha.13",
|
||||
"version": "5.0.0-alpha.14",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"nohoist": [
|
||||
@@ -27,7 +27,7 @@
|
||||
"react-dom": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-gesture-handler": "~1.3.0",
|
||||
"react-native-paper": "^3.0.0-alpha.3",
|
||||
"react-native-paper": "^3.0.0-alpha.7",
|
||||
"react-native-reanimated": "~1.2.0",
|
||||
"react-native-safe-area-context": "~0.3.6",
|
||||
"react-native-screens": "2.0.0-alpha.4",
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.14](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.13...@react-navigation/material-bottom-tabs@5.0.0-alpha.14) (2019-10-17)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.13](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.12...@react-navigation/material-bottom-tabs@5.0.0-alpha.13) (2019-10-15)
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"material",
|
||||
"tab"
|
||||
],
|
||||
"version": "5.0.0-alpha.13",
|
||||
"version": "5.0.0-alpha.14",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -44,7 +44,7 @@
|
||||
"del-cli": "^3.0.0",
|
||||
"react": "~16.8.3",
|
||||
"react-native": "~0.59.10",
|
||||
"react-native-paper": "^3.0.0-alpha.3",
|
||||
"react-native-paper": "^3.0.0-alpha.7",
|
||||
"react-native-vector-icons": "^6.6.0",
|
||||
"typescript": "^3.6.3"
|
||||
},
|
||||
@@ -52,7 +52,7 @@
|
||||
"@react-navigation/core": "^5.0.0-alpha.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-native-paper": "^3.0.0-alpha.3",
|
||||
"react-native-paper": "^3.0.0-alpha.0",
|
||||
"react-native-vector-icons": "^6.0.0"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
|
||||
@@ -96,6 +96,16 @@ export type MaterialBottomTabDescriptorMap = {
|
||||
export type MaterialBottomTabNavigationConfig = Partial<
|
||||
Omit<
|
||||
React.ComponentProps<typeof BottomNavigation>,
|
||||
'navigationState' | 'onIndexChange' | 'renderScene'
|
||||
| 'navigationState'
|
||||
| 'onIndexChange'
|
||||
| 'onTabPress'
|
||||
| 'renderScene'
|
||||
| 'renderLabel'
|
||||
| 'renderIcon'
|
||||
| 'getAccessibilityLabel'
|
||||
| 'getBadge'
|
||||
| 'getColor'
|
||||
| 'getLabelText'
|
||||
| 'getTestID'
|
||||
>
|
||||
>;
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as React from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import { BottomNavigation } from 'react-native-paper';
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { Route } from '@react-navigation/core';
|
||||
import { TabNavigationState, TabActions } from '@react-navigation/routers';
|
||||
|
||||
import {
|
||||
@@ -17,7 +16,7 @@ type Props = MaterialBottomTabNavigationConfig & {
|
||||
descriptors: MaterialBottomTabDescriptorMap;
|
||||
};
|
||||
|
||||
type Scene = { route: Route<string> };
|
||||
type Scene = { route: { key: string } };
|
||||
|
||||
export default class MaterialBottomTabView extends React.PureComponent<Props> {
|
||||
private getColor = ({ route }: Scene) => {
|
||||
@@ -35,7 +34,7 @@ export default class MaterialBottomTabView extends React.PureComponent<Props> {
|
||||
? options.tabBarLabel
|
||||
: typeof options.title === 'string'
|
||||
? options.title
|
||||
: route.name;
|
||||
: ((route as any) as { name: string }).name;
|
||||
};
|
||||
|
||||
private getAccessibilityLabel = ({ route }: Scene) => {
|
||||
@@ -49,9 +48,9 @@ export default class MaterialBottomTabView extends React.PureComponent<Props> {
|
||||
const label = this.getLabelText({ route });
|
||||
|
||||
if (typeof label === 'string') {
|
||||
return `${label}, tab, ${state.routes.indexOf(route) + 1} of ${
|
||||
state.routes.length
|
||||
}`;
|
||||
return `${label}, tab, ${state.routes.findIndex(
|
||||
r => r.key === route.key
|
||||
) + 1} of ${state.routes.length}`;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -75,7 +74,7 @@ export default class MaterialBottomTabView extends React.PureComponent<Props> {
|
||||
focused,
|
||||
color,
|
||||
}: {
|
||||
route: Route<string>;
|
||||
route: { key: string };
|
||||
focused: boolean;
|
||||
color: string;
|
||||
}) => {
|
||||
@@ -114,7 +113,7 @@ export default class MaterialBottomTabView extends React.PureComponent<Props> {
|
||||
target: state.key,
|
||||
})
|
||||
}
|
||||
renderScene={({ route }: Scene) => descriptors[route.key].render()}
|
||||
renderScene={({ route }) => descriptors[route.key].render()}
|
||||
renderIcon={this.renderIcon}
|
||||
getLabelText={this.getLabelText}
|
||||
getColor={this.getColor}
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [5.0.0-alpha.26](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.25...@react-navigation/stack@5.0.0-alpha.26) (2019-10-17)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* don't fade incoming background when fading header ([#127](https://github.com/react-navigation/navigation-ex/issues/127)) ([c6d0c19](https://github.com/react-navigation/navigation-ex/commit/c6d0c19))
|
||||
* fix incorrect type ([731cf7d](https://github.com/react-navigation/navigation-ex/commit/731cf7d))
|
||||
* use header height from style if specified ([442b95d](https://github.com/react-navigation/navigation-ex/commit/442b95d))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [5.0.0-alpha.25](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.24...@react-navigation/stack@5.0.0-alpha.25) (2019-10-15)
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"android",
|
||||
"stack"
|
||||
],
|
||||
"version": "5.0.0-alpha.25",
|
||||
"version": "5.0.0-alpha.26",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
@@ -109,7 +109,7 @@ export function forFade({
|
||||
leftButtonStyle: { opacity },
|
||||
rightButtonStyle: { opacity },
|
||||
titleStyle: { opacity },
|
||||
backgroundStyle: { opacity },
|
||||
backgroundStyle: { opacity: current.progress },
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });
|
||||
const getFloatingHeaderHeights = (
|
||||
routes: Route<string>[],
|
||||
insets: EdgeInsets,
|
||||
descriptors: StackDescriptorMap,
|
||||
layout: Layout,
|
||||
previous: { [key: string]: number }
|
||||
) => {
|
||||
@@ -124,7 +125,12 @@ const getFloatingHeaderHeights = (
|
||||
|
||||
return routes.reduce(
|
||||
(acc, curr) => {
|
||||
acc[curr.key] = previous[curr.key] || defaultHeaderHeight;
|
||||
const { options = {} } = descriptors[curr.key] || {};
|
||||
const { height = previous[curr.key] } = StyleSheet.flatten(
|
||||
options.headerStyle || {}
|
||||
);
|
||||
|
||||
acc[curr.key] = typeof height === 'number' ? height : defaultHeaderHeight;
|
||||
|
||||
return acc;
|
||||
},
|
||||
@@ -141,24 +147,21 @@ export default class Stack extends React.Component<Props, State> {
|
||||
return null;
|
||||
}
|
||||
|
||||
const progress = props.routes.reduce(
|
||||
(acc, curr) => {
|
||||
const descriptor = props.descriptors[curr.key];
|
||||
const progress = props.routes.reduce<ProgressValues>((acc, curr) => {
|
||||
const descriptor = props.descriptors[curr.key];
|
||||
|
||||
acc[curr.key] =
|
||||
state.progress[curr.key] ||
|
||||
new Animated.Value(
|
||||
props.openingRouteKeys.includes(curr.key) &&
|
||||
descriptor &&
|
||||
descriptor.options.animationEnabled !== false
|
||||
? 0
|
||||
: 1
|
||||
);
|
||||
acc[curr.key] =
|
||||
state.progress[curr.key] ||
|
||||
new Animated.Value(
|
||||
props.openingRouteKeys.includes(curr.key) &&
|
||||
descriptor &&
|
||||
descriptor.options.animationEnabled !== false
|
||||
? 0
|
||||
: 1
|
||||
);
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as ProgressValues
|
||||
);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return {
|
||||
routes: props.routes,
|
||||
@@ -205,6 +208,7 @@ export default class Stack extends React.Component<Props, State> {
|
||||
floatingHeaderHeights: getFloatingHeaderHeights(
|
||||
props.routes,
|
||||
props.insets,
|
||||
state.descriptors,
|
||||
state.layout,
|
||||
state.floatingHeaderHeights
|
||||
),
|
||||
@@ -237,15 +241,16 @@ export default class Stack extends React.Component<Props, State> {
|
||||
|
||||
const layout = { width, height };
|
||||
|
||||
this.setState({
|
||||
this.setState(state => ({
|
||||
layout,
|
||||
floatingHeaderHeights: getFloatingHeaderHeights(
|
||||
this.props.routes,
|
||||
this.props.insets,
|
||||
state.descriptors,
|
||||
layout,
|
||||
{}
|
||||
),
|
||||
});
|
||||
}));
|
||||
};
|
||||
|
||||
private handleFloatingHeaderLayout = ({
|
||||
|
||||
@@ -53,14 +53,14 @@ class StackView extends React.Component<Props, State> {
|
||||
// If there was no change in routes, we don't need to compute anything
|
||||
if (props.state.routes === state.previousRoutes && state.routes.length) {
|
||||
if (props.descriptors !== state.previousDescriptors) {
|
||||
const descriptors = state.routes.reduce(
|
||||
const descriptors = state.routes.reduce<StackDescriptorMap>(
|
||||
(acc, route) => {
|
||||
acc[route.key] =
|
||||
props.descriptors[route.key] || state.descriptors[route.key];
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as StackDescriptorMap
|
||||
{}
|
||||
);
|
||||
|
||||
return {
|
||||
@@ -195,15 +195,12 @@ class StackView extends React.Component<Props, State> {
|
||||
throw new Error(`There should always be at least one route.`);
|
||||
}
|
||||
|
||||
const descriptors = routes.reduce(
|
||||
(acc, route) => {
|
||||
acc[route.key] =
|
||||
props.descriptors[route.key] || state.descriptors[route.key];
|
||||
const descriptors = routes.reduce<StackDescriptorMap>((acc, route) => {
|
||||
acc[route.key] =
|
||||
props.descriptors[route.key] || state.descriptors[route.key];
|
||||
|
||||
return acc;
|
||||
},
|
||||
{} as StackDescriptorMap
|
||||
);
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return {
|
||||
routes,
|
||||
|
||||
27
yarn.lock
27
yarn.lock
@@ -864,12 +864,11 @@
|
||||
lodash "^4.17.13"
|
||||
to-fast-properties "^2.0.0"
|
||||
|
||||
"@callstack/react-theme-provider@^3.0.2":
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/@callstack/react-theme-provider/-/react-theme-provider-3.0.3.tgz#f964dda28cd6e731c3fbcf916b0579c6f9fb2db7"
|
||||
integrity sha512-B+9JBK7zsND/AdVkjwHvbb4cR05fJofLFG30hOeoXke8WkKAWN36yFljauAhI8qwlXlGFGZMYE1wQvsqBSccrA==
|
||||
"@callstack/react-theme-provider@^3.0.5":
|
||||
version "3.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@callstack/react-theme-provider/-/react-theme-provider-3.0.5.tgz#a173e455e9603c9c45357a3b6ace1273086527ca"
|
||||
integrity sha512-Iec+ybWN0FvNj87sD3oWo/49edGUP0UOSdMnzCJEFJIDYr992ECIuOV89burAAh2/ibPCxgLiK6dmgv2mO/8Tg==
|
||||
dependencies:
|
||||
"@types/hoist-non-react-statics" "^3.3.1"
|
||||
deepmerge "^3.2.0"
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
|
||||
@@ -2530,14 +2529,6 @@
|
||||
"@types/minimatch" "*"
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/hoist-non-react-statics@^3.3.1":
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz#1124aafe5118cb591977aeb1ceaaed1070eb039f"
|
||||
integrity sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
|
||||
"@types/http-proxy-middleware@*":
|
||||
version "0.19.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/http-proxy-middleware/-/http-proxy-middleware-0.19.3.tgz#b2eb96fbc0f9ac7250b5d9c4c53aade049497d03"
|
||||
@@ -13111,12 +13102,12 @@ react-native-gesture-handler@~1.3.0:
|
||||
invariant "^2.2.2"
|
||||
prop-types "^15.5.10"
|
||||
|
||||
react-native-paper@^3.0.0-alpha.3:
|
||||
version "3.0.0-alpha.5"
|
||||
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-3.0.0-alpha.5.tgz#2a3e23c52ec717d7c6a1df1e7adc1005611b08a2"
|
||||
integrity sha512-LSsmhCIo2EgT9azd1usjBmfGBgNkKOMdHWkFJnwmGrXo/JMxhlD/KMt+GRTz4ZjFWmJu3GO635ihYleSJhW6Mg==
|
||||
react-native-paper@^3.0.0-alpha.7:
|
||||
version "3.0.0-alpha.7"
|
||||
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-3.0.0-alpha.7.tgz#fbbfe5dc9ef8dbd18932786aa3d7f0479501538b"
|
||||
integrity sha512-tjqewrUMnucLM4yqMiVtCOnrqilnvDDNr2guIImwsUpJ6HWaJKBEFKqB25SEdMvuo88MWSdA0gyRNtS3WRpS3w==
|
||||
dependencies:
|
||||
"@callstack/react-theme-provider" "^3.0.2"
|
||||
"@callstack/react-theme-provider" "^3.0.5"
|
||||
color "^3.1.2"
|
||||
react-native-safe-area-view "^0.12.0"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user