[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.
| return ( | |
| return ( |
|
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.
Shouldn't this be a separate component? This looks like a big calculation each time PDFView rerenders 😄
There was a problem hiding this comment.
I don't think there's a problem here but what do you think @fabioh8010?
There was a problem hiding this comment.
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 |
|
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 attachmentOffline tests
Same as tests.
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop