refactor: simplify PasswordInput component and standardize usage

Removes unnecessary props and internal state management from PasswordInput component to make it more focused and reusable. Wraps all PasswordInput instances in relative positioned Views for consistent layout behavior.

Updates package.json to use caret version for @expo/vector-icons dependency for better version flexibility.
This commit is contained in:
Uruk
2025-09-01 19:18:54 +02:00
parent 2f2e5a2730
commit 4dce87dfd3
6 changed files with 109 additions and 126 deletions

View File

@@ -277,20 +277,19 @@ const Login: React.FC = () => {
/>
{/* Password */}
<PasswordInput
value={credentials.password}
onChangeText={(text: string) =>
setCredentials({ ...credentials, password: text })
}
onSubmitEditing={handleLogin}
placeholder={t("login.password_placeholder")}
className='mb-4'
showPassword={showPassword}
onShowPasswordChange={setShowPassword}
topPosition='4'
testID='tv-password-input'
accessibilityLabel={t("login.password_placeholder")}
/>
<View className='relative'>
<PasswordInput
value={credentials.password}
onChangeText={(text: string) =>
setCredentials({ ...credentials, password: text })
}
placeholder={t("login.password_placeholder")}
showPassword={showPassword}
onShowPasswordChange={setShowPassword}
topPosition='4'
layout='tv'
/>
</View>
<View className='mt-4'>
<Button onPress={handleLogin}>{t("login.login_button")}</Button>
@@ -403,20 +402,22 @@ const Login: React.FC = () => {
textContentType='oneTimeCode'
clearButtonMode='while-editing'
maxLength={500}
extraClassName='mb-4'
/>
<PasswordInput
value={credentials.password}
onChangeText={(text) =>
setCredentials({ ...credentials, password: text })
}
placeholder={t("login.password_placeholder")}
showPassword={showPassword}
onShowPasswordChange={setShowPassword}
topPosition='3.5'
testID='mobile-password-input'
accessibilityLabel={t("login.password_placeholder")}
/>
<View className='relative mb-0.5'>
<PasswordInput
value={credentials.password}
onChangeText={(text) =>
setCredentials({ ...credentials, password: text })
}
placeholder={t("login.password_placeholder")}
showPassword={showPassword}
onShowPasswordChange={setShowPassword}
topPosition='10'
layout='mobile'
/>
</View>
<View className='flex flex-row items-center justify-between'>
<Button
onPress={handleLogin}
@@ -427,7 +428,7 @@ const Login: React.FC = () => {
</Button>
<TouchableOpacity
onPress={handleQuickConnect}
className='p-2 bg-neutral-900 rounded-xl h-12 w-12 flex items-center justify-center'
className='p-3 bg-neutral-900 rounded-xl h-13 w-13 flex items-center justify-center'
>
<MaterialCommunityIcons
name='cellphone-lock'