mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Add onSearchCloseRequested prop to react-native-material-ui
This commit is contained in:
1
types/react-native-material-ui/index.d.ts
vendored
1
types/react-native-material-ui/index.d.ts
vendored
@@ -426,6 +426,7 @@ export interface Searchable {
|
||||
onSearchClosed?(): void;
|
||||
onSearchPressed?(): void;
|
||||
onSubmitEditing?(): void;
|
||||
onSearchCloseRequested?(): void;
|
||||
}
|
||||
|
||||
export interface ToolBarRightElement {
|
||||
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
Checkbox,
|
||||
Dialog,
|
||||
DialogDefaultActions,
|
||||
BottomNavigation
|
||||
BottomNavigation,
|
||||
Toolbar
|
||||
} from 'react-native-material-ui';
|
||||
|
||||
const theme = {
|
||||
@@ -113,3 +114,27 @@ class BottomNavigationExample extends React.Component<null, {active: string}> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ToolbarExample extends React.Component<{}, {search: string}> {
|
||||
state = {
|
||||
search: ''
|
||||
};
|
||||
|
||||
handleResults(search: string) {
|
||||
this.setState({ search });
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Toolbar
|
||||
centerElement="Collections"
|
||||
searchable={{
|
||||
autoFocus: true,
|
||||
placeholder: 'Search',
|
||||
onChangeText: (text: string) => this.handleResults(text),
|
||||
onSearchCloseRequested: () => this.handleResults(''),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user