mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
Always animate lightbox transitions
This commit is contained in:
@@ -86,8 +86,9 @@ export function Lightbox({
|
||||
hasPrevMessage,
|
||||
}: PropsType): JSX.Element | null {
|
||||
const hasThumbnails = media.length > 1;
|
||||
const hadThumbnails = usePrevious(hasThumbnails, hasThumbnails);
|
||||
const justGotThumbnails = !hadThumbnails && hasThumbnails;
|
||||
const messageId = media[0].message.id;
|
||||
const prevMessageId = usePrevious(messageId, messageId);
|
||||
const needsAnimation = messageId !== prevMessageId;
|
||||
const [root, setRoot] = React.useState<HTMLElement | undefined>();
|
||||
|
||||
const [videoElement, setVideoElement] = useState<HTMLVideoElement | null>(
|
||||
@@ -301,7 +302,7 @@ export function Lightbox({
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (!justGotThumbnails) {
|
||||
if (!needsAnimation) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -317,7 +318,7 @@ export function Lightbox({
|
||||
opacity: 1,
|
||||
});
|
||||
}, [
|
||||
justGotThumbnails,
|
||||
needsAnimation,
|
||||
selectedIndex,
|
||||
thumbnailsMarginLeft,
|
||||
thumbnailsAnimation,
|
||||
|
||||
Reference in New Issue
Block a user