[Android] Hide keyboard when view is destroyed
Fixes #7008
All credit here must go to @enahum, I am merely packing the changes into a PR.
Perhaps we could add an option to control if the Keyboard should dismiss or not, as I mentioned in the issue #7008 this was causing other unforeseen issues, so by adding an option that defaults to true and respecting that option we could then hide the keyboard or leave it opened.
Btw thanks for submitting a PR ;)
I will bow to superior knowledge here! The original patch is working well for us but I can see how it isn't a silver bullet. Perhaps this PR should be closed in favour of another?
FWIW I like the blurOnUnmount option, this is already present in the options but doesn't seem to be respected in this use case, so using that seems to be a good course of action.
We already making checks in our playground. and maybe adding e2e's for such cases. I already debugged that internally with our devs and found out about why Keyboard.dismiss did not work, and made it work, gonna try to see what was that, but mainly we want to reproduce the issue in our playground and introduce a proper solution if Keyboard dismiss should be handled in our side
If it helps, we saw the issue when using Navigation.setRoot to move from a single screen (inside a stack) to a stack with a sideMenu. In this case, if the keyboard was showing when the call is made, it does not dismiss.
I tried to reproduce the issue without the changes mentioned here, but could not reproduce it see.
Let's first reproduce the issue in a minimal environment as the guidelines state and see what is the problem itself and then we might push a fix.