Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Documentation for renderLanguageSelect is inaccurate #95

Open
dino115 opened this issue Jun 23, 2018 · 0 comments
Open

Documentation for renderLanguageSelect is inaccurate #95

dino115 opened this issue Jun 23, 2018 · 0 comments

Comments

@dino115
Copy link

dino115 commented Jun 23, 2018

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 🍻️

@dino115 dino115 changed the title Documentation for renderLanguageSelect inaccurate Documentation for renderLanguageSelect is inaccurate Jun 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant