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

Can't add onKeyDown event listener with the AutoComplete Customize Input Component #5487

Closed
fiture opened this issue Mar 24, 2017 · 4 comments · Fixed by react-component/select#175 or #5766
Assignees

Comments

@fiture
Copy link

fiture commented Mar 24, 2017

Environment(required)

  • antd version: 2.8.1

What did you do? Please provide steps to re-produce your problem.

function onKeyDown(){
    console.log('E.. not work.');
}

<AutoComplete
            dataSource={['test']}
            style={{ width: 200, height: 50 }}
            optionLabelProp="text"
          >
            <input  onKeyDown={onKeyDown}/>
          </AutoComplete>

What do you expected?

So, any way to add a custom input onKeyDown or onChange event callback with this AutoComplete component?

By the way,I found this: https://github.com/react-component/select/blob/master/src/Select.jsx#L470

It may be the point.

@yesmeck
Copy link
Member

yesmeck commented Apr 6, 2017

Try reinstall node_modules.

@fiture
Copy link
Author

fiture commented Apr 7, 2017

@yesmeck thanks a lot to work with this issue.

It may be able to work independently select component.

But in the AutoComplete component:
https://github.com/ant-design/ant-design/blob/master/components/auto-complete/InputElement.tsx#L14

    return React.cloneElement(this.props.children, {
      ...this.props,
      ref: ele => this.ele = (ele as HTMLInputElement),
    }, null);

The onKeyDown and other props lost... as a result AutoComplete Customize Input Component onKeyDown still not working..

@yesmeck yesmeck reopened this Apr 7, 2017
@yesmeck
Copy link
Member

yesmeck commented Apr 7, 2017

@RaoHai

RaoHai added a commit to RaoHai/ant-design that referenced this issue Apr 14, 2017
ddcat1115 pushed a commit that referenced this issue Apr 22, 2017
@lock
Copy link

lock bot commented May 1, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked and limited conversation to collaborators May 1, 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

Successfully merging a pull request may close this issue.

3 participants