I have an issue with TextInput in react native
In Profile screen I have Inputs when user update, i send a request to our API, it's work before well!
But now when i update data and open debugger i got this message
Native TextInput(123456) is 7 events ahead of JS - try to make your JS faster
And for some reason after submitting the data to API I got this error
Exception '*** -[__NSCFConstantString substringToIndex:]: Index 3 out of bounds; string length 0' was thrown while invoking sendRequest on target Networking with params
I use Formik and yup, For Text input, i use native-base
Code snippet
state = {
initialValues: {
name: '',
email: '',
password: '',
password_confirmation: '',
age: '',
gender: '',
country_id: '',
},
}
<Formik
enablereinitialize
validationSchema={formSchema}
initialValues={this.state.initialValues}
onSubmit={(values, actions) => {
this.updateProfile(values);
console.log(values), actions.resetForm();
}}>
{({
handleChange,
handleBlur,
touched,
errors,
handleSubmit,
values,
setFieldValue,
}) => (
<View>
.....
<Item style={styles.item} floatingLabel>
<Label style={styles.formLabel}>password</Label>
<Input
style={styles.value}
rounded
secureTextEntry
onChangeText={handleChange('password')}
onBlur={handleBlur('password')}
value={values.password}
/>
</Item>
<Text style={styles.errorText}>
{touched.password && errors.password}
</Text>
<Item style={styles.item} floatingLabel>
<Label style={styles.formLabel}>
confirm password
</Label>
<Input
style={styles.value}
rounded
secureTextEntry
onChangeText={handleChange('password_confirmation')}
onBlur={handleBlur('password_confirmation')}
value={values.password_confirmation}
/>
</Item>
<Text style={[styles.errorText, {paddingBottom: 5}]}>
{touched.password_confirmation &&
errors.password_confirmation}
</Text>