Reactor List Modal: Fix animation (#6525)
This commit is contained in:
parent
b75d506497
commit
665c510a1f
@ -14,6 +14,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
overflow: clip;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -24,9 +28,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.reactor-list-wrapper {
|
.reactor-list-wrapper {
|
||||||
|
position: relative;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
border-top: 1px solid var(--color-borders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.confirm-dialog-button {
|
.confirm-dialog-button {
|
||||||
@ -53,8 +57,10 @@
|
|||||||
.reactor-list {
|
.reactor-list {
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
padding: 0 0.5rem;
|
padding-top: 0.5rem;
|
||||||
|
padding-inline: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reactors-list-item {
|
.reactors-list-item {
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import useInfiniteScroll from '../../hooks/useInfiniteScroll';
|
|||||||
import useLang from '../../hooks/useLang';
|
import useLang from '../../hooks/useLang';
|
||||||
import useLastCallback from '../../hooks/useLastCallback';
|
import useLastCallback from '../../hooks/useLastCallback';
|
||||||
import useOldLang from '../../hooks/useOldLang';
|
import useOldLang from '../../hooks/useOldLang';
|
||||||
|
import useScrollNotch from '../../hooks/useScrollNotch';
|
||||||
|
|
||||||
import Avatar from '../common/Avatar';
|
import Avatar from '../common/Avatar';
|
||||||
import FullNameTitle from '../common/FullNameTitle';
|
import FullNameTitle from '../common/FullNameTitle';
|
||||||
@ -37,6 +38,7 @@ import InfiniteScroll from '../ui/InfiniteScroll';
|
|||||||
import ListItem from '../ui/ListItem';
|
import ListItem from '../ui/ListItem';
|
||||||
import Loading from '../ui/Loading';
|
import Loading from '../ui/Loading';
|
||||||
import Modal from '../ui/Modal';
|
import Modal from '../ui/Modal';
|
||||||
|
import Transition from '../ui/Transition';
|
||||||
|
|
||||||
import './ReactorListModal.scss';
|
import './ReactorListModal.scss';
|
||||||
|
|
||||||
@ -81,6 +83,7 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
&& reactions.results.length > 1;
|
&& reactions.results.length > 1;
|
||||||
const chatIdRef = useRef<string>();
|
const chatIdRef = useRef<string>();
|
||||||
const reactionsRef = useRef<HTMLDivElement>();
|
const reactionsRef = useRef<HTMLDivElement>();
|
||||||
|
const containerRef = useRef<HTMLDivElement>();
|
||||||
|
|
||||||
useHorizontalScroll(reactionsRef, !canShowFilters || !isOpen);
|
useHorizontalScroll(reactionsRef, !canShowFilters || !isOpen);
|
||||||
|
|
||||||
@ -128,6 +131,12 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
return uniqueReactions;
|
return uniqueReactions;
|
||||||
}, [reactors]);
|
}, [reactors]);
|
||||||
|
|
||||||
|
const contentActiveKey = useMemo(() => {
|
||||||
|
if (!chosenTab) return 0;
|
||||||
|
const index = allReactions.findIndex((r) => isSameReaction(r, chosenTab));
|
||||||
|
return index + 1;
|
||||||
|
}, [chosenTab, allReactions]);
|
||||||
|
|
||||||
const peerIds = useMemo(() => {
|
const peerIds = useMemo(() => {
|
||||||
if (chosenTab) {
|
if (chosenTab) {
|
||||||
return reactors?.reactions
|
return reactors?.reactions
|
||||||
@ -144,6 +153,11 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
handleLoadMore, peerIds, reactors && reactors.nextOffset === undefined,
|
handleLoadMore, peerIds, reactors && reactors.nextOffset === undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useScrollNotch({
|
||||||
|
containerRef,
|
||||||
|
selector: '.reactor-list',
|
||||||
|
}, [contentActiveKey, isOpen]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getMore?.({ direction: LoadMoreDirection.Backwards });
|
getMore?.({ direction: LoadMoreDirection.Backwards });
|
||||||
}, [getMore]);
|
}, [getMore]);
|
||||||
@ -200,7 +214,12 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div dir={lang.isRtl ? 'rtl' : undefined} className="reactor-list-wrapper">
|
<div
|
||||||
|
ref={containerRef}
|
||||||
|
dir={lang.isRtl ? 'rtl' : undefined}
|
||||||
|
className="reactor-list-wrapper"
|
||||||
|
>
|
||||||
|
<Transition activeKey={contentActiveKey} name="slide">
|
||||||
{viewportIds?.length ? (
|
{viewportIds?.length ? (
|
||||||
<InfiniteScroll
|
<InfiniteScroll
|
||||||
className="reactor-list custom-scroll"
|
className="reactor-list custom-scroll"
|
||||||
@ -268,6 +287,7 @@ const ReactorListModal: FC<OwnProps & StateProps> = ({
|
|||||||
)}
|
)}
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
) : <Loading />}
|
) : <Loading />}
|
||||||
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -268,6 +268,7 @@ $color-message-story-mention-to: #74bcff;
|
|||||||
--z-left-header: 11;
|
--z-left-header: 11;
|
||||||
--z-middle-header: 11;
|
--z-middle-header: 11;
|
||||||
--z-middle-footer: 11;
|
--z-middle-footer: 11;
|
||||||
|
--z-scroll-notch: 10;
|
||||||
--z-story-ribbon: 10;
|
--z-story-ribbon: 10;
|
||||||
--z-country-code-input-group: 10;
|
--z-country-code-input-group: 10;
|
||||||
--z-message-select-control: 9;
|
--z-message-select-control: 9;
|
||||||
|
|||||||
@ -376,7 +376,7 @@ body:not(.is-ios) {
|
|||||||
content: "";
|
content: "";
|
||||||
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: var(--z-scroll-notch);
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user