Skip to content

Commit

Permalink
Refactor BackgroundImage, remove unnecessary props
Browse files Browse the repository at this point in the history
  • Loading branch information
WojtekBoman committed Dec 15, 2023
1 parent 09a703d commit 1da3052
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/pages/GetAssistancePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function GetAssistancePage(props) {
title: props.translate('getAssistancePage.chatWithConcierge'),
onPress: () => Report.navigateToConciergeChat(),
icon: Expensicons.ChatBubble,
name: 'Chatbubble',
shouldShowRightIcon: true,
wrapperStyle: [styles.cardMenuItem],
},
Expand Down
17 changes: 8 additions & 9 deletions src/pages/signin/SignInPageLayout/BackgroundImage/index.ios.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {Image} from 'expo-image';
import PropTypes from 'prop-types';
import React from 'react';
import React, {useMemo} from 'react';
import DesktopBackgroundImage from '@assets/images/home-background--desktop.svg';
import MobileBackgroundImage from '@assets/images/home-background--mobile-new.svg';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';
import defaultPropTypes from './propTypes';

Expand All @@ -18,15 +19,13 @@ const propTypes = {
};
function BackgroundImage(props) {
const styles = useThemeStyles();
return props.isSmallScreen ? (
<Image
source={MobileBackgroundImage}
style={[styles.signInBackground, {width: props.width}]}
/>
) : (
const StyleUtils = useStyleUtils();
const src = useMemo(() => (props.isSmallScreen ? MobileBackgroundImage : DesktopBackgroundImage), [props.isSmallScreen]);

return (
<Image
source={DesktopBackgroundImage}
style={[styles.signInBackground, {width: props.width}]}
source={src}
style={[styles.signInBackground, StyleUtils.getWidthStyle(props.width)]}
/>
);
}
Expand Down

0 comments on commit 1da3052

Please sign in to comment.