title: How to set value of datepicker in react native formik?
body: <p>I'm trying to use react-native-datepicker in a Formik form.</p>
  <p>I Have</p>
  <pre><code>               &lt;Formik
                  initialValues={inits}
                  validationSchema={() =&gt;
                    yup.object({
                      username: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan Username&quot;),
                      nama: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan Nama Lengkap&quot;),
                      nik: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan NIK&quot;),
                      no_telp: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan Nomor Telphone&quot;),
                      email: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan Email&quot;),
                      alamat: yup
                        .string()
                        .nullable()
                        .required(&quot;Kamu belum memasukan Alamat&quot;),
                    })
                  }
                  enableReinitialize={true}
                  onSubmit={(values) =&gt; {
                    console.log(values);
                  }}
                &gt;
                  {({
                    handleChange,
                    handleSubmit,
                    values,
                    errors,
                    setFieldTouched,
                    touched,
                  }) =&gt; (
                    &lt;View&gt;
                      &lt;InputText
                        name=&quot;username&quot;
                        label=&quot;Username&quot;
                        placeholder=&quot;Username&quot;
                        // keyboardType=&quot;numeric&quot;
                        onChangeText={handleChange(&quot;username&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;username&quot;)}
                        value={values.username}
                        errors={errors}
                        touched={touched}
                      /&gt;
  
                      &lt;InputText
                        name=&quot;nama&quot;
                        label=&quot;Nama Lengkap&quot;
                        placeholder=&quot;Nama Lengkap&quot;
                        // keyboardType=&quot;numeric&quot;
                        onChangeText={handleChange(&quot;nama&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;nama&quot;)}
                        value={values.nama}
                        errors={errors}
                        touched={touched}
                      /&gt;
  
                      &lt;InputText
                        name=&quot;nik&quot;
                        label=&quot;NIK&quot;
                        placeholder=&quot;Nomor Induk Keluarga&quot;
                        keyboardType=&quot;numeric&quot;
                        onChangeText={handleChange(&quot;nik&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;nik&quot;)}
                        value={values.nik}
                        errors={errors}
                        touched={touched}
                      /&gt;
  
                      &lt;View&gt;
                        &lt;InputText
                          name=&quot;tgllahir&quot;
                          label=&quot;Tanggal Lahir&quot;
                          placeholder=&quot;test&quot;
                          onChangeText={moment(date).format(&quot;DD/MM/YYYY&quot;)}
                          value={moment(date).format(&quot;DD/MM/YYYY&quot;)}
                          errors={errors}
                          touched={touched}
                        /&gt;
                        &lt;TouchableOpacity
                          style={style.formIcon}
                          onPress={() =&gt; setOpen(true)}
                        &gt;
                          &lt;Image source={calendar} /&gt;
                          &lt;DatePicker
                            modal
                            mode=&quot;date&quot;
                            open={open}
                            date={date}
                            onConfirm={(date) =&gt; {
                              setOpen(false);
                              setDate(date);
                            }}
                            onCancel={() =&gt; {
                              setOpen(false);
                            }}
                          /&gt;
                        &lt;/TouchableOpacity&gt;
                      &lt;/View&gt;
  
                      &lt;InputText
                        name=&quot;no_telp&quot;
                        label=&quot;Telphone&quot;
                        placeholder=&quot;Telphone&quot;
                        keyboardType=&quot;numeric&quot;
                        onChangeText={handleChange(&quot;no_telp&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;no_telp&quot;)}
                        value={values.no_telp}
                        errors={errors}
                        touched={touched}
                      /&gt;
  
                      &lt;InputText
                        name=&quot;email&quot;
                        label=&quot;Email&quot;
                        placeholder=&quot;Email&quot;
                        onChangeText={handleChange(&quot;email&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;email&quot;)}
                        value={values.email}
                        errors={errors}
                        touched={touched}
                      /&gt;
                      &lt;InputText
                        name=&quot;alamat&quot;
                        label=&quot;Alamat&quot;
                        placeholder=&quot;Alamat&quot;
                        onChangeText={handleChange(&quot;alamat&quot;)}
                        onBlur={() =&gt; setFieldTouched(&quot;alamat&quot;)}
                        value={values.alamat}
                        errors={errors}
                        touched={touched}
                      /&gt;
  
                      &lt;Button
                        title=&quot;Buat Akun&quot;
                        variant=&quot;primary&quot;
                        size=&quot;lg&quot;
                        width=&quot;100%&quot;
                        loading={loading_btn}
                        onPress={handleSubmit}
                      /&gt;
                    &lt;/View&gt;
                  )}
                &lt;/Formik&gt;
  </code></pre>
  <p>I want to take the value of datepicker item into the textinput value, but i don understand to make it. I set the value of text input with moment package and then call (date) , to call the date of datepicker, but couldnt find the value.</p>
  <p><a href="https://i.stack.imgur.com/K2Nkq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/K2Nkq.jpg" alt="enter image description here" /></a></p>