replace native-base Alert use
This commit is contained in:
2 files changed
+27
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { Alert, HStack } from 'native-base';
|
||||
import { FontAwesome5 as Icon } from '@expo/vector-icons';
|
||||
import React from 'react';
|
||||
import { Text } from 'react-native';
|
||||
import { Text, StyleSheet, View } from 'react-native';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const FormErrors = ({ errors }: { errors: Record<string, any> }) => {
|
||||
@@ -17,12 +17,27 @@ const FormErrors = ({ errors }: { errors: Record<string, any> }) => {
|
||||
if (!errorFormatted) errorFormatted = 'Kunne ikke sende inn skjemaet, prøv igjen...';
|
||||
|
||||
return (
|
||||
<Alert w="100%" colorScheme="error" status="error">
|
||||
<HStack space={2} flexShrink={1} w="100%">
|
||||
<Alert.Icon mt="1" />
|
||||
<View style={styles.container}>
|
||||
<Icon name="exclamation-triangle" size={16} color="#b91c1c" style={styles.icon} />
|
||||
<View>
|
||||
<Text>{errorFormatted}</Text>
|
||||
</HStack>
|
||||
</Alert>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
backgroundColor: '#fecaca',
|
||||
padding: 12,
|
||||
borderRadius: 4,
|
||||
},
|
||||
icon: {
|
||||
marginTop: 2,
|
||||
marginRight: 8,
|
||||
},
|
||||
});
|
||||
|
||||
export default FormErrors;
|
||||
@@ -1,11 +1,13 @@
|
||||
import { Input, Text, WarningOutlineIcon, FormControl, IInputProps } from 'native-base';
|
||||
import React from 'react';
|
||||
import { Control, Controller, UseControllerProps } from 'react-hook-form';
|
||||
import { Controller, UseControllerProps } from 'react-hook-form';
|
||||
import { ReturnKeyTypeOptions } from 'react-native';
|
||||
|
||||
type FormInputProps = {
|
||||
errors: any; // TODO: Figure out how to handle typing this
|
||||
control: Control<any, any>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
errors: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
control: any;
|
||||
name: string;
|
||||
label: string;
|
||||
rules?: UseControllerProps['rules'];
|
||||
|
||||
Reference in new issue
Block a user