Skip to content

fix Modal animations#2505

Merged
jasperhuangg merged 6 commits into
Expensify:mainfrom
parasharrajat:parasharrajat-animation
Apr 30, 2021
Merged

fix Modal animations#2505
jasperhuangg merged 6 commits into
Expensify:mainfrom
parasharrajat:parasharrajat-animation

Conversation

@parasharrajat

@parasharrajat parasharrajat commented Apr 21, 2021

Copy link
Copy Markdown
Member

Please review.

Details

Details can be read #2335 (comment)

Fixed Issues

Fixes #2335

Tests / QA Steps

  1. Click the search icon to open the Search Modal.
  2. Open all the available models from the FAB button.
  3. Open the User Details / Group participants modal.
  4. Open the User Settings Modal.
  5. For all the modals enter and exit animation should be smooth and consistent.
  6. Open Emoji Picker on Mobile devices and Web they should be animated.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

animation-web.mp4

Mobile Web

animation-mWeb.mp4

Desktop

animation-des.mp4

iOS

Not able to record it as I have MAC VM but the animation on IOS works smoothly.

Android

animation-mobile.mp4

@parasharrajat parasharrajat requested a review from a team as a code owner April 21, 2021 00:04
@MelvinBot MelvinBot requested review from jasperhuangg and removed request for a team April 21, 2021 00:05
@jasperhuangg

jasperhuangg commented Apr 21, 2021

Copy link
Copy Markdown
Contributor

@parasharrajat As per the PR title, is this still WIP? Also, can you confirm whether you need to provide tests for Mobile Web, Desktop, and iOS?

jasperhuangg
jasperhuangg previously approved these changes Apr 21, 2021
@parasharrajat

Copy link
Copy Markdown
Member Author

@jasperhuangg Yup main task is finished but I was scrutinizing it. Also, I saw other requests being brought into this issue.

@parasharrajat parasharrajat changed the title WIP: fix Modal animations fix Modal animations Apr 26, 2021
@parasharrajat

Copy link
Copy Markdown
Member Author

@jasperhuangg Updated Screenshots. Ready for review.

@jasperhuangg jasperhuangg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions.

numColumns={this.numColumns}
removeClippedSubviews
maxToRenderPerBatch={this.numColumns}
windowSize={3}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this have to do with your issue? This just seems like a FlatList optimization that doesn't have anything do with your changes. NAB but I think it's better to do this in a separate PR.

Also, can you clarify why you're using 3 for windowSize? Not good to have hard coded numbers so good to clarify with a comment.

@parasharrajat parasharrajat Apr 26, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component is very laggy. Author of the component mentioned this so he disabled the animations. I put these changes to make the animation smooth so that I can enable animation on this component.

Window size will not be reused so I put it directly over here. It just means to create three Windows where one window is equal to visible area of component. I will add the comments

@parasharrajat parasharrajat Apr 26, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention that there are other PRs on emoji picker which is optimizing it So I don't need to submit a PR for now. If in future issues persist with Emoji Picker I will handle them as a separate issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for @jasperhuangg comments here.

@parasharrajat appreciate you adding value here but please do limit changes to ones affecting the issue you are assigned so that we can manage which bugs and issues are being handled and where. random fixes make it much harder to track when a bug was fixed.

@parasharrajat parasharrajat Apr 30, 2021

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added these changes as per request #2335 (comment). I saw that the animation was pretty laggy so I thought to put these for optimizing the animation.

Should I just enable the animation and remove these changes?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, thanks I missed this comment. No need to remove changes but if we are increasing the scope we need to add that context to the description of the original issue so we should:

  1. Update the issue you are working on to show each problem we are solving (show that it is broken)
  2. Ask QA to test the same flows and prove that it is fixed.

Otherwise, we're just adding random stuff and it's hard to have a good history.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, Thanks. Updating now.

numColumns={this.numColumns}
removeClippedSubviews
maxToRenderPerBatch={this.numColumns}
windowSize={3}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to confirm locally that removing these line fixes a regression

onClose={this.hideEmojiPicker}
onModalShow={this.focusEmojiSearchInput}
hideModalContentWhileAnimating
animationInTiming={1}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing this? There's a comment above saying why they're there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So It was added to disable the animation as the author found it laggy but I was requested to enable animation on emoji picker thus I removed it. I will remove the comments as well.

@parasharrajat

Copy link
Copy Markdown
Member Author

@jasperhuangg Please let me know how should I proceed here based on my comments over review?

@jasperhuangg jasperhuangg left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for clarifying my concerns.

@jasperhuangg jasperhuangg merged commit c31821b into Expensify:main Apr 30, 2021
showTitleTooltip: PropTypes.bool,

// The ref to the search input
// eslint-disable-next-line react/forbid-prop-types

@marcaaron marcaaron Apr 30, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely we will use this enough times that a reusable propTypes is better than PropTypes.object.isRequired ?


componentDidMount() {
this.textInput.focus();
this.unsubscribeTransitionEnd = this.props.navigation.addListener('transitionEnd', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What transition are we listening for the end of here?
Does this work for all screens that might use this component in the future?
Can we add some context about why this change was needed so that others have a better idea whether to follow this example or not?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. We used this as Interaction Manager has issues on Web. This transition waits for the Navigation transition to finish. This component is being used for only Screen components so this works fine. But it's a good idea to mention it in a comment. Oh, PR is merged. I will open follow-up PR.

Let me know If we should handle this in a different way.

numColumns={this.numColumns}
removeClippedSubviews
maxToRenderPerBatch={this.numColumns}
windowSize={3}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for @jasperhuangg comments here.

@parasharrajat appreciate you adding value here but please do limit changes to ones affecting the issue you are assigned so that we can manage which bugs and issues are being handled and where. random fixes make it much harder to track when a bug was fixed.

this.emojiSearchInput.focus();
}
this.emojiFocusInteractionHandle = InteractionManager.runAfterInteractions(() => {
if (this.emojiSearchInput && !this.props.isSmallScreenWidth) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why only when we have a small screen width what about tablet ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is a bigger device (!isSmallScreenWidth) but we can remove this check as emojiSearchInput is already null for native devices.

@@ -161,7 +170,7 @@ class ReportActionCompose extends React.Component {
if (this.textInput) {
// There could be other animations running while we trigger manual focus.
// This prevents focus from making those animations janky.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please elaborate on why this is helpful. Which "interaction" are we waiting to finish ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So When the modal screen is being closed, we want to wait for those before focusing on it. And I noticed that manual focus is causing a lot of issues so I think it's better to put focus after Interactions, we have no side effects.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some way to see which "interactions" we are waiting for? Or am I misunderstanding what this method does? Which janky animation are we fixing specifically with this? Is there a before/after video we can share to verify the change does what it should and so QA can verify the change as well?

I'm not seeing anything at all about the emoji picker in the test steps so those will also need to be updated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 @parasharrajat Can you updated the test steps to include something about the emoji picker? It's not super apparent that it's a modal and it might get missed in QA.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging in version: 1.0.34-3🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@roryabraham

Copy link
Copy Markdown
Contributor

I believe this PR caused a regression

@parasharrajat

parasharrajat commented May 1, 2021

Copy link
Copy Markdown
Member Author

I don't think so but I will debug it and see. anyways I am putting up a follow up PR for few changes so I will fix this regression (if its from same PR) on that

@roryabraham

roryabraham commented May 1, 2021

Copy link
Copy Markdown
Contributor

Yeah, I was just looking at the checklist here and finding that this PR looked like the only potential culprit, but I'm not able to reproduce the bug.

@roryabraham

Copy link
Copy Markdown
Contributor

Okay, actually I have figured out how to reproduce the regression, and I'm 90% sure it was indeed caused by this PR.

@roryabraham

roryabraham commented May 1, 2021

Copy link
Copy Markdown
Contributor

Was able to confirm that these lines were the source of the regression. Going to revert here

@parasharrajat

Copy link
Copy Markdown
Member Author

I am feeling like I need to test the app deeply before finalizing a PR. I am seeing that there have been couple of regressions.

@roryabraham

Copy link
Copy Markdown
Contributor

@parasharrajat This PR has been reverted, so'll need to include these original changes in your follow-up too

@OSBotify

OSBotify commented May 8, 2021

Copy link
Copy Markdown
Contributor

🚀 Deployed to production in version: 1.0.39-5🚀

platform result
🤖 android 🤖 failure ❌
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modal animation is inconsistent

5 participants