Skip to content
Open
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
20 changes: 14 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default class ModalBox extends React.PureComponent {
isAnimateClose: false,
isAnimateOpen: false,
swipeToClose: false,
showContent: true,
height: SCREEN_HEIGHT,
width: SCREEN_WIDTH,
containerHeight: SCREEN_HEIGHT,
Expand Down Expand Up @@ -312,11 +313,15 @@ export default class ModalBox extends React.PureComponent {
}).start(() => {
// Keyboard.dismiss(); // make this optional. Easily user defined in .onClosed() callback
this.setState({
isAnimateClose: false,
animClose
showContent: false
}, () => {
/* Set the state to the starting position of the modal, preventing from animating where the swipe stopped */
this.state.position.setValue(this.props.entry === 'top' ? -this.state.containerHeight : this.state.containerHeight);
this.setState({
isAnimateClose: false,
animClose
}, () => {
/* Set the state to the starting position of the modal, preventing from animating where the swipe stopped */
this.state.position.setValue(this.props.entry === 'top' ? -this.state.containerHeight : this.state.containerHeight);
});
});
if (this.props.onClosed) this.props.onClosed();
});
Expand Down Expand Up @@ -547,7 +552,7 @@ export default class ModalBox extends React.PureComponent {
transparent
visible={visible}
hardwareAccelerated={true}>
{content}
{this.state.showContent ? content : <View />}
</Modal>
);
}
Expand All @@ -566,7 +571,10 @@ export default class ModalBox extends React.PureComponent {
BackHandler.addEventListener('hardwareBackPress', this.onBackPress);
this.onViewLayoutCalculated = null;
};
this.setState({isAnimateOpen: true});
this.setState({
isAnimateOpen: true,
showContent: true
});
}
}

Expand Down