-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Migrate ReportActionCompose to function #18648
Migrate ReportActionCompose to function #18648
Conversation
…Callback with use memo, fix bug with emoji show only after 3 symbols
…ompose (replace class file with function one)
…gic, add few TODO comment, remove dev file ReportActionComposeF
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
</OfflineWithFeedback> | ||
{isDraggingOver && <ReportDropUI />} | ||
{!_.isEmpty(suggestionValues.suggestedEmojis) && suggestionValues.shouldShowEmojiSuggestionMenu && ( | ||
<ArrowKeyFocusManager |
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.
We added a useArrowKeyFocusManager
hook, let's use that instead. It's a bit simpler.
Can't merge due to unsigned commits |
Seems last 2 commits should be reverted and force push with signed commit cc: @Szymon20000 |
Co-authored-by: Situ Chandra Shil <[email protected]>
a10c273
to
af0ea24
Compare
@Szymon20000 please fix conflict. Apply changes from #24512 |
@situchan I dont see conflicts on GH |
There should be conflict since #24512 was merged |
Oh interesting its not showing the specifc files, I can see it now |
…migrate-reportactioncompose-to-function
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
This hook should be divided into two hooks. App/src/pages/home/report/ReportActionCompose.js Lines 948 to 980 in dd50e91
One hook has focusComposerOnKeyPress as a dependency.
useEffect(() => {
const unsubscribeNavigationBlur = navigation.addListener('blur', () => KeyDownListener.removeKeyDownPressListner(focusComposerOnKeyPress));
const unsubscribeNavigationFocus = navigation.addListener('focus', () => {
KeyDownListener.addKeyDownPressListner(focusComposerOnKeyPress);
setUpComposeFocusManager();
});
KeyDownListener.addKeyDownPressListner(focusComposerOnKeyPress);
return () => {
KeyDownListener.removeKeyDownPressListner(focusComposerOnKeyPress);
unsubscribeNavigationBlur();
unsubscribeNavigationFocus();
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [focusComposerOnKeyPress]); Because we used
Expected result: the main composer focuses and receives the keys. |
🚀 Deployed to staging by https://github.com/roryabraham in version: 1.3.56-0 🚀
|
🚀 Deployed to production by https://github.com/roryabraham in version: 1.3.56-24 🚀
|
Hey @ginsuma ! This section of code got moved to What do you mean about needing to split this hook into two? The Isn't that what we want here? |
Not sure – @ginsuma can you please report the problem in #expensify-bugs? |
This is outdated now. The problem was two weeks ago, and we fixed it in |
|
||
const onSelectionChange = useCallback( | ||
(e) => { | ||
LayoutAnimation.configureNext(LayoutAnimation.create(50, LayoutAnimation.Types.easeInEaseOut, LayoutAnimation.Properties.opacity)); |
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 can mess with animations. This might have been worked on this PR to solve the emoji picker freeze bug but later on, the same bug popped back. #21540
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.
As soon as Reanimated 3.5.0 lands we should start using Reanimated for LayoutAnimations going forward
setIsCommentEmpty(!!newComment.match(/^(\s)*$/)); | ||
setValue(newComment); | ||
if (commentValue !== newComment) { | ||
const remainder = ComposerUtils.getCommonSuffixLength(commentRef.current, newComment); |
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.
Details
Refactoring the
ReportActionCompose.js
component from class to functional one.Fixed Issues
$ #16263
Tests
:
)Offline tests
None needed.
QA Steps
Same as in "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
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android