react-input-color
react-input-color copied to clipboard
Fix for Issue #57: Attempt to change hex code by typing results in #2NanNanNan
Addresses #57. Changes the behaviour for the hex input so that the hex value will only change if the user tabs away from the input or if the user presses the enter key.
Added a local hexInput state that stores the input value for the hex text input. hexInput value also gets updated in a useEffect hook whenever the parent hex value changes.
Updating the parent hex value is moved to onBlur and OnKeyUp. A regex check was added to changeHex to ensure changeColor is only called if the hex value is valid.