import React from 'react'; import { ActivityIndicator, ScrollView, Text, TextInput, View, StyleSheet } from 'react-native'; import { Button } from 'react-native-ui-lib'; import FormErrors from 'src/components/FormErrors'; import { useAppSelector } from 'src/hooks'; import theme from 'src/theme'; import useUserDelete from './useUserDelete'; const UserDelete = () => { const [value, onChangeText] = React.useState(''); const user = useAppSelector((state) => state.user); const { onPress, isDeletingUser, deleteUserError } = useUserDelete(); if (!user) { return null; } const isDisabled = !isDeletingUser && value !== user.username; return ( Slett meg Dette sletter kontoen med brukernavn {user.username} inkludert all tilknyttet persondata for alltid. Skriv inn brukernavnet ditt for å fortsette. onChangeText(text)} value={value} style={styles.input} /> {deleteUserError && } {isDeletingUser && } ); }; export default UserDelete; const styles = StyleSheet.create({ paragraph: { textAlign: 'center', fontSize: 16, color: theme.colors.neufBlack, paddingBottom: 10, lineHeight: 25, }, bold: { fontWeight: 'bold', }, deleteButton: { marginTop: 16, marginBottom: 16, backgroundColor: theme.colors.danger, }, deleteButtonDisabled: { marginTop: 16, marginBottom: 16, backgroundColor: theme.colors.neufGray, }, whiteText: { color: theme.colors.neufWhite, }, disabledText: { opacity: 0.5, }, headerTitle: { textAlign: 'center', fontWeight: 'bold', fontSize: 20, color: theme.colors.neufBlack, paddingVertical: 10, lineHeight: 25, }, input: { height: 40, borderColor: 'gray', borderWidth: 1, margin: 10, padding: 10, }, });