Update screen/settings/ElectrumSettings.tsx

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Marcos Rodriguez Vélez 2024-10-08 09:38:01 -04:00 committed by GitHub
parent 6a16eb806e
commit 03c100048a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -403,22 +403,12 @@ const ElectrumSettings: React.FC = () => {
value={sslPort?.toString() === '' || sslPort === undefined ? port?.toString() || '' : sslPort?.toString() || ''}
onChangeText={text => {
const parsed = Number(text.trim());
if (isNaN(parsed)) {
// Handle invalid input, e.g., set to undefined or show an error
if (sslPort === undefined) {
setPort(undefined);
} else {
setSslPort(undefined);
}
if (Number.isNaN(parsed)) {
// Handle invalid input
sslPort === undefined ? setPort(undefined) : setSslPort(undefined);
return;
}
if (sslPort === undefined) {
setPort(parsed);
setSslPort(undefined);
} else {
setPort(undefined);
setSslPort(parsed);
}
sslPort === undefined ? setPort(parsed) : setSslPort(parsed);
}}
numberOfLines={1}
style={[styles.inputText, stylesHook.inputText]}