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
Remove most of Modal
state updates on Android
#35803
base: main
Are you sure you want to change the base?
Conversation
Base commit: 3be3731 |
From blame looks like this is added for fixing some app freezes, here the comment from original commit,
cc @cortinico ref: D3892795 |
I'm not sure that's the right diff number @jacdebug |
Ah sorry missing the context, its the change where original fix was added. |
I'm impacted by this and would like to see it merged. Anything holding this up (other than conflicts)? |
@cortinico @jacdebug is there anything specific blocking this? or @j-piasecki could rebase/address conflict and then it'd be ready to go? |
Nope this should be good to go. Let's rebase and merge it |
542b8c0
to
ff19cd0
Compare
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@@ -168,8 +158,6 @@ protected void onAfterUpdateTransaction(ReactModalHostView view) { | |||
public Object updateState( | |||
ReactModalHostView view, ReactStylesDiffMap props, StateWrapper stateWrapper) { | |||
view.getFabricViewStateManager().setStateWrapper(stateWrapper); | |||
Point modalSize = ModalHostHelper.getModalHostSize(view.getContext()); | |||
view.updateState(modalSize.x, modalSize.y); |
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 think the renderer needs this information. What if React Native's viewport is not full screen but only partially covers the screen? In that case, we need to feed the information about available size to React Native so it knows that whatever is within the modal, is not constrained by RN's viewport size.
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.
Is there another direction that we could go to resolve the issue then @sammy-SC ?
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 would try to investigate why is the height wrong in the new architecture. The height seems to be off exactly by the height of the status bar. Could it be that ModalHostHelper.getModalHostSize(view.getContext())
returns height of React Native's view port instead of the desired size of the modal? Where is the height calculated for the old architecture and why is it correct? Maybe we missed something in the implementation for the new architecture.
Any news? I enabled the new architecture and set the StatusBartransLucent as true, and then got the wrong modal height |
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
I still have it at the back of my head, I'll try to get back to it shortly when I have some time. |
Summary
On the old architecture, when using a
Modal
with no animation and translucent status bar, a layout flash is noticeable when the modal is opened. Here's the video of this happening (it's visible for one frame):old_arch.mov
On the new architecture, the issue is more problematic as the modal keeps the wrong height:
new_arch.mov
Simply removing the state updates for
Modal
seems to be solving the problem (at the cost of the modal appearing one frame later), however, I'm not that familiar with the code so it may have some unintended consequences. Updating the implementation ofModalHostHelper::getModalHostSize
may be a better solution.Issue relevant to this PR (with more details): #35804
Changelog
[Android] [Fixed] - Fixed wrong modal height when
statusBarTranslucent
is set totrue
Test Plan
I've tested the changes on the following snippet: