mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-26 23:06:03 +08:00
fix: make modal presentation mode fullscreen on landscape (#256)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -102,18 +103,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 scale = isLandscape
|
||||
? 1
|
||||
: 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 borderRadius = isLandscape
|
||||
? 0
|
||||
: index === 0
|
||||
? interpolate(progress, {
|
||||
inputRange: [0, 1, 2],
|
||||
outputRange: [0, 0, 10],
|
||||
})
|
||||
: 10;
|
||||
|
||||
return {
|
||||
cardStyle: {
|
||||
|
||||
Reference in New Issue
Block a user