Fixed scrollview inset when RN view is embedded in another view#27607
Fixed scrollview inset when RN view is embedded in another view#27607danielgindi wants to merge 1 commit into
Conversation
analysis-bot
left a comment
There was a problem hiding this comment.
Code analysis results:
eslintfound some issues. Runyarn lint --fixto automatically fix problems.
|
Closed by mistake |
This happened to me mainly in modal view controllers on iOS 13, where the view controller is floating and does not start from the top.
Base commit: 2b062ea |
Base commit: 2b062ea |
|
@kelset This is an easy fix for modals presented in iOS 13, and iOS 14 is almost here.... |
|
hey Daniel, thanks for the ping. I can try to put this in front of the right people but can't make promises |
elicwhite
left a comment
There was a problem hiding this comment.
This change will cause a delay in rendering as the measure is an async round trip to native.
I wonder if this change should be made on the native side and if the layout metrics are wrong for embedded views.
I tested in dev and production, there’s no side effects. |
facebook-github-bot
left a comment
There was a problem hiding this comment.
@TheSavior has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
Ah, alright. That seems reasonable to me. |
|
This pull request was successfully merged by @danielgindi in fb2900e. When will my fix make it into a release? | Upcoming Releases |
|
@TheSavior @xyin96 Waiting for more info on this. |
|
@TheSavior I don't get it. This got reverted due to a regression in a different app (no matter who stands behind it) without even looking into the bug? Chances are there's a workaround in place because of this bug. |
|
@danielgindi, I totally get where you are coming from. I'm hoping @xyin96 can give more info from the Oculus app so you two can figure out how to proceed. Fwiw, there being a workaround to this bug that ends up being a problem with this fix is still reason for concern. Who knows how many other surfaces and apps have workarounds for the sad state of the KeyboardAvoidingView. If those screens all break during an upgrade, even if KeyboardAvoidingView is now more correct, it would be detrimental to those companies and apps and make the upgrade more difficult. I'm hoping that @xyin96 can respond, and a path forward can be found that can make this work better out of the box but also not break existing screens with their current workarounds. |
|
@TheSavior There is not a single release of RN that does not break a workaround somewhere, or even a valid piece of code. The problem with this issue is that it's actually is very difficult to workaround without glitches and re-rendering. |
|
Hi @danielgindi, sorry for the late response. I had begun to look into this a few days back, but got caught up in some other work items. It looks like in our case, the this breaks down because the e.g.: In this case, if you had tried to measure the layout of the I'm not too familiar with iOS. But I'm wondering if this fix is better done in the native ViewManager rather than in JS because this would also affect how the component works for Android. |
|
Sounds weird, as it’s not the root in my case too. And it should not matter as the original code measures its frame relative to the root, not the parent. And the patch does the same, only considering that the root may be offset. |
|
@xyin96 Could you please post a sample screen that demonstrates an issue after the fix? I've tested this in all directions, can't see any issue. |
|
@TheSavior I request for this to be re-merged. I've tested this thoroughly in every condition imaginable. The offsets always come out right. Wrapped in |
|
@xyin96, can you help @danielgindi get a repro for the issue that Oculus had? I can't remerge this as is. If this gets landed again as is, it would have the same effect. It would break Oculus and Oculus would revert it. It would require me getting familiar with the Oculus app and getting a repro for you myself which I don't have the bandwidth for, so I'm hoping that @xyin96 can help. I recognize this is unfortunate and doesn't leave you with an easy way to move forward. :-/ |
Summary
I'm using RNN, which embeds RN view inside native view controllers.
On iOS 13, a modal view controller is "floating" and is offset from the top of the screen.
This causes the calculation of inset in
KeyboardAvoidingViewincorrect as it mixes local view controller coordinate space, with keyboard's screen coordinate space.Changelog
[iOS] [Fixed] - Fixed
KeyboardAvoidingViewinset in embedded views (i.e modal view controllers on iOS 13)Test Plan