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

Cannot use with react-autocomplete #1175

Open
mellis481 opened this issue Jul 17, 2018 · 0 comments
Open

Cannot use with react-autocomplete #1175

mellis481 opened this issue Jul 17, 2018 · 0 comments

Comments

@mellis481
Copy link

I'm attempting to wrap react-autocomplete's component with RRF, but I'm having issues. Here is what I have:

const typeaheadComponent = (props: any) => (
  <Autocomplete
    getItemValue={(item: string) => item}
    items={this.getOptions()}
    renderInput={(props: any) => (
      <input type="text" {...props} />
    )}
    renderItem={(item: string, isHighlighted: boolean) => {
      <div key={uuid.v4()}>{item}</div>;
    }}
    value={value}
    onChange={this.onChange}
    onSelect={this.onSelect}
    inputProps={{
      onKeyUp: this.onKeyPress
    }}
  />
);

return (
  <Control.text
    component={typeaheadComponent}
    mapProps={{
      value: props => props.modelValue
    }}
    model={model}
    id={model}
    value={value}
    persist
  />
);

}

I've reviewed issue #887 and also the custom controls documentation, but I'm still struggling to understand what I'm missing.

With the code above, when I focus on my textbox and press a key, the RRF rrf/clearIntents action fires, but nothing else. Also, focus on the input blurs after each press of the keyboard.

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