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
[iOS] startInLoadingState with useWebKit breaks initial position on website #474
Comments
Probably related to http://www.openradar.me/22855188. Putting a breakpoint in In - (void)didMoveToWindow
...
CGRect test = self.bounds; // <- added for easier debugging
_webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig];
_webView.scrollView.delegate = self;
_webView.UIDelegate = self;
_webView.navigationDelegate = self;
_webView.scrollView.scrollEnabled = _scrollEnabled;
_webView.scrollView.pagingEnabled = _pagingEnabled; Edit: Nevermind. The initial frame and bounds are always zero, as we are offscreen. The error seems to be related to the handling of Probably some kind of layout race condition.. |
Works when commenting out the line with That was or is probably needed as a workaround for something else like mentioned in the radar report from above comments. ButIn https://stackoverflow.com/a/46466883/844907 the Apple Engineer smileyborg mentiones regarding the
Emphasis mine. Probably the define check needs adjustment. Note: I am not aware of a check that is able to do this as a compiler macro. Edit: Also an issue in upstream RN Core in |
Addendum: Same error when using |
@winkelsdorf feel free to submit a PR |
@Titozzz Would love to, but I'm an iOS (Swift) Developer and have no clue where to start with such bugs in RN components. |
Well the part broken is in the iOS code it seems so you should be able to update it :) |
@Titozzz Sorry, looks like it's not that easy. That needs some help of a component aware RN/iOS developer. That's why I stopped after several hours of debugging and reported this issue. E.g. the handling of There has to be an undocumented reason that somebody did this? If I start changing things without knowing about the, I would likely break other things. If anyone is willing to explain, join discussion or contribute, let me know. |
As said it's not that easy. Spent 4 hours already, current observations:
As the frame of the
Ignoring zero rects with I am currently missing the link between the loading view on RN side and the frame bounds in the objc side. Edit: I guess setting RN code changes height to 0 several times (hidden during activity, on error) which of course breaks native scrollView handling. @Titozzz So, what should I do now? Looks like the broken part is in the RN code. How to you hide a view without setting height to 0? Edit 3: Setting style to To fix also Androids ErrorView (https://stackoverflow.com/questions/55489803/remove-android-default-error-page-on-react-native-webview/) I would suggest changing the whole logic to something like an overlay on the RN side. |
I've thought about this many times. I could try to do that. I'll make a branch you can test |
@Titozzz Great idea! As this would also fix the issues with the Android Error Page, feel free to close this issue and put it on a roadmap. On the other hand I'm going to sort some smaller issues out with the native implementation (e.g. unneeded forced enum casting) and try to understand the old logic and do a bit of a rewrite for the iOS Part. As RN support iOS 9+ only, some of the keyboard handler fixes might be removed as well. Thanks for your help 👍 |
should be fixed since 5.11.0 |
@Titozzz Thanks for the update! Initial position works as expected now. |
Using
startinLoadingState
used together withuseWebKit
currently breaks the initial position of a loaded website on iOS:Expected and actual screenshots both reflect the initial state after loading.
Expected
Actual
Steps to reproduce
WebView
withstartInLoadingState
anduseWebKit
both set totrue
source
Simple demo to reproduce
Turning off either makes it work like expected.
Environmnent
react-native@0.59.3
react-native-webview@5.6.0
Verified bug on
The text was updated successfully, but these errors were encountered: