File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,15 @@ export const SwitchableWidget = (props: {
3131 index : number ;
3232 children : [ ReactElement ] ;
3333 transition : { readonly [ key : string ] : string } ;
34+ nodeRef : React . Ref < HTMLDivElement > ;
3435} ) : JSX . Element => {
36+ // react-transition-group internally uses findDOMNode which
37+ // is deprecated. Fix by passing nodeRef which points to the
38+ // transitioning child.
3539 return (
3640 < SwitchTransition mode = "out-in" >
3741 < CSSTransition
42+ nodeRef = { props . nodeRef }
3843 classNames = { props . transition }
3944 key = { props . index }
4045 timeout = { 250 }
@@ -69,6 +74,7 @@ export const SlideshowComponent = (
6974 const [ transition , setTransition ] = useState ( slideRightTransition ) ;
7075
7176 log . debug ( `Slideshow Index: ${ childIndex } ` ) ;
77+ const nodeRef = React . useRef < HTMLDivElement > ( null ) ;
7278
7379 return (
7480 < div
@@ -104,6 +110,7 @@ export const SlideshowComponent = (
104110 ◀
105111 </ button >
106112 < div
113+ ref = { nodeRef }
107114 style = { {
108115 position : "relative" ,
109116 width : "80%" ,
@@ -114,7 +121,11 @@ export const SlideshowComponent = (
114121 overflow : props . overflow ?? ""
115122 } }
116123 >
117- < SwitchableWidget index = { childIndex } transition = { transition } >
124+ < SwitchableWidget
125+ index = { childIndex }
126+ transition = { transition }
127+ nodeRef = { nodeRef }
128+ >
118129 { props . children as [ ReactElement ] }
119130 </ SwitchableWidget >
120131 </ div >
You can’t perform that action at this time.
0 commit comments