react-native-merlin icon indicating copy to clipboard operation
react-native-merlin copied to clipboard

When you use validation on a component with multiple child inputs pressing enter on the previous input will throw an error

Open sam-parallax opened this issue 4 years ago • 0 comments

  • Set up two components, one standard input and one custom component with multiple inputs as children

Screenshot 2021-11-08 at 10 41 50

  • Press enter while in the first component, it will try to find the next input field from the ref but as the ref is actually a custom component and not an input the 'current' value is null. This will throw an error. Merlin.js (line 141)

Screenshot 2021-11-08 at 10 37 44

const nextFocusableInput = nextInputs.find( (element) => inputRefs[element.props.name]?.current?.focus )

This would ignore the next input and just submit the form, not ideal but would stop the error from happening. The other solution would be to look for input children in a custom component with a ref.

sam-parallax avatar Nov 08 '21 10:11 sam-parallax