Skip to content

Commit 5f08ac2

Browse files
authored
Merge pull request #55701 from bernhardoj/fix/55601-list-scrolls-to-top-on-open
Fix currency list scrolls to top when quickly scrolls down after open the page
2 parents 9043b14 + 13dad8b commit 5f08ac2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/useSyncFocus/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {ScreenWrapperStatusContext} from '@components/ScreenWrapper';
88
* 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.
99
* 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.
1010
*/
11-
const useSyncFocus = (ref: RefObject<View>, isFocused: boolean, shouldSyncFocus = true) => {
11+
const useSyncFocus = (ref: RefObject<View | HTMLElement>, isFocused: boolean, shouldSyncFocus = true) => {
1212
// this hook can be used outside ScreenWrapperStatusContext (eg. in Popovers). So we to check if the context is present.
1313
// If we are outside context we don't have to look at transition status
1414
const contextValue = useContext(ScreenWrapperStatusContext);
@@ -20,7 +20,7 @@ const useSyncFocus = (ref: RefObject<View>, isFocused: boolean, shouldSyncFocus
2020
return;
2121
}
2222

23-
ref.current?.focus();
23+
ref.current?.focus({preventScroll: true});
2424
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
2525
}, [didScreenTransitionEnd, isFocused, ref]);
2626
};

0 commit comments

Comments
 (0)