title: Native base DatePicker inside a functional component throwing error
body: <p>I am trying to use native base <a href="https://docs.nativebase.io/Components.html#date-picker-def-headref" rel="nofollow noreferrer">Datepicker</a> but I am getting this error. On clicking to date picked I want to display the date selector calendar and pick a date but I am getting an error.</p>
  <p>Here is my code</p>
  <pre><code>const PublicMenu = () =&gt; {
  const [date, setDate] = useState(&quot;&quot;);
  return(
     &lt;View
                    style={{
                      borderColor: &quot;black&quot;,
                      borderWidth: 2,
                      height: hp(&quot;3.5%&quot;),
                      width: wp(&quot;40%&quot;),
                    }}
                  &gt;
                    &lt;DatePicker
                      defaultDate={new Date(2018, 4, 4)}
                      minimumDate={new Date(2018, 1, 1)}
                      maximumDate={new Date(2018, 12, 31)}
                      locale={&quot;en&quot;}
                      timeZoneOffsetInMinutes={undefined}
                      modalTransparent={false}
                      animationType={&quot;fade&quot;}
                      androidMode={&quot;default&quot;}
                      placeHolderText='Select date'
                      textStyle={{ color: &quot;green&quot; }}
                      placeHolderTextStyle={{ color: &quot;#d3d3d3&quot; }}
                      onDateChange={(date) =&gt; setDate(date)}
                      disabled={false}
                    /&gt;
                  &lt;/View&gt;
  
  )
  };
  </code></pre>
  <p>On clicking the date picker I am getting this error, do anyone know how can I resolve it.</p>
  <p>ERROR BELOW:</p>
  <pre><code>Invariant Violation: A date or time should be specified as `value`.
  
  This error is located at:
      in Picker (at DatePicker.js:94)
      in RCTView (at View.js:34)
      in View (at AppContainer.js:106)
      in RCTView (at View.js:34)
      in View (at AppContainer.js:132)
      in AppContainer (at Modal.js:220)
      in RCTView (at View.js:34)
      in View (at Modal.js:242)
      in RCTModalHostView (at Modal.js:228)
      in Modal (at DatePicker.js:80)
      in RCTView (at View.js:34)
      in View (at DatePicker.js:79)
      in RCTView (at View.js:34)
      in View (at DatePicker.js:64)
      in RCTView (at View.js:34)
      in View (at DatePicker.js:63)
      in DatePicker (at PubishMenu.js:116)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:108)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:100)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:93)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:84)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:83)
      in RCTScrollContentView (at ScrollView.js:1124)
      in RCTScrollView (at ScrollView.js:1260)
      in ScrollView (at ScrollView.js:1286)
      in ScrollView (at PubishMenu.js:82)
      in RCTView (at View.js:34)
      in View (at PubishMenu.js:42)
      in PublicMenu (at SceneView.tsx:122)
      in StaticContainer
      in StaticContainer (at SceneView.tsx:115)
      in EnsureSingleNavigator (at SceneView.tsx:114)
      in SceneView (at useDescriptors.tsx:153)
      in RCTView (at View.js:34)
      in View (at CardContainer.tsx:245)
      in RCTView (at View.js:34)
      in View (at CardContainer.tsx:244)
      in RCTView (at View.js:34)
      in View (at CardSheet.tsx:33)
      in ForwardRef(CardSheet) (at Card.tsx:573)
      in RCTView (at View.js:34)
      in View (at createAnimatedComponent.js:165)
      in AnimatedComponent (at createAnimatedComponent.js:215)
      in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:555)
      in PanGestureHandler (at GestureHandlerNative.tsx:13)
      in PanGestureHandler (at Card.tsx:549)
      in RCTView (at View.js:34)
      in View (at createAnimatedComponent.js:165)
      in AnimatedComponent (at createAnimatedComponent.js:215)
      in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:544)
      in RCTView (at View.js:34)
      in View (at Card.tsx:538)
      in Card (at CardContainer.tsx:206)
      in CardContainer (at CardStack.tsx:620)
      in RCTView (at View.js:34)
      in View (at Screens.tsx:84)
      in MaybeScreen (at CardStack.tsx:613)
      in RCTView (at View.js:34)
      in View (at Screens.tsx:54)
      in MaybeScreenContainer (at CardStack.tsx:495)
      in CardStack (at StackView.tsx:462)
      in KeyboardManager (at StackView.tsx:458)
      in SafeAreaProviderCompat (at StackView.tsx:455)
      in RCTView (at View.js:34)
      in View (at StackView.tsx:454)
      in StackView (at createStackNavigator.tsx:87)
      in StackNavigator (at HomeNavigation.js:34)
      in HomeNavigation (at SceneView.tsx:122)
      in StaticContainer
      in StaticContainer (at SceneView.tsx:115)
      in EnsureSingleNavigator (at SceneView.tsx:114)
      in SceneView (at useDescriptors.tsx:153)
      in RCTView (at View.js:34)
      in View (at CardContainer.tsx:245)
      in RCTView (at View.js:34)
      in View (at CardContainer.tsx:244)
      in RCTView (at View.js:34)
      in View (at CardSheet.tsx:33)
      in ForwardRef(CardSheet) (at Card.tsx:573)
      in RCTView (at View.js:34)
      in View (at createAnimatedComponent.js:165)
      in AnimatedComponent (at createAnimatedComponent.js:215)
      in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:555)
      in PanGestureHandler (at GestureHandlerNative.tsx:13)
      in PanGestureHandler (at Card.tsx:549)
      in RCTView (at View.js:34)
      in View (at createAnimatedComponent.js:165)
      in AnimatedComponent (at createAnimatedComponent.js:215)
      in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:544)
      in RCTView (at View.js:34)
      in View (at Card.tsx:538)
      in Card (at CardContainer.tsx:206)
      in CardContainer (at CardStack.tsx:620)
      in RCTView (at View.js:34)
      in View (at Screens.tsx:84)
      in MaybeScreen (at CardStack.tsx:613)
      in RCTView (at View.js:34)
      in View (at Screens.tsx:54)
      in MaybeScreenContainer (at CardStack.tsx:495)
      in CardStack (at StackView.tsx:462)
      in KeyboardManager (at StackView.tsx:458)
      in RNCSafeAreaProvider (at SafeAreaContext.tsx:74)
      in SafeAreaProvider (at SafeAreaProviderCompat.tsx:42)
      in SafeAreaProviderCompat (at StackView.tsx:455)
      in RCTView (at View.js:34)
      in View (at StackView.tsx:454)
      in StackView (at createStackNavigator.tsx:87)
      in StackNavigator (at navigations/index.js:18)
      in RCTSafeAreaView (at SafeAreaView.js:51)
      in ForwardRef(SafeAreaView) (at navigations/index.js:17)
      in AppNavigator (at Main.js:26)
      in Main (at App.js:13)
      in EnsureSingleNavigator (at BaseNavigationContainer.tsx:409)
      in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:91)     
      in ThemeProvider (at NavigationContainer.tsx:90)
      in ForwardRef(NavigationContainer) (at App.js:12)
      in Provider (at App.js:11)
      in App (created by ExpoRoot)
      in ExpoRoot (at renderApplication.js:45)
      in RCTView (at View.js:34)
      in View (at AppContainer.js:106)
      in DevAppContainer (at AppContainer.js:121)
      in RCTView (at View.js:34)
      in View (at AppContainer.js:132)
      in AppContainer (at renderApplication.js:39)
  at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
  at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl      
  at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error  
  at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error   
  at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
  at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
  at node_modules\react-native\Libraries\Core\ReactFiberErrorDialog.js:43:2 in showErrorDialog
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:15257:32 in logCapturedError
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:15361:20 in logError
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:16597:12 in update.callback
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:7106:2 in callCallback
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:7127:20 in commitUpdateQueue
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:15801:25 in commitLifeCycles
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18744:22 in commitLayoutEffects
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:265:4 in invokeGuardedCallbackImpl
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:476:2 in invokeGuardedCallback
  at node_modules\react-native\Libraries\Renderer\implementations\ReactNativeRenderer-dev.js:18483:29 in commitRootImpl
  </code></pre>