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
Fixed onModalHide being called early #733
base: master
Are you sure you want to change the base?
Conversation
@mmazzarolo @alimek Would you please take a look at this one? |
@ancyrweb Can you please check this when you get the time. Thanks! |
The |
Any updates on this? @mmazzarolo Is this still an active repo? asking since no PRs have been merged since almost a year despite having 34 PRs open. |
Thanks for the reference @mmazzarolo. There seems to be good amount of interest from everyone on that thread then what needs to happen to get PRs reviewed & merged? |
+1 |
Sadly 99% of the interest in that thread comes from folks who just say "I'm interested" without ever having contributed. There have been a few people who contributed (e.g., @ancyrweb, who became a maintainer and a couple of other who declined the invite to become contributors), so I'm definitely open to it if anyone is willing to commit to it 👍 |
Overview
The
onModalHide
is being called too early (i.e. before actually hiding the modal) and if we try to focus an element on that callback it will fail due to RN focus trap.Unfortunately there is no easy way to know when the modal has been hidden (RN does not have
onHide
prop). But I found that we can fix this be delaying the callback by 2 cycles, first one to ensure that the modal content has been unmounted and the second to ensure that the focus trap is no longer active (after refocusing the element that triggered opening the modal).Test Plan
Consider the example stated above where we try to focus an element
onModalHide
callback.Kooha-2023-02-12-13-20-44.mp4
Kooha-2023-02-12-13-22-42.mp4