-
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 focus edit box input on iOS #19477
Fix focus edit box input on iOS #19477
Conversation
@PauloGasparSv @fedirjh One of you needs to 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] |
Reviewer Checklist
Screenshots/VideosMobile Web - ChromeChrome.movMobile Web - SafariSafari.moviOSIOS.movAndroidAndroid.mov |
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!
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!
Web
web.mov
Mobile Web - Chrome
web.chrome.mov
Mobile Web - Safari
mWeb.Safari.mov
Desktop
Screen.Recording.2023-05-24.at.15.30.12.mov
iOS
ioS.mov
Android
android.mov
✋ 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/PauloGasparSv in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/PauloGasparSv in version: 1.3.18-0 🚀
|
🚀 Deployed to staging by https://github.com/PauloGasparSv in version: 1.3.18-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.3.18-2 🚀
|
Details
When you long press on the message to open the Context Menu (bottom sheet) on iOS and then choose "Edit message", the edit box input immediately loses focus.
After some investigation, the root cause for this bug seems to be react-native-modal.
According to this line react-native-modal/react-native-modal@master/src/modal.tsx#L680-L687 they call onModalHide callback as a callback of useState which changes visible property of the native modal. Since currently in the app react native uses batched bridge, all the events are batched and send to the native side on every even loop, so it seems like while the native is hiding the modal we run the focus method of the input.
After some discussion we realized that the best way to fix this right now is to actually use the same workaround we have on Android for a while, even though the root cause for the bug when workaround was introduced was wrong - it's not the scroll animation that causing the issue.
Fixed Issues
$ #18300
PROPOSAL: Discussion here: #18300
Tests
Offline tests
QA Steps
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
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
RPReplay_Final1684867209.mov
Android
screen-20230523-213636.mov