fix: do not substitute delegate back if it's nil
#642
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
Fixes a problem when all events such as
onFocus
/onBlur
/etc. will stop working after keyboard dismissal.💡 Motivation and Context
It looks like a delegate in original
TextInput
can be somehow substituted and we are loosing a pointer to original delegate. If on keyboard-hide event we'll substitute delegate withnil
- we will make all events, such asonFocus
,onBlur
etc. not coming to JS.So the most obvious decision is to check, if we actually have a delegate and do a substitution only in this case.
Of course a rhetorical question arises - if we had original delegate, then injected our delegate, then it was substituted with a new one -> turns out that our events will not come, right? Right. But:
keyboard-controller
rather than disable all events at framework level;So yeah, the problem is somewhere deeper, but I don't have an access to the code so can't debug what exactly happens there. So for now it'll be safer not to ruin the RN framework and merge this fix 🙃
Closes #456
📢 Changelog
iOS
🤔 How Has This Been Tested?
Tested manually on iOS 15.2
📸 Screenshots (if appropriate):
before.mp4
after.mp4
📝 Checklist