kirillzyusko / react-native-keyboard-controller

Keyboard manager which works in identical way on both iOS and Android
https://kirillzyusko.github.io/react-native-keyboard-controller/
MIT License
1.38k stars 55 forks source link

fix: not detectable keyboard view on iOS #471

Closed kirillzyusko closed 3 weeks ago

kirillzyusko commented 3 weeks ago

πŸ“œ Description

Handle corner case when keyboard view is not detectable on iOS.

πŸ’‘ Motivation and Context

Sometimes app may have more than one UITextEffectsWindow and nested UIInputSetContainerView may not have a children (as on a screenshot):

image

In this case our previous code would return nil and full library functionality would be broken. From a screenshot above it's clear, that we should continue our search.

So to fix the problem I removed one break signal (loop over windows). Thus if we encounter empty UIInputSetContainerView we will continue search and will go to the next window (which will return a correct reference to the keyboard view).

Additionally I added return statement when we found a view (before 3 break statements served for this purpose, but since I removed one - the order is slightly broken, so to keep better backward compatibility and don't execute additional cycles if view was found - I used return statement there).

See the context when we may have more than one UITextEffectsWindow in https://github.com/kirillzyusko/react-native-keyboard-controller/issues/338#issuecomment-2163904827

πŸ“’ Changelog

iOS

πŸ€” How Has This Been Tested?

Tested on iPhone 15 Pro (iOS 17.5).

πŸ“Έ Screenshots (if appropriate):

Before After

πŸ“ Checklist

github-actions[bot] commented 3 weeks ago

πŸ“Š Package size report

Current size Target Size Difference
144004 bytes 144033 bytes -29 bytes πŸ“‰