i have a form that needs to make some validations to automaticall fill another fields, i want that function to be called automatically after all the required values are filled, i tried to do this with one onChange on the last field but it wouldnt work if the user fill that input before the other ones.
any suggestion? this is my api call
const getRFC = ({vLastName,vSecondLastName,vName,vSecondName,vBirthDate}) => {
ForceApi.post(`/GetRfcController.php`, { vName, vSecondName, vLastName, vSecondLastName, vBirthDate })
.then(res => {
console.log(res.data.resultRFC);
setvRFC(res.data.resultRFC);
})
}
this are my text inputs and date picker
return (
<ScrollView>
<View style={styles.buttonContainer}>
<View style={styles.inputContainer}>
<TextInput style={styles.inputs}
placeholder="Nombre"
underlineColorAndroid='transparent'
onChangeText={newvName => setvName(newvName.toUpperCase())}
value={vName}
autoCorrect={false}
autoCapitalize='characters'
/>
</View>
<View style={styles.inputContainer}>
<TextInput style={styles.inputs}
placeholder="Segundo nombre"
underlineColorAndroid='transparent'
onChangeText={newvSecondName => setvSecondName(newvSecondName.toUpperCase())}
value={vSecondName}
autoCorrect={false}
autoCapitalize='characters'
/>
</View>
<View style={styles.inputContainer}>
<TextInput style={styles.inputs}
placeholder="Apellido paterno"
underlineColorAndroid='transparent'
onChangeText={newvLastName => setvLastName(newvLastName.toUpperCase())}
value={vLastName}
autoCorrect={false}
autoCapitalize='characters'
/>
</View>
<View style={styles.inputContainer}>
<TextInput style={styles.inputs}
placeholder="Apellido materno"
onChangeText={newvSecondLastName => setvSecondLastName(newvSecondLastName.toUpperCase())}
underlineColorAndroid='transparent'
value={vSecondLastName}
autoCorrect={false}
autoCapitalize='characters'
/>
</View>
<View style={styles.containerdate}>
<DatePicker
date={vBirthDate} //initial date from state
mode="date" //The enum of date, datetime and time
placeholder="select date"
format="DD/MM/YYYY"
minDate="01/01/1900"
maxDate="01/01/2019"
confirmBtnText="Confirm"
cancelBtnText="Cancel"
androidMode="spinner"
customStyles={{
placeholderText: {
fontSize: 16,
},
dateIcon: {
height: 0,
width: 0,
},
dateText: {
color: '#b3b4b5',
fontSize: 16,
},
dateInput: {
borderWidth: 0,
}
}}
onDateChange={(date) => {setvBirthDate(date);} }
/>
</View>
this is the text input that has to be updated with the value of the api
<View style={styles.inputContainer}>
<TextInput style={styles.inputs}
placeholder={vRFC}
underlineColorAndroid='transparent'
value= {vRFC}
editable={false}
selectTextOnFocus={false}
autoCorrect={false}
autoCapitalize='characters'
/>
</View>
any help would be appreciated