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

typeahead: how to set initial value #128

Open
mgrivera opened this issue Aug 19, 2019 · 0 comments
Open

typeahead: how to set initial value #128

mgrivera opened this issue Aug 19, 2019 · 0 comments

Comments

@mgrivera
Copy link

Hi all,

I'm opening a modal and passing an item to edit in react-jsonschema-form. Sometimes a value for the typeahead comes, sometimes not. When there is no initial value, the typeahead works fine. It shows options and allows to choose one. I pass a function to mapping to return id instead of the string that was chosen:

'compania': {
    "ui:field": "typeahead",
    typeahead: {
        id: "compania_typeahead", 
        options: proveedores.map(x => x.nombre),
        mapping: (event) => { 
            const sel = proveedores.find(x => x.nombre === event); 
            return sel.proveedor; 
        }, 
    }

However, when some value comes for the typeahead field as an initial value, I get this error in the console:

Warning: Failed prop type: Invalid prop selected supplied to TypeaheadContainer(WrappedTypeahead).

Can somebody help me in finding the right way of doing this???
Many thanks and bye ....

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

1 participant