I have a Modal component on my React website say -
<Modal visible={this.state.visible} onClose={() => {some function..}}>
<div>
{renders something..}
</div>
</Modal>
visible
sets whether the Modal is visible or not and onClose
handles when a cross button on the modal is clicked to close the modal.
Now on mobile, when this Modal is open and back button on the mobile is pressed or if any mobile gesture is used to go back, it goes to the previous window. What I want is to just close the Modal when back button is pressed.
I am unaware how to listen for a back event on mobile so that I can handle this case.
Any idea how can I achieve this? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire