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

Commit 15023fa

Browse files
satya164osdnk
authored andcommitted
fix: make modal presentation mode fullscreen on landscape (#256)
1 parent 0f715c1 commit 15023fa

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/TransitionConfigs/CardStyleInterpolators.tsx

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ export function forModalPresentationIOS({
8282
layouts: { screen },
8383
insets,
8484
}: CardInterpolationProps): CardInterpolatedStyle {
85-
const topOffset = 10;
85+
const isLandscape = screen.width > screen.height;
86+
const topOffset = isLandscape ? 0 : 10;
8687
const statusBarHeight = insets.top;
8788
const aspectRatio = screen.height / screen.width;
8889

@@ -102,18 +103,25 @@ export function forModalPresentationIOS({
102103
outputRange: [0, 0.3, 1, 1],
103104
});
104105

105-
const scale = interpolate(progress, {
106-
inputRange: [0, 1, 2],
107-
outputRange: [1, 1, screen.width ? 1 - (topOffset * 2) / screen.width : 1],
108-
});
109-
110-
const borderRadius =
111-
index === 0
112-
? interpolate(progress, {
113-
inputRange: [0, 1, 2],
114-
outputRange: [0, 0, 10],
115-
})
116-
: 10;
106+
const scale = isLandscape
107+
? 1
108+
: interpolate(progress, {
109+
inputRange: [0, 1, 2],
110+
outputRange: [
111+
1,
112+
1,
113+
screen.width ? 1 - (topOffset * 2) / screen.width : 1,
114+
],
115+
});
116+
117+
const borderRadius = isLandscape
118+
? 0
119+
: index === 0
120+
? interpolate(progress, {
121+
inputRange: [0, 1, 2],
122+
outputRange: [0, 0, 10],
123+
})
124+
: 10;
117125

118126
return {
119127
cardStyle: {

0 commit comments

Comments
 (0)