fix modal close scroll (#4162)
* fix modal close scroll * update refresh
This commit is contained in:
parent
79365d854c
commit
5ac3b2c6fb
@ -53,6 +53,7 @@ const MyModal = ({
|
|||||||
allowPinchZoom
|
allowPinchZoom
|
||||||
scrollBehavior={'inside'}
|
scrollBehavior={'inside'}
|
||||||
closeOnOverlayClick={closeOnOverlayClick}
|
closeOnOverlayClick={closeOnOverlayClick}
|
||||||
|
returnFocusOnClose={false}
|
||||||
>
|
>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent
|
<ModalContent
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useRef, useState, ReactNode, useCallback } from 'react';
|
import { useEffect, useRef, useState, ReactNode } from 'react';
|
||||||
import { LinkedListResponse, LinkedPaginationProps } from '../common/fetch/type';
|
import { LinkedListResponse, LinkedPaginationProps } from '../common/fetch/type';
|
||||||
import { Box, BoxProps } from '@chakra-ui/react';
|
import { Box, BoxProps } from '@chakra-ui/react';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { useTranslation } from 'next-i18next';
|
||||||
@ -64,11 +64,11 @@ export function useLinkedScroll<
|
|||||||
|
|
||||||
let scroolSign = useRef(false);
|
let scroolSign = useRef(false);
|
||||||
const { runAsync: loadInitData } = useRequest2(
|
const { runAsync: loadInitData } = useRequest2(
|
||||||
async (scrollWhenFinish = true) => {
|
async (scrollWhenFinish = true, refresh = false) => {
|
||||||
if (!currentData || isLoading) return;
|
if (!currentData || isLoading) return;
|
||||||
|
|
||||||
const item = dataList.find((item) => item._id === currentData.id);
|
const item = dataList.find((item) => item._id === currentData.id);
|
||||||
if (item) {
|
if (item && !refresh) {
|
||||||
scrollToItem(item._id);
|
scrollToItem(item._id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -260,7 +260,7 @@ const CollectionReader = ({
|
|||||||
quoteRefs={itemRefs as React.MutableRefObject<(HTMLDivElement | null)[]>}
|
quoteRefs={itemRefs as React.MutableRefObject<(HTMLDivElement | null)[]>}
|
||||||
quoteIndex={item.quoteIndex}
|
quoteIndex={item.quoteIndex}
|
||||||
setQuoteIndex={setQuoteIndex}
|
setQuoteIndex={setQuoteIndex}
|
||||||
refreshList={() => loadInitData(false)}
|
refreshList={() => loadInitData(false, true)}
|
||||||
updated={item.updated}
|
updated={item.updated}
|
||||||
isCurrentSelected={item.isCurrentSelected}
|
isCurrentSelected={item.isCurrentSelected}
|
||||||
q={item.q}
|
q={item.q}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user