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

fix: make modal presentation mode fullscreen on landscape #256

Merged
merged 1 commit into from
Oct 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions src/TransitionConfigs/CardStyleInterpolators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export function forModalPresentationIOS({
layouts: { screen },
insets,
}: CardInterpolationProps): CardInterpolatedStyle {
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 @@ -102,18 +103,25 @@ export function forModalPresentationIOS({
outputRange: [0, 0.3, 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