Skip to content
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

How to handle onChange event for input #3

Open
martyall opened this issue Oct 12, 2017 · 2 comments
Open

How to handle onChange event for input #3

martyall opened this issue Oct 12, 2017 · 2 comments

Comments

@martyall
Copy link

in MaterialUI.Input the type of onChange is

onChange :: Option InputOption (UnknownType)

but it seems like you would want to use

onChange :: Option InputOption (EventHandlerOpt)

if this is intentional, can you please explain how I can convert the following piece of code using purescript-react to material ui?

addressInput :: ReactElement
addressInput = 
    D.input [ P._type "text"
            , P.placeholder "0xdeadbeef"
            , P.onChange \e -> dispatch (UpdateAddress (unsafeCoerce e).target.value)
            ] []
@martyall
Copy link
Author

I see now that this module was auto-generated, which might make it more complicated...

@nwolverson
Copy link
Owner

nwolverson commented Oct 12, 2017

Right now I think something like UnknownType (toForeign yourHandler). The constructor is exposed as an escape hatch so you can do anything (and shoot your foot), as I'm sure some more types won't be usefully translated.

Probably if the generator can't be improved there should be at least a way of overriding it without editing the generated code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants