Skip to content
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 16: Tab Group not respecting safe area insets #13479

Closed
hansemannn opened this issue Jun 7, 2022 · 2 comments · Fixed by #13522
Closed

iOS 16: Tab Group not respecting safe area insets #13479

hansemannn opened this issue Jun 7, 2022 · 2 comments · Fixed by #13522
Assignees

Comments

@hansemannn
Copy link
Collaborator

hansemannn commented Jun 7, 2022

Description

On iOS 16 Beta 1, the tab group does not honor the top-/bottom insets of the phone.

Expected Behavior

It should add proper top-/bottom insets.

Actual behavior

It does...not.

Reproducible sample

const window1 = Ti.UI.createWindow({ title: 'Window 1' });
const window2 = Ti.UI.createWindow({ title: 'Window 2' });
const window3 = Ti.UI.createWindow({ title: 'Window 3' });

const tabGroup = Ti.UI.createTabGroup({
	tabs: [
		Ti.UI.createTab({ window: window1, title: 'Tab 1' }),
		Ti.UI.createTab({ window: window2, title: 'Tab 2' }),
		Ti.UI.createTab({ window: window3, title: 'Tab 3' })
	]
});

tabGroup.open();

Steps to reproduce

  1. Run the sample code

Platform

iOS

SDK version you are using

11.0.0

Alloy version you are using

No response

@hansemannn hansemannn added bug needs triage This issue hasn't been reviewed by maintainers labels Jun 7, 2022
@hansemannn hansemannn self-assigned this Jun 7, 2022
@hansemannn hansemannn added ios-16 and removed needs triage This issue hasn't been reviewed by maintainers labels Jun 7, 2022
@hansemannn
Copy link
Collaborator Author

hansemannn commented Jul 31, 2022

I was hoping that this will be fixed in one of the latest betas, but it seems like a Titanium-specific issue that we need to fix.

EDIT: It seems like the issue is that we are adding the view of the UITabBarController to the parent view instead of opening the view controller itself (inside the open: selector of the TiUITabGroup). This might be hard to tackle.

EDIT 2: Calling the following instead works, but it also decouples it from the TiRootViewController, which may have critical side glitches:

- (void)open:(id)args
{
  [[TiApp app] showModalController:self.tabController animated:NO];
}

EDIT 3: It also seems to work when adding a timeout, indicating that the safe area has not finished it's layout, yet:

- (void)open:(id)args
{
  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
    UIView *view = [self tabController].view;
    [view setFrame:[self bounds]];
    [self addSubview:view];
  });
}

Notable: The rect height remains the same.

@hansemannn
Copy link
Collaborator Author

Found it, wow. PR incoming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant