Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

try adding nodeRef #1140

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions packages/react-widgets/src/SlideDownTransition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ class SlideDownTransition extends React.Component<SlideDownTransitionProps> {
onEntered: PropTypes.func,
}

private readonly nodeRef: React.RefObject<any>

constructor(props: SlideDownTransitionProps) {
super(props);
this.nodeRef = React.createRef();
}

getHeight(container: HTMLElement) {
let content = container.firstChild as HTMLElement
let margin =
Expand Down Expand Up @@ -92,6 +99,7 @@ class SlideDownTransition extends React.Component<SlideDownTransitionProps> {
return (
<Transition
{...props}
nodeRef={this.nodeRef}
appear
in={this.props.in}
onEnter={this.setContainerHeight}
Expand Down
2 changes: 2 additions & 0 deletions www/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Home() {
const context = useDocusaurusContext()
const { siteConfig = {} } = context
return (
<React.StrictMode>
<Layout title={siteConfig.title} className="flex">
<main className="flex md:flex-row flex-col h-100 md:space-x-10 space-y-6 mt-10 pb-20 items-center justify-around self-center">
<div>
Expand Down Expand Up @@ -55,6 +56,7 @@ function Home() {
</div>
</main>
</Layout>
</React.StrictMode>
)
}

Expand Down