-
Notifications
You must be signed in to change notification settings - Fork 18
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
inputRef is null with custom input elements #56
Comments
I've determined the issue occurs when a custom React element is passed which does not implement ref forwarding. I'll add an error message for users to make it more clear what the problem is (it took me a while to realize myself!). |
After trying some things, I'm not sure this is feasible. It's difficult to check programmatically if a ref can be added to an element because React doesn't throw an error, it just writes a warning to the console, and then we're left with a null ref. I can't test for null ref assignments though, because that also happens when the input element is unmounted, and I can't additionally test if the ref was already null, because the input element generator might change while an element is already being displayed (therefore ref is not null). I can't find a way to distinguish between an element unmounting and a ref failing to be assigned. 😓 |
Hello @Phanabani , Good catch. What about those?
What do think? Oxyno-zeta |
I like these ideas! I think I'll add the documentation really quickly for 2.3.1, then possibly try the trick you suggested for 2.3.2 (if it works out). Your third point is also very cool! I'll add an issue to keep it in mind for the future. |
TypeError: inputRef is null
when using custom input elements. I will investigate why the ref never gets set. I'm wondering if it's a change from React 16 -> 18.The text was updated successfully, but these errors were encountered: