changing setTimeout length

This commit is contained in:
Alex Windett 2017-01-06 10:56:19 +00:00
parent bdc7af27de
commit 8d500cd8d3
2 changed files with 23 additions and 27 deletions

View File

@ -1,10 +1,6 @@
const React = require('react'); const React = require('react');
const Select = require('react-select'); const Select = require('react-select');
const { const SelectAsync = Select.Async
Async
} = Select
const SelectAsync = Async
const SearchAsync = React.createClass({ const SearchAsync = React.createClass({
@ -22,9 +18,7 @@ const SearchAsync = React.createClass({
}); });
}, },
render: function () { options: function(input, callback) {
const options = function(input, callback) {
setTimeout(function() { setTimeout(function() {
callback(null, { callback(null, {
options: [ options: [
@ -38,20 +32,21 @@ const SearchAsync = React.createClass({
// CAREFUL! Only set this to true when there are no more options, // CAREFUL! Only set this to true when there are no more options,
// or more specific queries will not be sent to the server. // or more specific queries will not be sent to the server.
complete: true complete: true
}, 1000); }, 10000);
}); });
} },
render: function () {
return ( return (
<div> <div>
<h1> Async Search </h1> <h1> Async Search </h1>
<SelectAsync <SelectAsync
ref="stateSelect" ref="stateSelectAsync"
loadOptions={options} loadOptions={this.options}
value={this.state.selectValue} value={this.state.selectValue}
isLoading={true}
onChange={this.updateValue} onChange={this.updateValue}
multi={this.props.multi} multi={true}
/> />
</div> </div>
) )

View File

@ -33,6 +33,7 @@ const Search = React.createClass({
<h1> {this.props.multi ? 'Multi' : 'Single'} Search </h1> <h1> {this.props.multi ? 'Multi' : 'Single'} Search </h1>
<Select <Select
ref="stateSelect" ref="stateSelect"
className="is-open"
autofocus autofocus
options={options} options={options}
name="selected-state" name="selected-state"