-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(ios): use auto layout to respect safe areas #1099
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
base: master
Are you sure you want to change the base?
Conversation
- Generated-by: XCode 26, GPT-5
- GPT-5 added this, but this plugin supports minimum cordova-ios 6 which supports minimum iOS 11, so this code is not necessary
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 tested this with
cordova.InAppBrowser.open('https://www.apache.org', '_blank', 'location=no,toolbarposition=top')
It seems to have some spaces at the bottom. Is this expected?
|
Thanks for posting this. There should be no gap at the end. I will fix this. |
- Constrain WebView to view bottom, when the address bar is hidden and the toolbar is at top - Handle case, when toolbar is hidden - Add contraints to spinner - Remove code which was related to manual layout - Don't set height manual for toolbar and adresslabel, let auto layout decide. This aligns the toolbar better on iOS 26 with the new button layout.
|
@johann9898 I fixed this. The WebView stretches now to the bottom edge of the phone |
|
@dpogue Is this ok to merge? |
|
@dpogue I see my IDE Visual Studio Code uses LF for line endings and not CRLF. Is there a rule, which one is to use for this project or does it not matter? |
Leave it as LF. We do not use CRLF. |
|
@erisu Ok, I thought this was the thing you mentioned when I changed the package.json in cordova-ios |
LF and CRLF refer to the types of line breaks used by different operating systems. For example, Linux and macOS use LF ( What I commented on last time was the removal of the trailing newline at the end of the file. Cordova repos generally keep a trailing newline at the end of the file. |
Thank's for the clarification. So I know, that every file has to end with an empty new line. I will keep this in mind in future changes. |
dpogue
left a comment
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.
Missing a trailing line break and there are a few weird formatting changes, but the implementation looks okay otherwise
All Cordova project files have to end with an empty new line
I added the trailing line brake.
Can you explain, what you mean with these |
|
@dpogue I would merge this now, is this ok? |
dpogue
left a comment
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.
This is probably fine to merge.
The "weird formatting" I saw was stuff entirely unrelated to the safe area insets that seemed inconsistent with the code style for the rest of the project, like
- (void)goBack:(id)sender
{
[self.webView goBack];
}changing to
- (void)goBack:(id)sender {
[self.webView goBack];
}|
Thank you for explaining, what you mean with What is the general code formatting for Cordova projects when using curly brackets? When I change code, I always change some code styling issues i noticed during development. I use always the curly bracket in one line with the code and not on an extra new line. But I understand it's |
|
@GitToTheHub I’ll be sending a thread to the dev mailing list later about coding style guidelines. We used to have a document years ago that covered coding style, but it wasn’t complete and eventually became outdated. That coding style document page has since been deleted over time—likely due to changes in the system it was hosted on—and was effectively lost. I had to retrieve it from the Wayback Machine to review it. Overall, the thread will discuss and include a link to a PR that reintroduces the guidelines and publishes them on Cordova’s website for better visibility. As a quick response to your question:
It varies by language. In this case, for Objective-C, we follow the Linux brace style, which means breaking before braces on function, namespace, and class definitions. |
|
Hi @erisu, thanks for your response and that you are working on the guidelines. I asked ChatGPT which style is better to use for Objective-C and it said, that it is better to make a curly bracket in one line with the code. It says, it is a convention by Apple and XCode is formatting it like this by default and it takes less space. If the bracket should put on a new line, is this also valid for |
|
I see, that a brace for an I read the Wikipedia article Indentation style and see, that the linux brace style is a derivate of the K&R (Kernighan & Ritchie) style and is documented there as Linux kernel style. The default for Objetive-C is a modern derivative of 1TBS (One true brace style). Should Linux brace style anyway be used? |
How it looks before and now:
iOS 18.5
iOS 26
Platforms affected
Motivation and Context
Description
Testing
Checklist
(platform)if this change only applies to one platform (e.g.(android))