Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix: make modal presentation mode fullscreen on landscape (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 authored and osdnk committed Oct 8, 2019
1 parent b32cda2 commit e789846
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions packages/stack/src/TransitionConfigs/CardStyleInterpolators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export function forModalPresentationIOS({
layouts: { screen },
insets,
}: StackCardInterpolationProps): StackCardInterpolatedStyle {
const topOffset = 10;
const isLandscape = screen.width > screen.height;
const topOffset = isLandscape ? 0 : 10;
const statusBarHeight = insets.top;
const aspectRatio = screen.height / screen.width;

Expand All @@ -105,18 +106,25 @@ export function forModalPresentationIOS({
outputRange: [0, 0.3, 1, 1],
});

const scale = interpolate(progress, {
inputRange: [0, 1, 2],
outputRange: [1, 1, screen.width ? 1 - (topOffset * 2) / screen.width : 1],
});

const borderRadius =
index === 0
? interpolate(progress, {
inputRange: [0, 1, 2],
outputRange: [0, 0, 10],
})
: 10;
const scale = isLandscape
? 1
: interpolate(progress, {
inputRange: [0, 1, 2],
outputRange: [
1,
1,
screen.width ? 1 - (topOffset * 2) / screen.width : 1,
],
});

const borderRadius = isLandscape
? 0
: index === 0
? interpolate(progress, {
inputRange: [0, 1, 2],
outputRange: [0, 0, 10],
})
: 10;

return {
cardStyle: {
Expand Down

0 comments on commit e789846

Please sign in to comment.