Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add defensive checks before calling isFocused #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bausmeier
Copy link

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.

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
Copy link

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

@terryatgithub
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants