Skip to content

Commit 7b579fd

Browse files
author
para1118
committed
add IosDevice for unlock()
1 parent f75b705 commit 7b579fd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Dom/scrollLocker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const scrollingEffectClassNameReg = new RegExp(
1919
);
2020

2121
let scrollPosition = 0;
22+
const isIosDevice = /iP(ad|hone|od)|MacIntel/.test(window.navigator.platform);
2223

2324
const setContainerStyle = (
2425
container: HTMLElement,
@@ -31,7 +32,6 @@ const setContainerStyle = (
3132
overflowY: 'hidden',
3233
};
3334

34-
const isIosDevice = /iP(ad|hone|od)|MacIntel/.test(window.navigator.platform);
3535
if (isIosDevice && container === document.body) {
3636
scrollPosition = window.pageYOffset;
3737
return {
@@ -158,7 +158,7 @@ export default class ScrollLocker {
158158

159159
setStyle(cacheStyle.get(container), { element: container });
160160
// https://github.com/ant-design/ant-design/issues/23202
161-
if (container === document.body) {
161+
if (isIosDevice && container === document.body) {
162162
window.scrollTo(0, scrollPosition);
163163
}
164164
cacheStyle.delete(container);

0 commit comments

Comments
 (0)