Merge pull request #384 from kolplattformen/bugfix/359-icon-error-personal-number

fix: 🐛 Added Alert Icon when personal number is wrong
This commit is contained in:
Viktor Sarström 2021-05-11 11:29:44 +02:00 committed by GitHub
commit 1351faf5eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,7 @@ import { SafeAreaView } from '../ui/safeAreaView.component'
import { studentName } from '../utils/peopleHelpers'
import { useSMS } from '../utils/SMS'
import { translate } from '../utils/translation'
import { BackIcon } from './icon.component'
import { BackIcon, AlertIcon } from './icon.component'
import { RootStackParamList } from './navigation.component'
import { SafeAreaViewContainer } from '../ui/safeAreaViewContainer.component'
@ -41,6 +41,8 @@ interface AbsenceFormValues {
endTime: moment.Moment
}
const Alert = (props: any) => <AlertIcon {...props} />
const Absence = () => {
const AbsenceSchema = Yup.object().shape({
socialSecurityNumber: Yup.string()
@ -155,6 +157,9 @@ const Absence = () => {
hasError('socialSecurityNumber') ? 'danger' : 'basic'
}
value={values.socialSecurityNumber}
accessoryRight={
errors.socialSecurityNumber ? Alert : undefined
}
/>
{hasError('socialSecurityNumber') && (
<Text style={styles.error}>

View File

@ -3,6 +3,7 @@ import React from 'react'
const uiIcon = (name: string) => (props: any) => <Icon {...props} name={name} />
export const AlertIcon = uiIcon('alert-circle-outline')
export const BackIcon = uiIcon('arrow-back')
export const CalendarOutlineIcon = uiIcon('calendar-outline')
export const CallIcon = uiIcon('phone-outline')