This repository was archived by the owner on Oct 11, 2022. It is now read-only.
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Documentation for renderLanguageSelect is inaccurate #95
Open
Description
Hi,
the documentation for a custom renderLanguageSelect
describes the onChange
method with a parameter for selectedValue.
onChange: (selectedValue: string) => void,
But as you can see in the code component, the onChange method requires an event handler. It calls preventDefault
, stopPropagation
and access the value through ev.currentTarget.value
(line 44).
I have worked around this by calling onChange
with a fake event with noops for the two methods and the newly selectedValue nested in currentTarget.value
. So for now it is not a big problem, and maybe it helps other people to implement an own language selector which doesn't depends on a select input.
createChangeLanguageHandler: ({ onChange }) => newValue => {
// call onChange with a fake event
onChange({
preventDefault: () => {},
stopPropagation: () => {},
currentTarget: { value: newValue },
});
}
Please update the documentation or improve the onChange handler to work as described.
Keep up your good work! Cheers 🍻️
Metadata
Metadata
Assignees
Labels
No labels