Skip to content

Fix currency list scrolls to top when quickly scrolls down after open the page #55701

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

Merged
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
4 changes: 2 additions & 2 deletions src/hooks/useSyncFocus/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {ScreenWrapperStatusContext} from '@components/ScreenWrapper';
* When the user navigates through the app using the arrows and then the tab button, the focus on the element and the native focus of the browser differs.
* To maintain consistency when an element is focused in the app, the focus() method is additionally called on the focused element to eliminate the difference between native browser focus and application focus.
*/
const useSyncFocus = (ref: RefObject<View>, isFocused: boolean, shouldSyncFocus = true) => {
const useSyncFocus = (ref: RefObject<View | HTMLElement>, isFocused: boolean, shouldSyncFocus = true) => {
// this hook can be used outside ScreenWrapperStatusContext (eg. in Popovers). So we to check if the context is present.
// If we are outside context we don't have to look at transition status
const contextValue = useContext(ScreenWrapperStatusContext);
Expand All @@ -20,7 +20,7 @@ const useSyncFocus = (ref: RefObject<View>, isFocused: boolean, shouldSyncFocus
return;
}

ref.current?.focus();
ref.current?.focus({preventScroll: true});
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, [didScreenTransitionEnd, isFocused, ref]);
};
Expand Down
Loading