-
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
Double Tapping Options Row Navigating Twice Fix And Navigation Refactoring To Resolve It From Queueing When There’s Already a Navigation Is In Progress #14426
Conversation
@cristipaval 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] |
@syedsaroshfarrukhdot Friendly reminder to either:
Then the correct people will be assigned for a review 🙌 Thank you 🙇 |
Thank you for highlighting. It was my bad to not link issue correctly before making it as as draft. Will make sure next time this doesn't happen. |
No problem at all! Thanks for taking this into consideration 🙇 |
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.
At this point, src/libs/onScreenTransitionEnd.js
and src/libs/onScreenTransitionStart.js
seem pretty useless. Let's just get rid of them and use navigation.addListener
directly.
@roryabraham Like the below snippet as I was using before right ? If Yes, I also agree it make more sense to us navigation.addListener directly. Are we going waiting to discuss this as this change was suggested by @eVoloshchak or should I make changes ?
|
@roryabraham Done, Conflicts Resolved In OptionRow.js |
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.
Overall I think this looks good, just had one comment left
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, will let @eVoloshchak have another look before merging
There is something weird happening on Screen.Recording.2023-02-01.at.01.19.07.movRetested all of the platforms, works well |
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.
Thank you all for working on this one!
LGTM
✋ 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/roryabraham in version: 1.2.64-0 🚀
|
This pull request caused a regression: #14787 In hindsight, the fix should have been something we caught in code review: #14791 Lesson for the future is that when migrating
|
This kind of thing is making me wish we could use hooks, because this change would've been much easier to make and review using hooks rather than converting to a class component. |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|
1 similar comment
🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.64-7 🚀
|
InteractionManager.runAfterInteractions(() => { | ||
result.then(() => this.setState({isDisabled: this.props.isDisabled})); | ||
}); |
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 am confused with the use of InteractionManager.runAfterInteractions
here. What is its purpose?
} | ||
if (this.textInput.isFocused()) { | ||
setSelection(this.textInput, 0, this.props.value.length); | ||
return new Promise((resolve) => { |
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.
Why do we need a promise here?
@parasharrajat Additional context can be found here and here. Hopefully that answers your questions. |
This PR caused a regression here #15963 due to missing some cases that should have been handled on |
InteractionManager.runAfterInteractions(() => { | ||
result.then(() => this.setState({isDisabled: this.props.isDisabled})); | ||
}); |
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.
The callback is evaluated before the promise is resolved. This caused a regression (after we copied the logic). Please check #18122 (comment) for details.
Details
Part 1
Updating OptionRow so that it:
Part 2
Updating the Navigation lib:
First, to checks if isNavigating is true. If it is, it returns a new promise that resolves to false and logs a message.
Summary : The "isNavigating" variable in this function is used to prevent multiple executions of the promise that navigates to a new screen. It first checks if navigation is already in progress by checking the "isNavigating" variable, and if so, it resolves with "false" and logs a message indicating that the navigation failed because it was already in progress. If navigation is not in progress, it checks if the navigation reference is ready and if not, it resolves with "false" and logs a message indicating that the navigation failed because the reference was not yet ready. This ensures that only one navigation promise can be executed at a time.
If isNavigating is false, it returns a new promise that: uses the InteractionManager.runAfterInteractions() method to wait for any ongoing interactions to finish.
i. checks if the navigationRef is ready and isNavigating is false.
ii. If both conditions are met, the promise resolves to true.
iii. If not, it logs a message and the promise resolves to false.
Update all canNavigate usage to resolve promise before executing navigation.
Fixed Issues
$ #14258
PROPOSAL: #14258 (comment)
Tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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.Screenshots/Videos
Web
Screen.Recording.2023-01-20.at.4.52.05.AM.-.Compressed.with.FlexClip.mp4
Mobile Web - Chrome
WhatsApp.Video.2023-01-19.at.11.47.19.PM.mp4
Mobile Web - Safari
mWebSafari.-.Compressed.with.FlexClip.mp4
Desktop
Screen.Recording.2023-01-24.at.7.02.18.PM.-.Compressed.with.FlexClip.mp4
iOS
IOS.-.Compressed.with.FlexClip.mp4
Android
WhatsApp.Video.2023-01-20.at.5.02.02.AM.-.Compressed.with.FlexClip.mp4