-
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
Allow menus to be dynamically positioned. #2706
Conversation
Hmmm @parasharrajat I thought we discussed in the linked issue that we were going to move the dimensions informations and listeners into Onyx, and deprecate the |
Sure. Will do.I was not sure on that. Thanks for confirming. |
@roryabraham I have a suggestion. Can we use the React Context for WindowDimensions? https://reactjs.org/docs/context.html. I still have doubts. I just want to achieve the best possible thing here. I understand Onyx is the way to go currently in the app.
|
So my take on this is that we definitely don't want to use React Context. It's a pattern we haven't used anywhere else the codebase and not one that I think we want to encourage. I'm sure I have some biases, but I think they're just sort of complex and not that commonly used 🤷🏼♂️
To quote @tgolen, "this is just a rumor of a problem for now" 😄 Expensify.cash is built on Onyx, so I think the way that we should approach this is not to avoid using it because we think it might have some potential pitfalls. Instead we should use it, and then when there are problems, adjust it and make it work for our needs. It would be easy to adjust Onyx down the line to have some values only be stored in-memory 🙂 |
Thanks, @roryabraham. Let me do it that way. |
@roryabraham Updated.
instead of currently what I have done
|
@roryabraham Any thoughts? |
Hey @parasharrajat, I started reviewing this but am talking it over with @marcaaron currently and we're going to discuss some more in the linked issue. |
@roryabraham After Marc's comments what should I go with. I personally think that Dimensions are runtime thing and we should not involve Onyx as Onyx go through persistent storage. |
I would propose we do the simplest thing for now which is to address the issue directly without the refactor. If we need to optimize then we can discuss those benefits (or lack of) in the ticket created by @kidroca. |
@parasharrajat I think this comment was meant for another issue/PR |
OOps. Sorry. posted on the correct issue. |
@parasharrajat yep I agree with you and @marcaaron here. Sorry for the roundabout approach – I got caught up with a problem that wasn't real which led to an over-engineered solution. So yeah let's go for @marcaaron's simple solution he posted in the issue. |
e7b67eb
to
5fd502d
Compare
this.state.emojiPopoverAnchorPosition = { | ||
horizontal: event.nativeEvent.pageX, | ||
vertical: event.nativeEvent.pageY, | ||
}; | ||
this.setState({isEmojiPickerVisible: true}); |
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.
Here we were showing the Picker based on mouse position. As a result, Piker will be shown on different locations based on click position. Let me know if we want this behavior. I removed it as other Menus does not have this behavior keeping consistency.
Updated Thanks. |
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.
Okay, this looks good 👍
I also did some basic regression testing of the menus on iOS and mobile safari and didn't see any errors or issues, so we should be good.
🚀 Deployed to staging in version: 1.0.41-4🚀
|
Step 6 of this PR is failing because of this issue #2786. Rest of the steps were a pass. |
🚀 Deployed to production in version: 1.0.44-0🚀
|
Please review @roryabraham
Details
onDimensionsChange
toWithWindowDimensions
which allows attaching change Listener.WithWindowDimensions
by 200ms.Fixed Issues
Fixes #2517
Tests / QA Steps
Tested On
Screenshots
Web / Desktop
new.mp4