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: login page auto scroll to top after change language #55929

Merged
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
16 changes: 2 additions & 14 deletions src/pages/signin/SignInPageLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ import {View} from 'react-native';
import SignInGradient from '@assets/images/home-fade-gradient.svg';
import ImageSVG from '@components/ImageSVG';
import ScrollView from '@components/ScrollView';
import useLocalize from '@hooks/useLocalize';
import usePrevious from '@hooks/usePrevious';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useSafeAreaInsets from '@hooks/useSafeAreaInsets';
import useStyleUtils from '@hooks/useStyleUtils';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import {isMobileSafari} from '@libs/Browser';
import DomUtils from '@libs/DomUtils';
import getPlatform from '@libs/getPlatform';
// eslint-disable-next-line no-restricted-imports
Expand Down Expand Up @@ -44,10 +42,8 @@ function SignInPageLayout(
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const {preferredLocale} = useLocalize();
const {top: topInsets, bottom: bottomInsets} = useSafeAreaInsets();
const scrollViewRef = useRef<RNScrollView>(null);
const prevPreferredLocale = usePrevious(preferredLocale);
const {windowHeight} = useWindowDimensions();
const {shouldUseNarrowLayout, isMediumScreenWidth, isLargeScreenWidth} = useResponsiveLayout();

Expand All @@ -73,14 +69,6 @@ function SignInPageLayout(
scrollPageToTop,
}));

useEffect(() => {
if (prevPreferredLocale !== preferredLocale) {
return;
}

scrollPageToTop();
}, [welcomeHeader, welcomeText, prevPreferredLocale, preferredLocale]);

const scrollViewStyles = useMemo(() => scrollViewContentContainerStyles(styles), [styles]);

const backgroundImageHeight = Math.max(variables.signInContentMinHeight, containerHeight);
Expand Down Expand Up @@ -174,7 +162,7 @@ function SignInPageLayout(
style={[
styles.flex1,
styles.flexColumn,
Browser.isMobileSafari() ? styles.overflowHidden : {},
isMobileSafari() ? styles.overflowHidden : {},
StyleUtils.getMinimumHeight(backgroundImageHeight),
StyleUtils.getSignInBgStyles(theme),
]}
Expand Down