Skip to content

Commit 2b8354d

Browse files
committed
fix: resolve nested button hydration error in Input component
1 parent 8a4380d commit 2b8354d

2 files changed

Lines changed: 14 additions & 10 deletions

File tree

KonditionExpo/app/login.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export default function LoginScreen() {
111111
<Text style={{ color: tintColor }}>{showPassword ? 'Hide' : 'Show'}</Text>
112112
</TouchableOpacity>
113113
}
114-
onRightIconPress={() => setShowPassword(!showPassword)}
115114
/>
116115

117116
<View style={styles.optionsRow}>

KonditionExpo/components/ui/Input.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,20 @@ export function Input({
9797
/>
9898

9999
{rightIcon && (
100-
<TouchableOpacity
101-
style={styles.rightIcon}
102-
onPress={onRightIconPress}
103-
disabled={!onRightIconPress}
104-
accessibilityRole="button"
105-
accessible={!!onRightIconPress}
106-
>
107-
{rightIcon}
108-
</TouchableOpacity>
100+
onRightIconPress ? (
101+
<TouchableOpacity
102+
style={styles.rightIcon}
103+
onPress={onRightIconPress}
104+
accessibilityRole="button"
105+
accessible={true}
106+
>
107+
{rightIcon}
108+
</TouchableOpacity>
109+
) : (
110+
<View style={styles.rightIcon}>
111+
{rightIcon}
112+
</View>
113+
)
109114
)}
110115
</View>
111116

0 commit comments

Comments
 (0)