因为官网没有给出这个x的点击事件的监听hook,所以只能本人曲线救过。

依据文档阐明:

onSearch

The callback function triggered when you click on the search-icon, the clear-icon or press the Enter key

能够理解到onSearch的触发条件。

而后通过event对象进行触发类型的判断。

onSearch = (value, event) => {    if (event.nativeEvent.type === 'click' && value === '') {        // listen click        setTimeout(() => {            // TODO        }, 300);    }        if (event.nativeEvent.type === 'enter' && value === '') {        // Enter        setTimeout(() => {            // TODO        }, 300);    }    if (value === '') {        return;    }    // search};