-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix unable to scroll PDF files in preview #21714
Conversation
@abdulrahuman5196 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] |
@hoangzinh This change is causing the password screen to show up twice when using password protected pdf in native iOS and android. Could you kindly check on this? Screen.Recording.2023-06-29.at.2.29.24.PM.mp4 |
nice catch @abdulrahuman5196 I will take a look |
@abdulrahuman5196 fyi, I'm asking the author of previous PR to understand why do we need Pressable component here first #17647 (comment) |
@hoangzinh Why are we checking removal of pressable to fix this double request of password issue? Is it related? |
The root cause of double request password issue of this PR is: this PR proposes a solution that when the PDF is loaded completed, we will remove
So I would like to understand what are roles of |
@hoangzinh @abdulrahuman5196 This Pressable is to replace TouchableWithoutFeedback and to hide arrows when PDF loading takes some time. Maybe we should handle the password protected PDFs case separately |
Thanks @alexxxwork for providing this information. I will continue with my PR according to this. |
@abdulrahuman5196 update so far, I still find best approaches in this case. Some explore directions:
|
I don't agree on this. This is the normal way how react components do. So wouldn't want to affect that. I am not able to understand the second part? Could you provide more information? |
Definitely, When I look into how PDFView is implemented in native app:
|
@abdulrahuman5196 so my RCA for case of PDF is encrypted is. If we go with this solution App/src/components/AttachmentView.js Lines 101 to 112 in d47bb44
The So I think that, should we move component PressableWithoutFeedback here to inside the PDFView here so we will keep the |
@hoangzinh I am fine with the above approach. Could you kindly make the change, so that i can test it thoroughly to see if some edge case comes up there as well? |
@deetergp We got an issue while applying this solution. |
@abdulrahuman5196 I just updated the PR with my latest proposal. Please free to test it in your side. Thanks. |
@hoangzinh's fix for this bug sounds good to me as well. It's great that you caught it now and fixed it here! 🎉 |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-07-14.at.1.12.50.AM.mp4Mobile Web - Chromeaz_recorder_20230714_011843.mp4Mobile Web - SafariUntitled.2.mp4DesktopScreen.Recording.2023-07-14.at.1.02.57.AM.mp4iOSScreen.Recording.2023-07-14.at.12.51.44.AM.mp4Androidaz_recorder_20230714_004452.mp4 |
Thank you @deetergp for checking and confirming on the same. #21714 (comment) |
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.
Changes looks good and works well. Reviewers checklist is also complete.
All yours @deetergp
🎀 👀 🎀
C+ Reviewed
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.
Code looks good, thanks for the changes!
✋ 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/deetergp in version: 1.3.41-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.41-3 🚀
|
🚀 Deployed to staging by https://github.com/deetergp in version: 1.3.42-0 🚀
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.41-3 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.42-26 🚀
|
@@ -169,6 +173,21 @@ class PDFView extends Component { | |||
</View> | |||
); | |||
} | |||
|
|||
render() { | |||
return this.props.onPress && !this.state.successToLoadPDF ? ( |
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.
Adding this condition introduced #23475 bug. this.props.onPress
always returned true because it was defined in the default props.
return this.props.onPress ? ( | ||
<PressableWithoutFeedback | ||
onPress={this.props.onPress} | ||
style={[styles.flex1, styles.flexRow, styles.alignSelfStretch]} |
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.
adding styles.flexRow
caused a regression where failed to load message is not properly visible on native #21714
@@ -169,6 +173,21 @@ class PDFView extends Component { | |||
</View> | |||
); | |||
} | |||
|
|||
render() { | |||
return this.props.onPress && !this.state.successToLoadPDF ? ( |
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.
This condition caused the #42103 (comment) bug. We should've disabled the component instead of conditional rendering.
Details
Fixed Issues
$ #20867
PROPOSAL: #20867 (comment)
Tests
Test case 1: View a normal PDF
Test case 2: View a encrypted PDF
Offline tests
The fix is not related to network
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 methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Screen.Recording.2023-06-28.at.00.43.19.-.web.mov
Mobile Web - Chrome
Screen.Recording.2023-06-28.at.00.50.29.-.android.chrome.mov
Mobile Web - Safari
Screen.Recording.2023-06-28.at.00.58.30.-.ios.safari.mov
Desktop
Screen.Recording.2023-06-28.at.00.46.33.-.desktop.mov
iOS
Screen.Recording.2023-06-28.at.00.56.33.-.ios.mp4
Android
Screen.Recording.2023-06-28.at.00.53.38.-.android.mp4