-
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
fix: android app crash fix due to wrong position of LayoutAnimation #18842
Conversation
@puneetlath @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/VideosWeb18842.Web.movMobile Web - Chrome18842.mWeb.Chrome.mp4Mobile Web - Safari18842.mWeb.Safari.mp4Desktop18842.Desktop.moviOS18842.iOS.mp4Android18842.Android.mp4 |
Still completing the records... |
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.
Tests 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.
Thanks for the quick work!
fix: android app crash fix due to wrong position of LayoutAnimation (cherry picked from commit 101a3e2)
…-18842 🍒 Cherry pick PR #18842 to staging 🍒
🚀 Cherry-picked to staging by https://github.com/puneetlath in version: 1.3.13-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
@allroundexperts @mollfpr won't the suggested change of the earlier LayoutAnimation call will kill the animation effect which we had for the suggestions? Before this PR demo anima.webmAfter this PR demo anim2.webm |
@Pujan92 I don't think so. According to the documentation of RN, this should be called before the state change. |
@allroundexperts I just updated the screencasts for both scenarios and I did notice the change in the suggestion animation.
Yes, but here after calling animation we are doing some execution for getting the suggested options before changing the state. Maybe we can take the states from both the methods and update the state in one go and before that, we can call this animation call. |
Hm... @Pujan92 Looking at the video at |
I am not exactly getting you but difference in animation can be seen. |
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.13-5 🚀
|
Hmm, I'm also having a hard time seeing it in the video. @mollfpr do you see it? |
I see a difference where the after-video feels instant on the emoji suggestion container changed. IMO is not a big deal, but I like a smooth transition. If we consist about the animation, then we should come up with other solutions that improve the animation and not crash the app. |
@mollfpr @puneetlath the call of |
Thanks @puneetlath. Actually mentioned proposal isn't solving the actual issue of the app crash, so will rethink and make the proposal. |
@Pujan92 I think we should use https://docs.swmansion.com/react-native-reanimated/ as we are using on login page for Animations. |
@allroundexperts maybe but I don't have much exposure to it. |
I would like to join the discussion. I agree that we should call the LayoutAnimation function before setting a state. But, if I understand it correctly, we should call it before setting a state that would change the layout of a component. However, with the changes of this PR, we are scheduling the animation before setting the selection state. Quoting from the docs, the animation will be executed in the next layout, which I believe the same as the next render. So, because we schedule the animation before setting the selection state, the animation is "consumed" by the rerender of selection change, thus the animation is missing when the suggestion layout changes. It is the same as we remove the LayoutAnimation as pointed out by @Pujan92. I don't really know exactly what is going wrong, but updating the key extractor of mention suggestion to include the index will solve the issue. Looking at the error stack trace, looks like the view manager confuses which view should be removed when the layout changes. Btw, I look at the emoji suggestion key extractor as the inspiration for the mention suggestion key extractor. |
@bernhardoj Since we're on it, doesn't it make sense to use |
I think using reanimated sounds good. |
@bernhardoj I also observed the same. Seems entries with the same key when gets changed the order in the options then the empty option for that row can be observed. Screen.Recording.2023-05-16.at.5.45.08.PM.mp4 |
We have an issue for fixing here if anyone wants to lay out a proposal for how to do it: #18974 Using reanimated sounds good to me. |
I think @allroundexperts can handle that as he is the one that propose the idea of using reanimated and technically the missing animation is a regression. |
@puneetlath I'll put in a proposal for this today. |
@@ -301,6 +301,7 @@ class ReportActionCompose extends React.Component { | |||
} | |||
|
|||
onSelectionChange(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.
@allroundexperts I guess it's safe to remove this line? Is it doing anything useful?
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.
Yes, its safe to remove it. But we should replace it with an equivalent animation.
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 assume #19933 is already the equivalent here, so we can move ahead and remove it?
🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀
|
Details
This PR fixes crash on Android that happens due to incorrect usage of
LayoutAnimation
.Fixed Issues
$ #18793
PROPOSAL: #18793 (comment)
Tests
Offline tests
N/A
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.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-05-12.at.8.10.30.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-05-12.at.8.14.57.PM.mov
Mobile Web - Safari
Screen.Recording.2023-05-12.at.8.19.54.PM.mov
Desktop
Screen.Recording.2023-05-12.at.8.12.51.PM.mov
iOS
Screen.Recording.2023-05-12.at.8.18.46.PM.mov
Android
Screen.Recording.2023-05-12.at.8.01.23.PM.mov