title: I am trying to hide and show react native date picker after clicking touchable opacity
body: <p>I am working on a react native application and I am trying to figure out how to hide the datepicker after clicking a touchable opacity component.</p>
  
  <p><strong>Here is the logic for setting up the datetimepicker</strong></p>
  
  <pre><code> const [showCompleted, setShowCompleted] = useState(false);
   const [isHidden, setHidden] = useState(true);
  
   const onChange = (event, selectedDate) =&gt; {
     const completedDate = selectedDate || Date;
     setShowCompleted(Platform.OS === 'ios');
     setCompletedDate(completedDate);
   };
  
   const showDatepicker = () =&gt; {
     if (isHidden === true) {
       setHidden({ isHidden: false });
       setShowCompleted(true);
     } else {
       setHidden({ isHidden: true });
     }
   };
  </code></pre>
  
  <p><strong>Here is the logic for the UI</strong></p>
  
  <pre><code>&lt;TouchableOpacity
      style={{
        height: 50,
        margin: 15,
        backgroundColor: 'white',
        borderRadius: 5
      }}
      onPress={showDatepicker}
    &gt;
      &lt;View flexDirection='row'&gt;
        &lt;Text style={{ color: 'red', fontSize: 15, margin: 15 }}&gt;
          Completed Date
        &lt;/Text&gt;
        &lt;Text style={{ marginTop: 15, fontSize: 14, marginLeft: 140 }}&gt;
          Mar 17, 2020
        &lt;/Text&gt;
      &lt;/View&gt;
    &lt;/TouchableOpacity&gt;
    {isHidden ? (
      &lt;View&gt;
        {showCompleted &amp;&amp; (
          &lt;DateTimePicker
            testID='dateTimePicker'
            placeholder='Completed Date'
            value={completedDate}
            mode='date'
            display='default'
            onChange={onChange}
          /&gt;
        )}
      &lt;/View&gt;
    ) : null}
  </code></pre>
  
  <p>Any thoughts welcome. I am trying to accomplish the same effect as scheduling a new event on an iphone. Where you touch the date and the datepicker comes down and you touch it again and it goes up. Currently, it goes down but I can't figure out how to get it to go back. I think I am overlooking something very simple.</p>