-
Notifications
You must be signed in to change notification settings - Fork 72
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
Custom Input #131
Comments
🎷 I managed like so import React, { Component, PropTypes } from 'react';
import SearchInput, { createFilter } from 'react-search-input';
import { TextField } from 'material-ui';
const KEYS_TO_FILTERS = ['name', 'label'];
class FacetList extends Component {
constructor(props) {
super(props);
this.state = {
searchTerm: props.searchTerm,
};
this.searchUpdated = this.searchUpdated.bind(this);
}
searchUpdated(event) {
this.setState({ searchTerm: event.target.value });
}
render() {
const filteredItems = this.props.items.filter(createFilter(this.state.searchTerm, KEYS_TO_FILTERS));
return (
<div>
<TextField hintText="Search..." {...SearchInput.getDefaultProps()} onChange={this.searchUpdated} />
{
filteredItems
.map((item) => {
return (
<p key={item.id}>
{item.label}
</p>
);
})
}
</div>
);
}
}
FacetList.propTypes = {
items: PropTypes.array.isRequired,
searchTerm: PropTypes.string,
};
FacetList.defaultProps = {
searchTerm: '',
};
export default FacetList; |
Hi. A possible solution here: #144 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thanks for the plugin.
How I can add material-ui element against simple input?
The text was updated successfully, but these errors were encountered: