Repository navigation
feat: add whitespace after inserting emoji via native keyboard - #30412
Conversation
Reviewer Checklist
Screenshots/VideosAndroid: Native30412.Android.mp4Android: mWeb Chrome30412.mWeb-Chrome.mp4iOS: Native30412.iOS.mp4iOS: mWeb Safari30412.mWeb-Safari.mp4MacOS: Chrome / Safari30412.Web.mp4MacOS: Desktop30412.Desktop.mp4 |
|
@aswin-s Could you help resolve the conflict? Thanks! |
|
@mollfpr Something has changed on master and I can see some issues related to emoji suggestions. Emoji suggestions popup is not shown when there is no text in the composer. It seems to be impacting master as well. Need more time to investigate and fix. I'll update you once it is resolved. |
|
@mollfpr Resolved conflicts and merged latest master which fixed the above mentioned issues. You may proceed with review. |
| start: prevSelection.start + text.length + selectionSpaceLength, | ||
| end: prevSelection.start + text.length + selectionSpaceLength, | ||
| })); | ||
| (text) => { |
There was a problem hiding this comment.
We need to update these line
There was a problem hiding this comment.
Fixed. Removed the second parameter which is redundant now.
| setSelection((prevSelection) => ({ | ||
| start: prevSelection.start + text.length + selectionSpaceLength, | ||
| end: prevSelection.start + text.length + selectionSpaceLength, | ||
| })); |
There was a problem hiding this comment.
I think this removed code makes a regression.
Screen.Recording.2023-10-30.at.20.43.23.mov
Step to reproduce:
- Type a text
- Place the cursor in the middle
- Unfocus the composer
- Press any alphabet key
The cursor should stay in the last position before the unfocus.
There was a problem hiding this comment.
Nice catch 🙌. I had inadvertently removed the code to reset cursor position when the composer was focused again. However the method replaceSelectionWithText doesn't seem like an apt location for it as the method is shared with EmojiPicker callback. Instead I moved the code to the focus handler method itself which will reset the cursor to its last known location.
|
@mollfpr Fixed the issue related to composer focus. You may retest the fix now. |
| // Reset cursor to last known location | ||
| setSelection((prevSelection) => ({ | ||
| start: prevSelection.start + 1, | ||
| end: prevSelection.end + 1, |
There was a problem hiding this comment.
I'm a bit confused about this logic. Previously, we also sum the text length, but not here.
@aswin-s Could you explain more?
There was a problem hiding this comment.
@mollfpr Earlier it had to handle both Emoji picker input and Keyboard onPress. When emoji was inserted via picker selection, it had to adjust for emoji with white space. Now since the logic is moved into key press event, the selection is always going to be incremented by one, since it gets triggered only once for the first character being inserted.
mollfpr
left a comment
There was a problem hiding this comment.
It looks good and tests well 👍
Just a minor JSDoc left.
| * Find diff between text changes in composer | ||
| */ | ||
| const findNewlyAddedChars = useCallback( | ||
| (prevText, newText) => { |
|
✋ 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/flodnv in version: 1.3.96-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.96-15 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.97-7 🚀
|
Details
This PR adds the functionality of adding a whitespace after an emoji is inserted via native keyboard. Earlier this behaviour was present only if emoji is inserted via in app Emoji picker.
Fixed Issues
$ #23658
PROPOSAL: #23658 (comment)
Tests
:heart:)Offline tests
:heart:)QA Steps
:heart:)PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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.mp4
Android: mWeb Chrome
android-web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
iOS-mWeb.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4