wix-incubator / react-native-keyboard-aware-scrollview

Created by artald
MIT License
491 stars 97 forks source link

Add defensive checks before calling isFocused #44

Open bausmeier opened 5 years ago

bausmeier commented 5 years ago

When making use of useRef for refs forwarded to a custom functional component there is potential for the isFocused function not to be defined. Adding some extra checks to make sure that it is a function before calling it prevents an error from being thrown.

richardgirges commented 4 years ago

It would be great to get this one merged! We're running into scenarios where the ref may be null.

terryatgithub commented 3 years ago

yes, come across the same issue, pls help solve it asap, thanks alot

TypeError: Cannot read property 'isFocused' of null at KeyboardAwareBase.js:84 at Array.some () at KeyboardAwareScrollView._scrollToFocusedTextInput (KeyboardAwareBase.js:83) at KeyboardAwareScrollView._onKeyboardWillShow (KeyboardAwareBase.js:98) at RCTDeviceEventEmitter.emit (EventEmitter.js:189) at MessageQueue.callFunction (MessageQueue.js:416) at MessageQueue.js:109 at MessageQueue.guard (MessageQueue.js:364) at MessageQueue.callFunctionReturnFlushedQueue (MessageQueue.js:108) at debuggerWorker.aca173c4.js:4