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

Fix background image is missing in Android native app #26923

Merged
merged 7 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PropTypes from 'prop-types';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have a small suggestion. This should be propTypes, not defaultPropTypes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. Please help me to review the PR again. Thanks


const defaultPropTypes = {
/** pointerEvents property to the SVG element */
pointerEvents: PropTypes.string.isRequired,

/** The width of the image. */
width: PropTypes.number.isRequired,
};

export default defaultPropTypes;
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
import backgroundImage from '../../../../../assets/images/home-background--android.svg';
import React from 'react';
import AndroidBackgroundImage from '../../../../../assets/images/home-background--android.svg';
import styles from '../../../../styles/styles';
import defaultPropTypes from './defaultPropTypes';

export default backgroundImage;
function BackgroundImage(props) {
return (
<AndroidBackgroundImage
pointerEvents={props.pointerEvents}
width={props.width}
style={styles.signInBackground}
/>
);
}

BackgroundImage.displayName = 'BackgroundImage';
BackgroundImage.propTypes = defaultPropTypes;

export default BackgroundImage;
6 changes: 4 additions & 2 deletions src/pages/signin/SignInPageLayout/BackgroundImage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ import PropTypes from 'prop-types';
import MobileBackgroundImage from '../../../../../assets/images/home-background--mobile.svg';
import DesktopBackgroundImage from '../../../../../assets/images/home-background--desktop.svg';
import styles from '../../../../styles/styles';
import defaultPropTypes from './defaultPropTypes';

const defaultProps = {
isSmallScreen: false,
};

const propTypes = {
/** Is the window width narrow, like on a mobile device */
isSmallScreen: PropTypes.bool,
pointerEvents: PropTypes.string.isRequired,
width: PropTypes.number.isRequired,

...defaultPropTypes,
};
function BackgroundImage(props) {
return props.isSmallScreen ? (
Expand Down