Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/ui/widgets/Slideshow/slideshow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ export const SwitchableWidget = (props: {
index: number;
children: [ReactElement];
transition: { readonly [key: string]: string };
nodeRef: React.Ref<HTMLDivElement>;
}): JSX.Element => {
// react-transition-group internally uses findDOMNode which
// is deprecated. Fix by passing nodeRef which points to the
// transitioning child.
return (
<SwitchTransition mode="out-in">
<CSSTransition
nodeRef={props.nodeRef}
classNames={props.transition}
key={props.index}
timeout={250}
Expand Down Expand Up @@ -69,6 +74,7 @@ export const SlideshowComponent = (
const [transition, setTransition] = useState(slideRightTransition);

log.debug(`Slideshow Index: ${childIndex}`);
const nodeRef = React.useRef<HTMLDivElement>(null);

return (
<div
Expand Down Expand Up @@ -104,6 +110,7 @@ export const SlideshowComponent = (
</button>
<div
ref={nodeRef}
style={{
position: "relative",
width: "80%",
Expand All @@ -114,7 +121,11 @@ export const SlideshowComponent = (
overflow: props.overflow ?? ""
}}
>
<SwitchableWidget index={childIndex} transition={transition}>
<SwitchableWidget
index={childIndex}
transition={transition}
nodeRef={nodeRef}
>
{props.children as [ReactElement]}
</SwitchableWidget>
</div>
Expand Down
Loading