Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass props.windowHeight to getBaseNavigationModalCardStyles #19682

Merged
merged 1 commit into from
May 30, 2023
Merged
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions src/libs/Navigation/AppNavigator/AuthScreens.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class AuthScreens extends React.Component {
}

shouldComponentUpdate(nextProps) {
return nextProps.isSmallScreenWidth !== this.props.isSmallScreenWidth;
return nextProps.windowHeight !== this.props.windowHeight || nextProps.isSmallScreenWidth !== this.props.isSmallScreenWidth;
}

componentWillUnmount() {
Expand All @@ -184,7 +184,10 @@ class AuthScreens extends React.Component {
};
const modalScreenOptions = {
...commonModalScreenOptions,
cardStyle: getNavigationModalCardStyle(this.props.isSmallScreenWidth),
cardStyle: getNavigationModalCardStyle({
windowHeight: this.props.windowHeight,
isSmallScreenWidth: this.props.isSmallScreenWidth,
}),
cardStyleInterpolator: (props) => modalCardStyleInterpolator(this.props.isSmallScreenWidth, false, props),
cardOverlayEnabled: true,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import variables from '../variables';

export default (isSmallScreenWidth) => ({
export default ({isSmallScreenWidth}) => ({
position: 'absolute',
top: 0,
right: 0,
Expand Down
12 changes: 7 additions & 5 deletions src/styles/getNavigationModalCardStyles/index.website.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import getBaseNavigationModalCardStyles from './getBaseNavigationModalCardStyles';

export default (isSmallScreenWidth) => ({
...getBaseNavigationModalCardStyles(isSmallScreenWidth),
export default ({windowHeight, isSmallScreenWidth}) => ({
...getBaseNavigationModalCardStyles({isSmallScreenWidth}),

// This makes the modal card take up the full height of the screen on Desktop Safari and iOS Safari
// https://github.com/Expensify/App/pull/12509/files#r1018107162
height: 'calc(100vh - 100%)',
// This height is passed from JavaScript, instead of using CSS expressions like "100%" or "100vh", to work around
// Safari issues:
// https://github.com/Expensify/App/issues/12005
// https://github.com/Expensify/App/issues/17824
height: `${windowHeight}px`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused a regression on Safari where the window height is not reliable.

});