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

Rectify the background delay issue by incorporating a transition #35215

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c0e43ef
Add duration to background image
wildan-m Jan 18, 2024
83415f4
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 18, 2024
8935128
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 25, 2024
71ca4d4
run prettier
wildan-m Jan 25, 2024
54aa7e9
prettier & lint
wildan-m Jan 25, 2024
8262564
change default transition duration to 0
wildan-m Jan 25, 2024
f1598cd
extract transition duration to CONST
wildan-m Jan 26, 2024
e486659
lint
wildan-m Jan 26, 2024
07df226
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 26, 2024
ba62bdc
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 26, 2024
8910503
Update src/pages/signin/SignInPageLayout/BackgroundImage/index.androi…
wildan-m Jan 28, 2024
894b2fe
Update src/pages/signin/SignInPageLayout/BackgroundImage/index.ios.js
wildan-m Jan 28, 2024
89e53cf
Update src/CONST.ts
wildan-m Jan 29, 2024
46c7aa0
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 31, 2024
cfd4286
move transitionDuration to propTypes, remove default value of transit…
wildan-m Jan 31, 2024
3486125
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 31, 2024
3a0f56f
fix incorrect const call
wildan-m Jan 31, 2024
cc09685
remove unrelated file
wildan-m Jan 31, 2024
77df109
remove unused import and var
wildan-m Jan 31, 2024
28cfe38
Merge branch 'main' of https://github.com/wildan-m/App into wildan/fi…
wildan-m Jan 31, 2024
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
1 change: 1 addition & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const CONST = {
IN: 'in',
OUT: 'out',
},
BACKGROUND_IMAGE_TRANSITION_DURATION: 1000,
ARROW_HIDE_DELAY: 3000,

API_ATTACHMENT_VALIDATIONS: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function BackgroundImage(props) {
source={AndroidBackgroundImage}
pointerEvents={props.pointerEvents}
style={[styles.signInBackground, {width: props.width}]}
transition={props.transitionDuration}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function BackgroundImage(props) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const src = useMemo(() => (props.isSmallScreen ? MobileBackgroundImage : DesktopBackgroundImage), [props.isSmallScreen]);

return (
<Image
source={src}
style={[styles.signInBackground, StyleUtils.getWidthStyle(props.width)]}
transition={props.transitionDuration}
/>
);
}
Expand Down
36 changes: 27 additions & 9 deletions src/pages/signin/SignInPageLayout/BackgroundImage/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
import React from 'react';
import * as Animatable from 'react-native-animatable';
import DesktopBackgroundImage from '@assets/images/home-background--desktop.svg';
import MobileBackgroundImage from '@assets/images/home-background--mobile.svg';
import useThemeStyles from '@hooks/useThemeStyles';
Expand All @@ -17,16 +18,33 @@ const propTypes = {
};
function BackgroundImage(props) {
const styles = useThemeStyles();
return props.isSmallScreen ? (
<MobileBackgroundImage
width={props.width}
style={styles.signInBackground}
/>
) : (
<DesktopBackgroundImage
width={props.width}
const fadeIn = {
arosiclair marked this conversation as resolved.
Show resolved Hide resolved
from: {
opacity: 0,
},
to: {
opacity: 1,
},
};

return (
<Animatable.View
style={styles.signInBackground}
/>
animation={fadeIn}
duration={props.transitionDuration}
>
{props.isSmallScreen ? (
<MobileBackgroundImage
width={props.width}
style={styles.signInBackground}
/>
) : (
<DesktopBackgroundImage
width={props.width}
style={styles.signInBackground}
/>
)}
</Animatable.View>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ const propTypes = {

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

/** Transition duration in milliseconds */
transitionDuration: PropTypes.number,
};

export default propTypes;
3 changes: 3 additions & 0 deletions src/pages/signin/SignInPageLayout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import compose from '@libs/compose';
import SignInPageHero from '@pages/signin/SignInPageHero';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import BackgroundImage from './BackgroundImage';
import Footer from './Footer';
import SignInPageContent from './SignInPageContent';
Expand Down Expand Up @@ -127,6 +128,7 @@ function SignInPageLayout(props) {
isSmallScreen={false}
pointerEvents="none"
width={variables.signInHeroBackgroundWidth}
transitionDuration={CONST.BACKGROUND_IMAGE_TRANSITION_DURATION}
/>
</View>
<View>
Expand Down Expand Up @@ -166,6 +168,7 @@ function SignInPageLayout(props) {
isSmallScreen
pointerEvents="none"
width={variables.signInHeroBackgroundWidthMobile}
transitionDuration={CONST.BACKGROUND_IMAGE_TRANSITION_DURATION}
/>
<SignInPageContent
welcomeHeader={props.welcomeHeader}
Expand Down
Loading