Improve events on SearchBox

This commit is contained in:
Gordon
2018-12-05 13:03:20 -06:00
parent 30e6b2c00d
commit 4801f891a4
2 changed files with 18 additions and 2 deletions

View File

@@ -118,8 +118,9 @@ export interface SearchBoxProps extends CommonWidgetProps {
reset?: JSX.Element;
loadingIndicator?: JSX.Element;
onSubmit?: (...args: any[]) => any;
onReset?: (...args: any[]) => any;
onSubmit?: (event: React.SyntheticEvent<HTMLFormElement>) => any;
onReset?: (event: React.SyntheticEvent<HTMLFormElement>) => any;
onChange?: (event: React.SyntheticEvent<HTMLInputElement>) => any;
}
/**
* The SearchBox component displays a search box that lets the user search for a specific query.

View File

@@ -216,6 +216,21 @@ import { Hit, connectRefinementList, connectMenu } from 'react-instantsearch-cor
</InstantSearch>;
};
(() => {
function onSearchBoxChange(event: React.SyntheticEvent<HTMLInputElement>) {
}
function onSearchBoxReset(event: React.SyntheticEvent<HTMLFormElement>) {
}
function onSearchBoxSubmit(event: React.SyntheticEvent<HTMLFormElement>) {
}
<SearchBox
onChange={onSearchBoxChange} onReset={onSearchBoxReset} onSubmit={onSearchBoxSubmit}
submit={<></>} />;
});
import { createInstantSearch } from 'react-instantsearch-dom/server';
// import { createServer } from 'http';
declare function createServer(handler: (req: any, res: any) => any): any;