what can happen and actually happen to us is that the component itself might be already unmounted but the setTimeout callout will still happen trying to access those fields and crash.
This was happening in following situation:
React-Native-Emoji-Picker is opened in Modal Window.
User starts typing in search input.
User immediately hits back button on Android to close the modal.
Component gets unmounted but setTimeout call is already queued so it will happen anyway.
That if just guards access to those fields only if component is still mounted.
Relate to any issue?
Nope
Breaking change?
Nope
What this PR does?
Because the following code is happening in
setTimeout
call:what can happen and actually happen to us is that the component itself might be already unmounted but the
setTimeout
callout will still happen trying to access those fields and crash. This was happening in following situation:React-Native-Emoji-Picker
is opened in Modal Window.search
input.setTimeout
call is already queued so it will happen anyway.That
if
just guards access to those fields only if component is still mounted.