title: Need formik values in handle submit outside the formik
body: <p>I have this screen in react native where I want to validate the form and submit it and I have the submit button in my header. How can I get the values in handle submit which is outside the formik. Because I couldn't access the values in the custom function handleSubmit.</p>
  <pre><code>React.useLayoutEffect(() =&gt; {
              navigation.setOptions({
                headerTitleAlign: 'center',
                headerTitle: () =&gt; &lt;Text style={styles.titleHeader}&gt;Payment Method&lt;/Text&gt;,
                headerRight: () =&gt; (
                  &lt;Pressable onPress={handleSubmit}&gt;
                    &lt;Text&gt;Done&lt;/Text&gt;
                  &lt;/Pressable&gt;
                ),
              });
            }, [navigation, userId]);
  
      const handleSubmit = async (values: any) =&gt; {
      const data: any = {
        paymentServiceTypeId: defaultPaymentType,
        invoiceNeeded,
        companyName: company,
        vatNumber,
      }
      console.log(values);
    };
           
      return (
              &lt;Formik
                initialValues={initialState}
                onSubmit={(values) =&gt; handleSubmit(values)}
                validationSchema={getValidationSchema(staticValues.static)}
              &gt;
                {({ handleChange, handleBlur, values, touched, errors, setFieldValue }) =&gt; (
                  &lt;&gt;
          {defaultPaymentType == 2 &amp;&amp; (
                      &lt;&gt;
                        &lt;Text style={styles.title}&gt;Company Name&lt;/Text&gt;
                        &lt;View style={styles.textInputView}&gt;
                          &lt;TextInput
                            style={styles.inputText}
                            placeholder={'Company Name'}
                            value={values.company}
                            onChangeText={handleChange('company')}
                            onBlur={handleBlur('company')}
                          /&gt;
                          {touched.company &amp;&amp; errors.company &amp;&amp; &lt;Text style= 
                            {styles.errorText}&gt;{errors.company}&lt;/Text&gt;}
                      &lt;&gt;
                   )}
                 &lt;/Formik&gt;
          
  </code></pre>