Skip to content

Commit

Permalink
AddContact: account for changing DocumentDirectoryPath
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Jan 24, 2024
1 parent a4d5876 commit 360ccfd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions views/Settings/AddContact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,14 @@ export default class AddContact extends React.Component<
}
}

getPhoto(photo): string {
if (photo?.includes('rnfs://')) {
const fileName = photo.replace('rnfs://', '');
return `file://${RNFS.DocumentDirectoryPath}/${fileName}`;
}
return photo || '';
}

render() {
const { navigation } = this.props;
const {
Expand All @@ -381,6 +389,7 @@ export default class AddContact extends React.Component<
pubkey,
name,
description,
photo,
isValidOnchainAddress,
isValidLightningAddress,
isValidNIP05,
Expand Down Expand Up @@ -487,10 +496,10 @@ export default class AddContact extends React.Component<
justifyContent: 'center'
}}
>
{this.state.photo ? (
{photo ? (
<Image
source={{
uri: this.state.photo
uri: this.getPhoto(photo)
}}
style={styles.photo}
/>
Expand Down

0 comments on commit 360ccfd

Please sign in to comment.