-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto scroll on expanding deployed models tab and auto expand when dep…
…loying models
- Loading branch information
1 parent
84afc4c
commit 2c7a13e
Showing
4 changed files
with
32 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
import * as React from 'react'; | ||
|
||
const ScrollViewOnMount: React.FC = () => ( | ||
<div | ||
ref={(elm) => { | ||
if (elm) { | ||
elm.scrollIntoView(); | ||
} | ||
}} | ||
/> | ||
); | ||
type ScrollViewOnMountProps = { | ||
shouldScroll: boolean; | ||
}; | ||
|
||
const ScrollViewOnMount: React.FC<ScrollViewOnMountProps> = ({ shouldScroll }) => { | ||
const ref = React.useRef<HTMLDivElement>(null); | ||
|
||
React.useEffect(() => { | ||
if (shouldScroll && ref.current) { | ||
ref.current?.scrollIntoView(); | ||
} | ||
}, [shouldScroll]); | ||
|
||
return <div ref={ref} />; | ||
}; | ||
|
||
export default ScrollViewOnMount; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters