From a0799eaaeab5bb2eada2b8e3257802b306691262 Mon Sep 17 00:00:00 2001 From: Jochen Berger Date: Mon, 29 May 2017 10:52:20 +0200 Subject: [PATCH] don't apply additional filters to the result that is returned from the remote endpoint --- src/Async.js | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Async.js b/src/Async.js index de2c8ad9ad..b7d9d2318c 100644 --- a/src/Async.js +++ b/src/Async.js @@ -1,14 +1,12 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import Select from './Select'; -import stripDiacritics from './utils/stripDiacritics'; const propTypes = { autoload: PropTypes.bool.isRequired, // automatically call the `loadOptions` prop on-mount; defaults to true cache: PropTypes.any, // object to use to cache results; set to null/false to disable caching children: PropTypes.func.isRequired, // Child function responsible for creating the inner Select component; (props: Object): PropTypes.element - ignoreAccents: PropTypes.bool, // strip diacritics when filtering; defaults to true - ignoreCase: PropTypes.bool, // perform case-insensitive filtering; defaults to true + filterOption: PropTypes.bool, // method to filter a single option (option, filterString) loadingPlaceholder: PropTypes.oneOfType([ // replaces the placeholder while options are loading PropTypes.string, PropTypes.node @@ -35,12 +33,13 @@ const propTypes = { const defaultCache = {}; +const constantlyTrue = () => true; + const defaultProps = { autoload: true, cache: defaultCache, children: defaultChildren, - ignoreAccents: true, - ignoreCase: true, + filterOption: constantlyTrue, loadingPlaceholder: 'Loading...', options: [], searchPromptText: 'Type to search', @@ -139,15 +138,7 @@ export default class Async extends Component { } _onInputChange (inputValue) { - const { ignoreAccents, ignoreCase, onInputChange } = this.props; - - if (ignoreAccents) { - inputValue = stripDiacritics(inputValue); - } - - if (ignoreCase) { - inputValue = inputValue.toLowerCase(); - } + const { onInputChange } = this.props; if (onInputChange) { onInputChange(inputValue);