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

implement transitionMount prop #5

Merged
merged 2 commits into from
Nov 13, 2018
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
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class Grid extends React.PureComponent {
open: PropTypes.string,
}
state = {
mounted: false,
width: 0,
height: 0,
heightOuter: 0,
Expand All @@ -57,6 +58,7 @@ export class Grid extends React.PureComponent {
this.setState({
[width]: props.client.width,
[height]: props.client.height,
mounted: width === 'width' || this.state.mounted,
})
resizeOuter = props => this.resize('widthOuter', 'heightOuter', props)
resizeInner = props => this.resize('width', 'height', props)
Expand Down Expand Up @@ -151,8 +153,6 @@ export class Grid extends React.PureComponent {
})
const overflow = lockScroll ? (curOpen ? 'hidden' : 'auto') : 'auto'
const totalHeight = Math.max(...columnHeights) + margin
const renderContainer = widthOuter > 0 && heightOuter > 0
const renderContent = transitionMount || (height > 0 && width > 0)

return (
<Measure
Expand Down Expand Up @@ -186,7 +186,7 @@ export class Grid extends React.PureComponent {
update={this.update}
impl={impl}
config={config}
children={displayData.map(this.cell)}
children={(transitionMount || this.state.mounted) && displayData.map(this.cell)}
/>
</div>
)}
Expand Down