Skip to content

Commit

Permalink
Merge pull request #31130 from Expensify/beaman-reFixPdfAttachmentModal
Browse files Browse the repository at this point in the history
[CP Staging] Move View wrapper to AttachmentViewPdf

(cherry picked from commit 9e02e96)
  • Loading branch information
pecanoro authored and OSBotify committed Nov 9, 2023
1 parent 41f53d6 commit 1788f59
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 29 deletions.
25 changes: 10 additions & 15 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,21 +443,16 @@ function AttachmentModal(props) {
) : (
Boolean(sourceForAttachmentView) &&
shouldLoadAttachment && (
// We need the following View component on android native
// So that the event will propagate properly and
// the Password protected preview will be shown for pdf attachement we are about to send.
<View style={[styles.flex1, styles.attachmentCarouselContainer]}>
<AttachmentView
containerStyles={[styles.mh5]}
source={sourceForAttachmentView}
isAuthTokenRequired={isAuthTokenRequired}
file={file}
onToggleKeyboard={updateConfirmButtonVisibility}
isWorkspaceAvatar={props.isWorkspaceAvatar}
fallbackSource={props.fallbackSource}
isUsedInAttachmentModal
/>
</View>
<AttachmentView
containerStyles={[styles.mh5]}
source={sourceForAttachmentView}
isAuthTokenRequired={isAuthTokenRequired}
file={file}
onToggleKeyboard={updateConfirmButtonVisibility}
isWorkspaceAvatar={props.isWorkspaceAvatar}
fallbackSource={props.fallbackSource}
isUsedInAttachmentModal
/>
)
)}
</View>
Expand Down
33 changes: 19 additions & 14 deletions src/components/Attachments/AttachmentView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,26 @@ function AttachmentView({
if ((_.isString(source) && Str.isPDF(source)) || (file && Str.isPDF(file.name || translate('attachmentView.unknownFilename')))) {
const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source) : source;

// We need the following View component on android native
// So that the event will propagate properly and
// the Password protected preview will be shown for pdf attachement we are about to send.
return (
<AttachmentViewPdf
source={source}
file={file}
isAuthTokenRequired={isAuthTokenRequired}
encryptedSourceUrl={encryptedSourceUrl}
isUsedInCarousel={isUsedInCarousel}
isFocused={isFocused}
onPress={onPress}
onScaleChanged={onScaleChanged}
onToggleKeyboard={onToggleKeyboard}
onLoadComplete={() => !loadComplete && setLoadComplete(true)}
errorLabelStyles={isUsedInAttachmentModal ? [styles.textLabel, styles.textLarge] : [cursor.cursorAuto]}
style={isUsedInAttachmentModal ? styles.imageModalPDF : styles.flex1}
/>
<View style={[styles.flex1, styles.attachmentCarouselContainer]}>
<AttachmentViewPdf
source={source}
file={file}
isAuthTokenRequired={isAuthTokenRequired}
encryptedSourceUrl={encryptedSourceUrl}
isUsedInCarousel={isUsedInCarousel}
isFocused={isFocused}
onPress={onPress}
onScaleChanged={onScaleChanged}
onToggleKeyboard={onToggleKeyboard}
onLoadComplete={() => !loadComplete && setLoadComplete(true)}
errorLabelStyles={isUsedInAttachmentModal ? [styles.textLabel, styles.textLarge] : [cursor.cursorAuto]}
style={isUsedInAttachmentModal ? styles.imageModalPDF : styles.flex1}
/>
</View>
);
}

Expand Down

0 comments on commit 1788f59

Please sign in to comment.