Compare commits

..

6 Commits

Author SHA1 Message Date
Satyajit Sahoo
a046db536f chore: publish
- @react-navigation/stack@5.0.9
2020-02-24 14:45:00 +01:00
Satyajit Sahoo
d115787b1c chore: mark yarn script as binary 2020-02-24 14:44:29 +01:00
Michał Osadnik
80a337024a fix: enhance border radius in modals on new iPhones (#6945)
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-02-24 14:44:20 +01:00
Satyajit Sahoo
c19da31240 refactor: enable screens only for last screen
This will avoid issues such as https://github.com/react-navigation/react-navigation/issues/6909
2020-02-24 11:37:25 +01:00
Satyajit Sahoo
85e9376302 chore: publish
- @react-navigation/stack@5.0.8
2020-02-21 20:09:06 +01:00
Satyajit Sahoo
a67b49477e fix: fix transparent header on Android 2020-02-21 20:07:38 +01:00
7 changed files with 46 additions and 80 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
yarn-*.js binary

View File

@@ -7,7 +7,11 @@ import {
StatusBar, StatusBar,
I18nManager, I18nManager,
} from 'react-native'; } from 'react-native';
// eslint-disable-next-line import/no-unresolved
import { enableScreens } from 'react-native-screens';
import RNRestart from 'react-native-restart'; import RNRestart from 'react-native-restart';
import { Updates } from 'expo';
import { Asset } from 'expo-asset';
import { MaterialIcons } from '@expo/vector-icons'; import { MaterialIcons } from '@expo/vector-icons';
import { import {
Provider as PaperProvider, Provider as PaperProvider,
@@ -17,7 +21,6 @@ import {
List, List,
Divider, Divider,
} from 'react-native-paper'; } from 'react-native-paper';
import { Asset } from 'expo-asset';
import { import {
InitialState, InitialState,
useLinking, useLinking,
@@ -49,10 +52,11 @@ import DynamicTabs from './Screens/DynamicTabs';
import AuthFlow from './Screens/AuthFlow'; import AuthFlow from './Screens/AuthFlow';
import CompatAPI from './Screens/CompatAPI'; import CompatAPI from './Screens/CompatAPI';
import SettingsItem from './Shared/SettingsItem'; import SettingsItem from './Shared/SettingsItem';
import { Updates } from 'expo';
YellowBox.ignoreWarnings(['Require cycle:', 'Warning: Async Storage']); YellowBox.ignoreWarnings(['Require cycle:', 'Warning: Async Storage']);
enableScreens();
type RootDrawerParamList = { type RootDrawerParamList = {
Root: undefined; Root: undefined;
Another: undefined; Another: undefined;

View File

@@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [5.0.9](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/compare/@react-navigation/stack@5.0.8...@react-navigation/stack@5.0.9) (2020-02-24)
### Bug Fixes
* enhance border radius in modals on new iPhones ([#6945](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/issues/6945)) ([80a3370](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/commit/80a337024abc53537ff4a63916cea38bb4f374bf))
## [5.0.8](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/compare/@react-navigation/stack@5.0.7...@react-navigation/stack@5.0.8) (2020-02-21)
### Bug Fixes
* fix transparent header on Android ([a67b494](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/commit/a67b49477eb500c81fedcd73bbd8102901a95170))
## [5.0.7](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/compare/@react-navigation/stack@5.0.6...@react-navigation/stack@5.0.7) (2020-02-21) ## [5.0.7](https://github.com/react-navigation/react-navigation/tree/master/packages/stack/compare/@react-navigation/stack@5.0.6...@react-navigation/stack@5.0.7) (2020-02-21)

View File

@@ -1,7 +1,7 @@
{ {
"name": "@react-navigation/stack", "name": "@react-navigation/stack",
"description": "Stack navigator component for iOS and Android with animated transitions and gestures", "description": "Stack navigator component for iOS and Android with animated transitions and gestures",
"version": "5.0.7", "version": "5.0.9",
"keywords": [ "keywords": [
"react-native-component", "react-native-component",
"react-component", "react-component",

View File

@@ -1,4 +1,5 @@
import { Animated } from 'react-native'; import { Animated } from 'react-native';
import { isIphoneX } from 'react-native-iphone-x-helper';
import conditional from '../utils/conditional'; import conditional from '../utils/conditional';
import { import {
StackCardInterpolationProps, StackCardInterpolationProps,
@@ -152,8 +153,8 @@ export function forModalPresentationIOS({
? 0 ? 0
: index === 0 : index === 0
? progress.interpolate({ ? progress.interpolate({
inputRange: [0, 1, 2], inputRange: [0, 1, 1.0001, 2],
outputRange: [0, 0, 10], outputRange: [0, 0, isIphoneX() ? 38 : 0, 10],
}) })
: 10; : 10;

View File

@@ -139,7 +139,7 @@ export default function HeaderContainer({
style={ style={
// Avoid positioning the focused header absolutely // Avoid positioning the focused header absolutely
// Otherwise accessibility tools don't seem to be able to find it // Otherwise accessibility tools don't seem to be able to find it
(mode === 'float' || options.headerTransparent) && !isFocused (mode === 'float' && !isFocused) || options.headerTransparent
? styles.header ? styles.header
: null : null
} }

View File

@@ -37,14 +37,6 @@ type GestureValues = {
[key: string]: Animated.Value; [key: string]: Animated.Value;
}; };
// @ts-ignore
const maybeExpoVersion = global.Expo?.Constants.manifest.sdkVersion.split(
'.'
)[0];
const isInsufficientExpoVersion = maybeExpoVersion
? Number(maybeExpoVersion) <= 36
: maybeExpoVersion === 'UNVERSIONED';
type Props = { type Props = {
mode: StackCardMode; mode: StackCardMode;
insets: EdgeInsets; insets: EdgeInsets;
@@ -82,37 +74,27 @@ type State = {
}; };
const EPSILON = 0.01; const EPSILON = 0.01;
const FAR_FAR_AWAY = 9000;
const dimensions = Dimensions.get('window'); const dimensions = Dimensions.get('window');
const layout = { width: dimensions.width, height: dimensions.height }; const layout = { width: dimensions.width, height: dimensions.height };
const MaybeScreenContainer = ({ const MaybeScreenContainer = ({
enabled, enabled,
style,
...rest ...rest
}: ViewProps & { }: ViewProps & {
enabled: boolean; enabled: boolean;
children: React.ReactNode; children: React.ReactNode;
}) => { }) => {
if (enabled && screensEnabled()) { if (enabled && screensEnabled()) {
return <ScreenContainer style={style} {...rest} />; return <ScreenContainer {...rest} />;
} }
return ( return <View {...rest} />;
<View
collapsable={!enabled}
removeClippedSubviews={Platform.OS !== 'ios' && enabled}
style={[style, { overflow: 'hidden' }]}
{...rest}
/>
);
}; };
const MaybeScreen = ({ const MaybeScreen = ({
enabled, enabled,
active, active,
style,
...rest ...rest
}: ViewProps & { }: ViewProps & {
enabled: boolean; enabled: boolean;
@@ -121,39 +103,10 @@ const MaybeScreen = ({
}) => { }) => {
if (enabled && screensEnabled()) { if (enabled && screensEnabled()) {
// @ts-ignore // @ts-ignore
return <Screen active={active} style={style} {...rest} />; return <Screen active={active} {...rest} />;
} }
return ( return <View {...rest} />;
<Animated.View
style={[
style,
{
overflow: 'hidden',
// Position the screen offscreen to take advantage of offscreen perf optimization
// https://facebook.github.io/react-native/docs/view#removeclippedsubviews
// This can be useful if screens is not enabled
// It's buggy on iOS, so we don't enable it there
top:
enabled && typeof active === 'number' && !active ? FAR_FAR_AWAY : 0,
transform: [
{
// If the `active` prop is animated node, we can't use the `left` property due to native driver
// So we use `translateY` instead
translateY:
enabled && typeof active !== 'number'
? active.interpolate({
inputRange: [0, 1],
outputRange: [FAR_FAR_AWAY, 0],
})
: 0,
},
],
},
]}
{...rest}
/>
);
}; };
const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} }); const FALLBACK_DESCRIPTOR = Object.freeze({ options: {} });
@@ -450,9 +403,7 @@ export default class CardStack extends React.Component<Props, State> {
// Screens is buggy on iOS, so we don't enable it there // Screens is buggy on iOS, so we don't enable it there
// For modals, usually we want the screen underneath to be visible, so also disable it there // For modals, usually we want the screen underneath to be visible, so also disable it there
const isScreensEnabled = const isScreensEnabled = Platform.OS !== 'ios' && mode !== 'modal';
Platform.OS !== 'ios' &&
(isInsufficientExpoVersion ? mode !== 'modal' : true);
return ( return (
<React.Fragment> <React.Fragment>
@@ -466,26 +417,13 @@ export default class CardStack extends React.Component<Props, State> {
const gesture = gestures[route.key]; const gesture = gestures[route.key];
const scene = scenes[index]; const scene = scenes[index];
// Display current screen and a screen beneath. const isScreenActive = scene.progress.next
let isScreenActive: Animated.AnimatedInterpolation | 0 | 1 = ? scene.progress.next.interpolate({
index >= self.length - 2 ? 1 : 0; inputRange: [0, 1 - EPSILON, 1],
outputRange: [1, 1, 0],
if (isInsufficientExpoVersion) { extrapolate: 'clamp',
isScreenActive = })
index === self.length - 1 : 1;
? 1
: Platform.OS === 'android'
? scene.progress.next
? scene.progress.next.interpolate({
inputRange: [0, 1 - EPSILON, 1],
outputRange: [1, 1, 0],
extrapolate: 'clamp',
})
: 1
: index === self.length - 2
? 1
: 0;
}
const { const {
safeAreaInsets, safeAreaInsets,