diff --git a/views/Settings/AddContact.tsx b/views/Settings/AddContact.tsx index cea70434b..6d62b7abd 100644 --- a/views/Settings/AddContact.tsx +++ b/views/Settings/AddContact.tsx @@ -736,20 +736,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'lnAddress', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidLightningAddress && ( + + + this.removeExtraField( + 'lnAddress', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))} @@ -757,8 +761,9 @@ export default class AddContact extends React.Component< orientation="horizontal" style={{ marginTop: 10 }} color={ - pubkey?.length == 1 && - (!isValidLightningAddress || !isValidPubkey) && + bolt12Address?.length == 1 && + (!isValidLightningAddress || + !isValidBolt12Address) && themeColor('error') } /> @@ -803,8 +808,8 @@ export default class AddContact extends React.Component< orientation="horizontal" style={{ marginTop: 16 }} color={ - index === lnAddress?.length - 2 && - !isValidLightningAddress && + index === bolt12Address?.length - 2 && + !isValidBolt12Address && themeColor('error') } /> @@ -829,7 +834,7 @@ export default class AddContact extends React.Component< }); if (!text) { this.setState({ - isValidLightningAddress: + isValidBolt12Address: true }); } @@ -848,20 +853,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'bolt12Address', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidBolt12Address && ( + + + this.removeExtraField( + 'bolt12Address', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))} @@ -870,7 +879,7 @@ export default class AddContact extends React.Component< style={{ marginTop: 10 }} color={ pubkey?.length == 1 && - (!isValidLightningAddress || !isValidPubkey) && + (!isValidBolt12Address || !isValidPubkey) && themeColor('error') } /> @@ -957,20 +966,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'pubkey', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidPubkey && ( + + + this.removeExtraField( + 'pubkey', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))} @@ -1072,20 +1085,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'onchainAddress', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidOnchainAddress && ( + + + this.removeExtraField( + 'onchainAddress', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))} @@ -1179,20 +1196,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'nip05', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidNIP05 && ( + + + this.removeExtraField( + 'nip05', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))} @@ -1285,20 +1306,24 @@ export default class AddContact extends React.Component< autoCapitalize="none" /> - - - this.removeExtraField( - 'nostrNpub', - index - ) - } - color={themeColor('text')} - underlayColor="transparent" - size={16} - /> - + {isValidNpub && ( + + + this.removeExtraField( + 'nostrNpub', + index + ) + } + color={themeColor('text')} + underlayColor="transparent" + size={16} + /> + + )} ))}