From 71c3a19635d989f1ed99119bf230856d9faeef21 Mon Sep 17 00:00:00 2001
From: afc163 <afc163@gmail.com>
Date: Mon, 20 Feb 2017 16:31:54 +0800
Subject: Fix controlled open

---
 src/TimePicker.jsx | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

(limited to 'src/TimePicker.jsx')

diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index 4d7d4d6..e9d6d15 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -169,19 +169,16 @@ const Picker = React.createClass({
     );
   },
 
-  setOpen(open, callback) {
+  setOpen(open) {
     const { onOpen, onClose } = this.props;
     if (this.state.open !== open) {
-      this.setState({
-        open,
-      }, callback);
-      const event = {
-        open,
-      };
+      if (!('open' in this.props)) {
+        this.setState({ open });
+      }
       if (open) {
-        onOpen(event);
+        onOpen({ open });
       } else {
-        onClose(event);
+        onClose({ open });
       }
     }
   },
-- 
cgit v1.2.3

