add max age
This commit is contained in:
parent
e3fdd8e322
commit
4c95189481
@ -11,6 +11,7 @@ const DefaultTextInput = props => (
|
|||||||
keyboardType={props.keyboardType}
|
keyboardType={props.keyboardType}
|
||||||
/>
|
/>
|
||||||
{props.isFilled && <Text style={styles.errorLabel}>Wajib diisi</Text>}
|
{props.isFilled && <Text style={styles.errorLabel}>Wajib diisi</Text>}
|
||||||
|
{props.maxValue && <Text style={styles.errorLabel}>Umur maximum 100</Text>}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -27,13 +28,13 @@ const styles = StyleSheet.create({
|
|||||||
label: {
|
label: {
|
||||||
color: 'black',
|
color: 'black',
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
fontSize: 12
|
fontSize: 12,
|
||||||
},
|
},
|
||||||
errorLabel: {
|
errorLabel: {
|
||||||
color: 'red',
|
color: 'red',
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
fontSize: 10
|
fontSize: 10,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ const ContactDetail = ({route, navigation}) => {
|
|||||||
let isEmpty = false;
|
let isEmpty = false;
|
||||||
if (
|
if (
|
||||||
form.age.trim() === '' ||
|
form.age.trim() === '' ||
|
||||||
|
Number(form.age) > 100 ||
|
||||||
form.firstName.trim() === '' ||
|
form.firstName.trim() === '' ||
|
||||||
form.lastName.trim() === '' ||
|
form.lastName.trim() === '' ||
|
||||||
(image.foto == null && image.fileUri == null)
|
(image.foto == null && image.fileUri == null)
|
||||||
@ -62,10 +63,13 @@ const ContactDetail = ({route, navigation}) => {
|
|||||||
<DefaultTextInput
|
<DefaultTextInput
|
||||||
onChangeText={val => onChangeInput('age', val)}
|
onChangeText={val => onChangeInput('age', val)}
|
||||||
label="Age (*)"
|
label="Age (*)"
|
||||||
containerStyle={{height: form.age.trim() === '' ? 80 : 60}}
|
containerStyle={{
|
||||||
|
height: form.age.trim() === '' || Number(form.age) > 100 ? 80 : 60,
|
||||||
|
}}
|
||||||
value={form.age}
|
value={form.age}
|
||||||
isFilled={form.age.trim() === ''}
|
isFilled={form.age.trim() === ''}
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
|
maxValue={Number(form.age) > 100}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={{marginBottom: 20}}>
|
<View style={{marginBottom: 20}}>
|
||||||
|
@ -44,7 +44,7 @@ const useContactDetail = (data, navigation) => {
|
|||||||
const payload = {
|
const payload = {
|
||||||
firstName: form.firstName,
|
firstName: form.firstName,
|
||||||
lastName: form.lastName,
|
lastName: form.lastName,
|
||||||
age: Number(form.age),
|
age: form.age,
|
||||||
photo: image.file ? `data:image/png;base64,${image.file}` : image.foto,
|
photo: image.file ? `data:image/png;base64,${image.file}` : image.foto,
|
||||||
};
|
};
|
||||||
if (data) {
|
if (data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user