Fixing error prettier redesign CI

This commit is contained in:
mathysPaul
2023-09-19 17:36:19 +02:00
parent 073ff033f3
commit 1abfbf391f
22 changed files with 986 additions and 778 deletions
+58 -61
View File
@@ -5,77 +5,74 @@ import { Text } from 'native-base';
import { Warning2 } from 'iconsax-react-native';
interface TextFormFieldProps extends TextFieldBaseProps {
style?: StyleProp<ViewStyle>,
error: string | null;
style?: StyleProp<ViewStyle>;
error: string | null;
}
const ERROR_HEIGHT = 20;
const ERROR_PADDING_TOP = 8;
const TextFormField: React.FC<TextFormFieldProps> = ({ error, style, ...textFieldBaseProps }) => {
const fadeAnim = React.useRef(new Animated.Value(0)).current;
const heightAnim = React.useRef(new Animated.Value(0)).current;
const paddingTopAnim = React.useRef(new Animated.Value(0)).current;
const fadeAnim = React.useRef(new Animated.Value(0)).current;
const heightAnim = React.useRef(new Animated.Value(0)).current;
const paddingTopAnim = React.useRef(new Animated.Value(0)).current;
useEffect(() => {
Animated.parallel([
Animated.timing(
fadeAnim,
{
toValue: error ? 1 : 0,
duration: 150,
useNativeDriver: false
}
),
Animated.timing(
heightAnim,
{
toValue: error ? ERROR_HEIGHT : 0,
duration: 250,
useNativeDriver: false
}
),
Animated.timing(
paddingTopAnim,
{
toValue: error ? ERROR_PADDING_TOP : 0,
duration: 250,
useNativeDriver: false
}
),
]).start();
}, [error]);
useEffect(() => {
Animated.parallel([
Animated.timing(fadeAnim, {
toValue: error ? 1 : 0,
duration: 150,
useNativeDriver: false,
}),
Animated.timing(heightAnim, {
toValue: error ? ERROR_HEIGHT : 0,
duration: 250,
useNativeDriver: false,
}),
Animated.timing(paddingTopAnim, {
toValue: error ? ERROR_PADDING_TOP : 0,
duration: 250,
useNativeDriver: false,
}),
]).start();
}, [error]);
return (
<View style={[styles.wrapper, style]}>
<TextFieldBase
iconColor={error ? '#f7253d' : undefined}
{...textFieldBaseProps}
/>
<Animated.View style={{...styles.errorContainer, opacity: fadeAnim, height: heightAnim, paddingTop: paddingTopAnim}}>
<Warning2 size="16" color="#f7253d" variant="Bold"/>
<Text isTruncated maxW={'100%'} style={styles.errorText}>{error}</Text>
</Animated.View>
</View>
);
return (
<View style={[styles.wrapper, style]}>
<TextFieldBase iconColor={error ? '#f7253d' : undefined} {...textFieldBaseProps} />
<Animated.View
style={{
...styles.errorContainer,
opacity: fadeAnim,
height: heightAnim,
paddingTop: paddingTopAnim,
}}
>
<Warning2 size="16" color="#f7253d" variant="Bold" />
<Text isTruncated maxW={'100%'} style={styles.errorText}>
{error}
</Text>
</Animated.View>
</View>
);
};
const styles = StyleSheet.create({
wrapper: {
flex: 1,
width: '100%',
// maxWidth: 400,
},
errorContainer: {
flexDirection: 'row',
alignItems: 'center',
paddingLeft: 12,
},
errorText: {
color: '#f7253d',
fontSize: 12,
marginLeft: 8,
},
wrapper: {
flex: 1,
width: '100%',
// maxWidth: 400,
},
errorContainer: {
flexDirection: 'row',
alignItems: 'center',
paddingLeft: 12,
},
errorText: {
color: '#f7253d',
fontSize: 12,
marginLeft: 8,
},
});
export default TextFormField;
export default TextFormField;