-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS migration] Migrate 'PDFView' component to TypeScript #39011
[TS migration] Migrate 'PDFView' component to TypeScript #39011
Conversation
const theme = useTheme(); | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return ( | |
return ( |
src/components/Attachments/AttachmentView/AttachmentViewPdf/types.ts
Outdated
Show resolved
Hide resolved
coming from a related issue #16186, will take this as C+ |
@pac-guerreiro looks like you have some comments to resolve |
@fabioh8010 @kubabutkiewicz @ishpaul777 All feedback addressed, tests added, author checklist complete and screenshots added! |
const renderPDFView = () => { | ||
const outerContainerStyle = [styles.w100, styles.h100, styles.justifyContentCenter, styles.alignItemsCenter]; | ||
|
||
return ( | ||
<View | ||
style={outerContainerStyle} | ||
tabIndex={0} | ||
> | ||
<PDFPreviewer | ||
contentContainerStyle={style as CSSProperties} | ||
file={sourceURL} | ||
pageMaxWidth={variables.pdfPageMaxWidth} | ||
isSmallScreen={isSmallScreenWidth} | ||
maxCanvasWidth={maxCanvasWidth} | ||
maxCanvasHeight={maxCanvasHeight} | ||
maxCanvasArea={maxCanvasArea} | ||
LoadingComponent={<FullScreenLoadingIndicator />} | ||
ErrorComponent={<Text style={errorLabelStyles}>{translate('attachmentView.failedToLoadPDF')}</Text>} | ||
renderPasswordForm={({isPasswordInvalid, onSubmit, onPasswordChange}) => ( | ||
<PDFPasswordForm | ||
isFocused={!!isFocused} | ||
isPasswordInvalid={isPasswordInvalid} | ||
onSubmit={onSubmit} | ||
onPasswordUpdated={onPasswordChange} | ||
onPasswordFieldFocused={toggleKeyboardOnSmallScreens} | ||
/> | ||
)} | ||
/> | ||
</View> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a separate component? This looks like a big calculation each time PDFView rerenders 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a problem here but what do you think @fabioh8010?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid this kind of refactor right now, let's focus on the migration only
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeRecord_2024-04-03-20-24-14.mp4iOS: NativeScreen.Recording.2024-04-03.at.7.46.00.PM.moviOS: mWeb SafariScreen.Recording.2024-04-03.at.7.39.55.PM.movMacOS: Chrome / SafariScreen.Recording.2024-04-03.at.7.35.20.PM.movMacOS: DesktopScreen.Recording.2024-04-03.at.8.41.43.PM-1.mov |
@cubuspl42 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
@roryabraham @mountiny @cubuspl42 @ishpaul777 is the C+ reviewing this PR 😄 |
@pac-guerreiro Can you please merge main |
Assigned @roryabraham do you want to handle this one or should I go ahead? |
@pac-guerreiro bump |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
We did not find an internal engineer to review this PR, trying to assign a random engineer to #25151 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
looks good otherwise! but we should merge main before merging! |
@ishpaul777 @fabioh8010 just merged main into this branch! sorry for the delay! |
@ishpaul777 Can you approve again so an internal is assigned? Thanks! |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.4.61-0 🚀
|
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.4.61-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.61-8 🚀
|
Details
Fixed Issues
$ #25151
PROPOSAL: N/A
Tests
+
sign and then selectAdd attachment
Offline tests
Same as tests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop