Skip to content

Commit

Permalink
fix set source and check local file
Browse files Browse the repository at this point in the history
  • Loading branch information
namhihi237 committed Jan 5, 2024
1 parent 2d455bf commit 295ae98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function AttachmentModal(props) {
const [isAuthTokenRequired, setIsAuthTokenRequired] = useState(props.isAuthTokenRequired);
const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState('');
const [attachmentInvalidReason, setAttachmentInvalidReason] = useState(null);
const [source, setSource] = useState(props.source);
const [source, setSource] = useState(() => props.source);
const [modalType, setModalType] = useState(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE);
const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false);
const [confirmButtonFadeAnimation] = useState(() => new Animated.Value(1));
Expand Down Expand Up @@ -359,7 +359,7 @@ function AttachmentModal(props) {
}, []);

useEffect(() => {
setSource(props.source);
setSource(() => props.source);
}, [props.source]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReceiptUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string
image = ReceiptSVG;
}

const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:');
const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path === ReceiptGeneric;
return {thumbnail: image, image: path, isLocalFile};
}

Expand Down

0 comments on commit 295ae98

Please sign in to comment.