furqanZafar / react-selectize

http://furqanzafar.github.io/react-selectize/
Apache License 2.0
704 stars 138 forks source link

onOpenChange called with open=true when closing multi-select #134

Closed axelboc closed 1 year ago

axelboc commented 7 years ago

When closing a multi-select, onOpenChange(open) is called twice: first with open=true and then again with open=false.

To replicate the issue, paste this code in the JSX tab of the first multi-select demo and open the console:

// MultiSelect = require("react-selectize").MultiSelect

Form = React.createClass({

    // render :: a -> ReactElement
    render: function(){
        var self = this, 
            options = ["apple", "mango", "grapes", "melon", "strawberry"].map(function(fruit){
                return {label: fruit, value: fruit}
            });
        return <MultiSelect options = {options} placeholder = "Select fruits" onOpenChange = {function (open) {console.log(open);}}></MultiSelect>
    }

});

render(<Form/>, mountNode)

Console output:

screen shot 2017-01-20 at 1 20 15 pm

true should only be printed once, when the drop-down is opened, which is the case with SimpleSelect.