Skip to content

Commit

Permalink
Merge pull request jeremybarbet#71 from charpeni/adjustToContentHeigh…
Browse files Browse the repository at this point in the history
…t-flickering

Prevent flickering with adjustToContentHeight
  • Loading branch information
jeremybarbet authored Oct 12, 2019
2 parents 88d7a11 + a2585c6 commit 14cea8b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Modalize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,17 @@ export default class Modalize<FlatListItem = any, SectionListItem = any>
}

public open = (): void => {
const { onOpen } = this.props;
const { adjustToContentHeight, onOpen } = this.props;

if (onOpen) {
onOpen();
}

this.onAnimateOpen();
if (!adjustToContentHeight || this.contentAlreadyCalculated) {
this.onAnimateOpen();
} else {
this.setState({ isVisible: true });
}
}

public close = (): void => {
Expand Down Expand Up @@ -297,6 +301,7 @@ export default class Modalize<FlatListItem = any, SectionListItem = any>
modalHeight: contentHeight - this.handleHeight,
}, () => {
this.contentAlreadyCalculated = true;
this.onAnimateOpen();
});
}

Expand Down

0 comments on commit 14cea8b

Please sign in to comment.