Compare commits

..

3 Commits

Author SHA1 Message Date
Satyajit Sahoo
ed7ffb98f4 chore: publish
- react-navigation-animated-switch@0.5.11
 - react-navigation-drawer@2.4.12
 - react-navigation-material-bottom-tabs@2.2.11
 - @react-navigation/native@3.7.12
 - react-navigation@4.3.8
 - react-navigation-stack@2.3.13
 - react-navigation-tabs@2.8.12
2020-04-22 16:47:35 +02:00
Satyajit Sahoo
90eff6a5e2 chore: sync latest stack 2020-04-22 16:45:32 +02:00
Satyajit Sahoo
b4691d7de2 chore: update react-native-safe-area-view 2020-04-22 16:31:49 +02:00
21 changed files with 249 additions and 146 deletions

View File

@@ -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.
## [0.5.11](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.10...react-navigation-animated-switch@0.5.11) (2020-04-22)
**Note:** Version bump only for package react-navigation-animated-switch
## [0.5.10](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.9...react-navigation-animated-switch@0.5.10) (2020-04-02)
**Note:** Version bump only for package react-navigation-animated-switch

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-animated-switch",
"version": "0.5.10",
"version": "0.5.11",
"description": "Animated switch for React Navigation",
"main": "lib/commonjs/index.js",
"react-native": "lib/module/index.js",
@@ -28,7 +28,7 @@
"react": "~16.9.0",
"react-native": "~0.61.5",
"react-native-reanimated": "~1.7.0",
"react-navigation": "^4.3.7",
"react-navigation": "^4.3.8",
"typescript": "~3.8.3"
},
"peerDependencies": {

View File

@@ -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.
## [2.4.12](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.11...react-navigation-drawer@2.4.12) (2020-04-22)
**Note:** Version bump only for package react-navigation-drawer
## [2.4.11](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.10...react-navigation-drawer@2.4.11) (2020-04-02)
**Note:** Version bump only for package react-navigation-drawer

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-drawer",
"version": "2.4.11",
"version": "2.4.12",
"description": "Drawer navigator component for React Navigation",
"main": "lib/commonjs/index.js",
"react-native": "lib/module/index.js",
@@ -49,7 +49,7 @@
"react-native-reanimated": "^1.2.0",
"react-native-screens": "^2.3.0",
"react-native-testing-library": "^1.12.0",
"react-navigation": "^4.3.7",
"react-navigation": "^4.3.8",
"typescript": "~3.8.3"
},
"peerDependencies": {

View File

@@ -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.
## [2.2.11](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.10...react-navigation-material-bottom-tabs@2.2.11) (2020-04-22)
**Note:** Version bump only for package react-navigation-material-bottom-tabs
## [2.2.10](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.9...react-navigation-material-bottom-tabs@2.2.10) (2020-04-02)
**Note:** Version bump only for package react-navigation-material-bottom-tabs

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-material-bottom-tabs",
"version": "2.2.10",
"version": "2.2.11",
"description": "Material Bottom Tab Navigation component for React Navigation",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
@@ -48,7 +48,7 @@
"react-native-gesture-handler": "^1.6.0",
"react-native-paper": "^3.1.1",
"react-native-reanimated": "^1.2.0",
"react-navigation": "^4.3.7",
"react-navigation": "^4.3.8",
"typescript": "~3.8.3"
},
"peerDependencies": {

View File

@@ -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.
## [3.7.12](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.11...@react-navigation/native@3.7.12) (2020-04-22)
**Note:** Version bump only for package @react-navigation/native
## [3.7.11](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.10...@react-navigation/native@3.7.11) (2020-04-02)
**Note:** Version bump only for package @react-navigation/native

View File

@@ -1,6 +1,6 @@
{
"name": "@react-navigation/native",
"version": "3.7.11",
"version": "3.7.12",
"description": "React Native support for React Navigation",
"main": "lib/commonjs/index.js",
"react-native": "lib/module/index.js",
@@ -36,7 +36,7 @@
"homepage": "https://github.com/react-navigation/react-navigation-native#readme",
"dependencies": {
"hoist-non-react-statics": "^3.3.2",
"react-native-safe-area-view": "^0.14.8"
"react-native-safe-area-view": "^0.14.9"
},
"devDependencies": {
"@react-native-community/bob": "^0.10.0",

View File

@@ -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.
## [4.3.8](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.7...react-navigation@4.3.8) (2020-04-22)
**Note:** Version bump only for package react-navigation
## [4.3.7](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.6...react-navigation@4.3.7) (2020-04-02)
**Note:** Version bump only for package react-navigation

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation",
"version": "4.3.7",
"version": "4.3.8",
"description": "Routing and navigation for your React Native apps",
"main": "src/index.js",
"types": "typescript/react-navigation.d.ts",
@@ -25,7 +25,7 @@
},
"dependencies": {
"@react-navigation/core": "^3.7.5",
"@react-navigation/native": "^3.7.11"
"@react-navigation/native": "^3.7.12"
},
"devDependencies": {
"@types/react": "^16.9.23",

View File

@@ -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.
## [2.3.13](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.12...react-navigation-stack@2.3.13) (2020-04-22)
**Note:** Version bump only for package react-navigation-stack
## [2.3.12](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.11...react-navigation-stack@2.3.12) (2020-04-17)

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-stack",
"version": "2.3.12",
"version": "2.3.13",
"description": "Stack navigator component for React Navigation",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
@@ -45,7 +45,7 @@
"devDependencies": {
"@react-native-community/bob": "^0.10.0",
"@react-native-community/masked-view": "^0.1.7",
"@react-navigation/stack": "^5.2.11",
"@react-navigation/stack": "^5.2.12",
"@types/color": "^3.0.1",
"@types/react": "^16.9.23",
"@types/react-native": "^0.61.22",
@@ -56,7 +56,7 @@
"react-native-gesture-handler": "^1.6.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.3.0",
"react-navigation": "^4.3.7",
"react-navigation": "^4.3.8",
"react-test-renderer": "~16.9.0",
"typescript": "~3.8.3"
},

View File

@@ -1,6 +1,6 @@
diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/index.tsx 2020-04-18 01:41:48.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/index.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -3,11 +3,6 @@
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
@@ -27,7 +27,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/i
StackHeaderLeftButtonProps,
StackHeaderTitleProps,
diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-04-18 01:38:52.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.000000000 +0100
@@ -1,96 +0,0 @@
-import * as React from 'react';
@@ -127,8 +127,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
- typeof StackNavigator
->(StackNavigator);
diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/types.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/types.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -8,14 +8,28 @@
} from 'react-native';
import { EdgeInsets } from 'react-native-safe-area-context';
@@ -254,8 +254,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
export type StackNavigationConfig = {
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/Header.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/Header.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -1,12 +1,14 @@
import * as React from 'react';
-import { StackActions } from '@react-navigation/native';
@@ -335,8 +335,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
+
+export default Header;
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -8,9 +8,9 @@
StyleSheet,
LayoutChangeEvent,
@@ -349,8 +349,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
type Props = StackHeaderLeftButtonProps;
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
@@ -360,8 +360,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
type Props = ViewProps & {
children?: React.ReactNode;
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -1,11 +1,6 @@
import * as React from 'react';
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
@@ -413,8 +413,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
);
})}
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx src/vendor/views/Header/HeaderSegment.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -8,7 +8,7 @@
ViewStyle,
} from 'react-native';
@@ -434,8 +434,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSeg
};
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx src/vendor/views/Header/HeaderTitle.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -1,6 +1,6 @@
import * as React from 'react';
import { Animated, StyleSheet, Platform } from 'react-native';
@@ -445,8 +445,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTit
type Props = React.ComponentProps<typeof Animated.Text> & {
tintColor?: string;
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Stack/Card.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Stack/Card.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -138,7 +138,7 @@
private interactionHandle: number | undefined;
@@ -457,8 +457,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx s
private animate = ({
closing,
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx src/vendor/views/Stack/CardContainer.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Stack/CardContainer.tsx 2020-04-18 01:39:36.000000000 +0200
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Stack/CardContainer.tsx 2020-04-22 16:34:39.000000000 +0200
@@ -1,10 +1,16 @@
import * as React from 'react';
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
@@ -488,20 +488,18 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
>
<View style={styles.container}>
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Stack/CardStack.tsx 2020-04-18 01:39:36.000000000 +0200
@@ -9,9 +9,8 @@
ViewProps,
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Stack/CardStack.tsx 2020-04-22 16:35:12.000000000 +0200
@@ -7,7 +7,7 @@
Platform,
} from 'react-native';
import { EdgeInsets } from 'react-native-safe-area-context';
-// eslint-disable-next-line import/no-unresolved
import { ScreenContainer, Screen, screensEnabled } from 'react-native-screens'; // Import with * as to prevent getters being called
-import { Route, StackNavigationState } from '@react-navigation/native';
+import { NavigationState as StackNavigationState } from 'react-navigation';
import { MaybeScreenContainer, MaybeScreen } from '../Screens';
import { getDefaultHeaderHeight } from '../Header/HeaderSegment';
import { Props as HeaderContainerProps } from '../Header/HeaderContainer';
@@ -24,6 +23,7 @@
@@ -21,6 +21,7 @@
import { forNoAnimation as forNoAnimationCard } from '../../TransitionConfigs/CardStyleInterpolators';
import getDistanceForDirection from '../../utils/getDistanceForDirection';
import {
@@ -510,9 +508,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
StackHeaderMode,
StackCardMode,
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx src/vendor/views/Stack/StackView.tsx
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-04-18 01:38:52.000000000 +0200
+++ src/vendor/views/Stack/StackView.tsx 2020-04-18 01:44:22.000000000 +0200
@@ -4,9 +4,9 @@
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-04-22 16:34:01.000000000 +0200
+++ src/vendor/views/Stack/StackView.tsx 2020-04-22 16:38:12.000000000 +0200
@@ -4,9 +4,10 @@
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import {
StackActions,
@@ -520,12 +518,13 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
- Route,
-} from '@react-navigation/native';
+ NavigationState as StackNavigationState,
+ NavigationActions,
+ SceneView,
+} from 'react-navigation';
import CardStack from './CardStack';
import KeyboardManager from '../KeyboardManager';
@@ -15,6 +15,7 @@
@@ -15,6 +16,7 @@
} from '../Header/HeaderContainer';
import SafeAreaProviderCompat from '../SafeAreaProviderCompat';
import {
@@ -533,7 +532,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
StackNavigationHelpers,
StackNavigationConfig,
StackDescriptorMap,
@@ -24,6 +25,7 @@
@@ -24,6 +26,7 @@
state: StackNavigationState;
navigation: StackNavigationHelpers;
descriptors: StackDescriptorMap;
@@ -541,7 +540,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
};
type State = {
@@ -292,7 +294,9 @@
@@ -292,7 +295,9 @@
return false;
}
@@ -552,7 +551,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
}
return false;
@@ -320,14 +324,37 @@
@@ -320,23 +325,44 @@
return null;
}
@@ -587,11 +586,23 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
+ };
+
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
const { state, navigation } = this.props;
- if (
- state.routeNames.includes(route.name) &&
- !state.routes.some((r) => r.key === route.key)
- ) {
+ this.handleTransitionComplete();
this.setState((state) => ({
routes: state.replacingRouteKeys.length
? state.routes.filter((r) => !state.replacingRouteKeys.includes(r.key))
@@ -349,12 +376,11 @@
+
+ if (!state.routes.some((r) => r.key === route.key)) {
// If route isn't present in current state, assume that a close animation was cancelled
// So we need to add this route back to the state
- navigation.navigate(route);
+ navigation.dispatch(NavigationActions.navigate(route));
} else {
this.setState((state) => ({
routes: state.replacingRouteKeys.length
@@ -362,12 +388,11 @@
// If a route exists in state, trigger a pop
// This will happen in when the route was closed from the card component
// e.g. When the close animation triggered from a gesture ends
@@ -608,7 +619,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
// We need to clean up any state tracking the route and pop it immediately
this.setState((state) => ({
routes: state.routes.filter((r) => r.key !== route.key),
@@ -371,22 +397,24 @@
@@ -384,22 +409,24 @@
private handleTransitionStart = (
{ route }: { route: Route<string> },
closing: boolean

View File

@@ -1,17 +1,26 @@
import * as React from 'react';
import { UIManager } from 'react-native';
import RNCMaskedView from '@react-native-community/masked-view';
type Props = React.ComponentProps<typeof RNCMaskedView> & {
type MaskedViewType = typeof import('@react-native-community/masked-view').default;
type Props = React.ComponentProps<MaskedViewType> & {
children: React.ReactElement;
};
let RNCMaskedView: MaskedViewType | undefined;
try {
RNCMaskedView = require('@react-native-community/masked-view').default;
} catch (e) {
// Ignore
}
const isMaskedViewAvailable =
// @ts-ignore
UIManager.getViewManagerConfig('RNCMaskedView') != null;
export default function MaskedView({ children, ...rest }: Props) {
if (isMaskedViewAvailable) {
if (isMaskedViewAvailable && RNCMaskedView) {
return <RNCMaskedView {...rest}>{children}</RNCMaskedView>;
}

View File

@@ -0,0 +1,71 @@
import * as React from 'react';
import { Animated, View, Platform, ViewProps } from 'react-native';
let Screens: typeof import('react-native-screens') | undefined;
try {
Screens = require('react-native-screens');
} catch (e) {
// Ignore
}
// The web implementation in react-native-screens seems buggy.
// The view doesn't become visible after coming back in some cases.
// So we use our custom implementation.
class WebScreen extends React.Component<
ViewProps & {
active: number;
children: React.ReactNode;
}
> {
render() {
const { active, style, ...rest } = this.props;
return (
<View
// @ts-ignore
hidden={!active}
style={[style, { display: active ? 'flex' : 'none' }]}
{...rest}
/>
);
}
}
const AnimatedWebScreen = Animated.createAnimatedComponent(WebScreen);
export const MaybeScreenContainer = ({
enabled,
...rest
}: ViewProps & {
enabled: boolean;
children: React.ReactNode;
}) => {
if (enabled && Platform.OS !== 'web' && Screens && Screens.screensEnabled()) {
return <Screens.ScreenContainer {...rest} />;
}
return <View {...rest} />;
};
export const MaybeScreen = ({
enabled,
active,
...rest
}: ViewProps & {
enabled: boolean;
active: number | Animated.AnimatedInterpolation;
children: React.ReactNode;
}) => {
if (enabled && Platform.OS === 'web') {
// @ts-ignore
return <AnimatedWebScreen active={active} {...rest} />;
}
if (enabled && Screens && Screens.screensEnabled()) {
// @ts-ignore
return <Screens.Screen active={active} {...rest} />;
}
return <View {...rest} />;
};

View File

@@ -286,7 +286,7 @@ export default class Card extends React.Component<Props> {
getInvertedMultiplier(gestureDirection) >
distance / 2
? velocity !== 0 || translation !== 0
: false;
: this.props.closing;
this.animate({ closing, velocity });

View File

@@ -1,17 +1,15 @@
import * as React from 'react';
import {
Animated,
View,
StyleSheet,
LayoutChangeEvent,
Dimensions,
Platform,
ViewProps,
} from 'react-native';
import { EdgeInsets } from 'react-native-safe-area-context';
import { ScreenContainer, Screen, screensEnabled } from 'react-native-screens'; // Import with * as to prevent getters being called
import { NavigationState as StackNavigationState } from 'react-navigation';
import { MaybeScreenContainer, MaybeScreen } from '../Screens';
import { getDefaultHeaderHeight } from '../Header/HeaderSegment';
import { Props as HeaderContainerProps } from '../Header/HeaderContainer';
import CardContainer from './CardContainer';
@@ -75,67 +73,6 @@ type State = {
const EPSILON = 0.01;
// The web implementation in react-native-screens seems buggy.
// The view doesn't become visible after coming back in some cases.
// So we use our custom implementation.
class WebScreen extends React.Component<
ViewProps & {
active: number;
children: React.ReactNode;
}
> {
render() {
const { active, style, ...rest } = this.props;
return (
<View
// @ts-ignore
hidden={!active}
style={[style, { display: active ? 'flex' : 'none' }]}
{...rest}
/>
);
}
}
const AnimatedWebScreen = Animated.createAnimatedComponent(WebScreen);
const MaybeScreenContainer = ({
enabled,
...rest
}: ViewProps & {
enabled: boolean;
children: React.ReactNode;
}) => {
if (enabled && Platform.OS !== 'web' && screensEnabled()) {
return <ScreenContainer {...rest} />;
}
return <View {...rest} />;
};
const MaybeScreen = ({
enabled,
active,
...rest
}: ViewProps & {
enabled: boolean;
active: number | Animated.AnimatedInterpolation;
children: React.ReactNode;
}) => {
if (enabled && Platform.OS === 'web') {
// @ts-ignore
return <AnimatedWebScreen active={active} {...rest} />;
}
if (enabled && screensEnabled()) {
// @ts-ignore
return <Screen active={active} {...rest} />;
}
return <View {...rest} />;
};
const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });
const getHeaderHeights = (

View File

@@ -5,6 +5,7 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
import {
StackActions,
NavigationState as StackNavigationState,
NavigationActions,
SceneView,
} from 'react-navigation';
@@ -149,7 +150,7 @@ export default class StackView extends React.Component<Props, State> {
// We only need to animate routes if the focused route changed
// Animating previous routes won't be visible coz the focused route is on top of everything
if (!previousRoutes.find((r) => r.key === nextFocusedRoute.key)) {
if (!previousRoutes.some((r) => r.key === nextFocusedRoute.key)) {
// A new route has come to the focus, we treat this as a push
// A replace can also trigger this, the animation should look like push
@@ -168,7 +169,7 @@ export default class StackView extends React.Component<Props, State> {
(key) => key !== nextFocusedRoute.key
);
if (!routes.find((r) => r.key === previousFocusedRoute.key)) {
if (!routes.some((r) => r.key === previousFocusedRoute.key)) {
// The previous focused route isn't present in state, we treat this as a replace
openingRouteKeys = openingRouteKeys.filter(
@@ -208,7 +209,7 @@ export default class StackView extends React.Component<Props, State> {
}
}
}
} else if (!routes.find((r) => r.key === previousFocusedRoute.key)) {
} else if (!routes.some((r) => r.key === previousFocusedRoute.key)) {
// The previously focused route was removed, we treat this as a pop
if (
@@ -354,25 +355,36 @@ export default class StackView extends React.Component<Props, State> {
};
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
const { state, navigation } = this.props;
this.handleTransitionComplete();
this.setState((state) => ({
routes: state.replacingRouteKeys.length
? state.routes.filter((r) => !state.replacingRouteKeys.includes(r.key))
: state.routes,
openingRouteKeys: state.openingRouteKeys.filter(
(key) => key !== route.key
),
closingRouteKeys: state.closingRouteKeys.filter(
(key) => key !== route.key
),
replacingRouteKeys: [],
}));
if (!state.routes.some((r) => r.key === route.key)) {
// If route isn't present in current state, assume that a close animation was cancelled
// So we need to add this route back to the state
navigation.dispatch(NavigationActions.navigate(route));
} else {
this.setState((state) => ({
routes: state.replacingRouteKeys.length
? state.routes.filter(
(r) => !state.replacingRouteKeys.includes(r.key)
)
: state.routes,
openingRouteKeys: state.openingRouteKeys.filter(
(key) => key !== route.key
),
closingRouteKeys: state.closingRouteKeys.filter(
(key) => key !== route.key
),
replacingRouteKeys: [],
}));
}
};
private handleCloseRoute = ({ route }: { route: Route<string> }) => {
const { state, navigation } = this.props;
if (state.routes.find((r) => r.key === route.key)) {
if (state.routes.some((r) => r.key === route.key)) {
// If a route exists in state, trigger a pop
// This will happen in when the route was closed from the card component
// e.g. When the close animation triggered from a gesture ends

View File

@@ -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.
## [2.8.12](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.11...react-navigation-tabs@2.8.12) (2020-04-22)
**Note:** Version bump only for package react-navigation-tabs
## [2.8.11](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.10...react-navigation-tabs@2.8.11) (2020-04-02)
**Note:** Version bump only for package react-navigation-tabs

View File

@@ -1,6 +1,6 @@
{
"name": "react-navigation-tabs",
"version": "2.8.11",
"version": "2.8.12",
"description": "Tab Navigation components for React Navigation",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
@@ -42,7 +42,7 @@
"dependencies": {
"hoist-non-react-statics": "^3.3.2",
"react-lifecycles-compat": "^3.0.4",
"react-native-safe-area-view": "^0.14.8",
"react-native-safe-area-view": "^0.14.9",
"react-native-tab-view": "^2.11.0"
},
"devDependencies": {
@@ -56,7 +56,7 @@
"react-native-gesture-handler": "^1.6.0",
"react-native-reanimated": "^1.2.0",
"react-native-tab-view": "^2.13.0",
"react-navigation": "^4.3.7",
"react-navigation": "^4.3.8",
"typescript": "~3.8.3"
},
"peerDependencies": {

View File

@@ -3202,10 +3202,10 @@
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.7.tgz#a65ce0702f55cb67fd777995de6fc7b3e5781903"
integrity sha512-9KbP7LTLFz9dx1heURJbO6nuVMdSjDez8znlrUzaB1nUwKVsTTwlKRuHxGUYIIkReLWrJQeCv9tidy+84z2eCw==
"@react-navigation/stack@^5.2.11":
version "5.2.11"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.2.11.tgz#3e8d5e64a7a46c9fdb672eed74c973c3073e8ca5"
integrity sha512-Gt+T9FlXB8yQGS/0Mg987Wzr/XbPwSROujn0lTzw328wVpHKoilLStdMf5u5pxMMsNQ6HBtzITksM3FyxY9/0A==
"@react-navigation/stack@^5.2.12":
version "5.2.12"
resolved "https://registry.yarnpkg.com/@react-navigation/stack/-/stack-5.2.12.tgz#3c171827b1dfd4ff37d740a2be09a07d32d04073"
integrity sha512-CQPF8QwBugMm2oVUVd7I9tMi7FdFRqoUrqLU5su5gzSiT2PR13kSkJRYNf+vM7UY8JXjENRLJ1pnt7aL4MG0mg==
dependencies:
color "^3.1.2"
react-native-iphone-x-helper "^1.2.1"
@@ -14194,13 +14194,20 @@ react-native-safe-area-context@0.7.3, react-native-safe-area-context@^0.7.3:
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-0.7.3.tgz#ad6bd4abbabe195332c53810e4ce5851eb21aa2a"
integrity sha512-9Uqu1vlXPi+2cKW/CW6OnHxA76mWC4kF3wvlqzq4DY8hn37AeiXtLFs2WkxH4yXQRrnJdP6ivc65Lz+MqwRZAA==
react-native-safe-area-view@^0.14.6, react-native-safe-area-view@^0.14.8:
react-native-safe-area-view@^0.14.6:
version "0.14.8"
resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.14.8.tgz#ef33c46ff8164ae77acad48c3039ec9c34873e5b"
integrity sha512-MtRSIcZNstxv87Jet+UsPhEd1tpGe8cVskDXlP657x6rHpSrbrc+y13ZNXrwAgGNNhqQNX7UJT68ZIq//ZRmvw==
dependencies:
hoist-non-react-statics "^2.3.1"
react-native-safe-area-view@^0.14.9:
version "0.14.9"
resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.14.9.tgz#90ee8383037010d9a5055a97cf97e4c1da1f0c3d"
integrity sha512-WII/ulhpVyL/qbYb7vydq7dJAfZRBcEhg4/UWt6F6nAKpLa3gAceMOxBxI914ppwSP/TdUsandFy6lkJQE0z4A==
dependencies:
hoist-non-react-statics "^2.3.1"
react-native-screens@2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/react-native-screens/-/react-native-screens-2.3.0.tgz#fd2b0c841f4fdebb2937c0e84acccc62bf9ebb22"