Skip to content

Commit 99461f5

Browse files
authored
feat(ios): support for iOS 26+ bottomAccessoryView API (#14259)
* feat(ios): add support for iOS 26+ bottomAccessoryView API * feat: add iOS 26+ minimizeBehavior API * fix: add missing iOS 26+ flags * fix: revert testing statement * chore: always release bottomAccessoryView if set
1 parent ce3752b commit 99461f5

File tree

6 files changed

+149
-12
lines changed

6 files changed

+149
-12
lines changed

apidoc/Titanium/UI/TabGroup.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,18 +243,18 @@ methods:
243243
notes: Use the <Titanium.UI.TabGroup.tabs> property instead.
244244

245245
- name: showTabBar
246-
summary: Shows the tab bar with animation.
246+
summary: Shows the tab group with animation.
247247
description: |
248248
This method also updates iOS 18+ [Elevated Tab Bar on iPad](https://developer.apple.com/documentation/uikit/elevating-your-ipad-app-with-a-tab-bar-and-sidebar).
249-
To show tab bar without animation, set [tabBarVisible](Titanium.UI.TabGroup.tabBarVisible) property to `false`.
249+
To show tab group without animation, set [tabBarVisible](Titanium.UI.TabGroup.tabBarVisible) property to `false`.
250250
platforms: [android, iphone, ipad, macos]
251251
since: "12.7.0"
252252

253253
- name: hideTabBar
254-
summary: Hides the tab bar with animation.
254+
summary: Hides the tab group with animation.
255255
description: |
256256
This method also updates iOS 18+ [Elevated Tab Bar on iPad](https://developer.apple.com/documentation/uikit/elevating-your-ipad-app-with-a-tab-bar-and-sidebar).
257-
To hide tab bar without animation, set [tabBarVisible](Titanium.UI.TabGroup.tabBarVisible) property to `true`.
257+
To hide tab group without animation, set [tabBarVisible](Titanium.UI.TabGroup.tabBarVisible) property to `true`.
258258
platforms: [android, iphone, ipad, macos]
259259
since: "12.7.0"
260260

@@ -307,6 +307,25 @@ properties:
307307
type: [String, Titanium.UI.Color]
308308
platforms: [iphone, ipad, android, macos]
309309

310+
- name: bottomAccessoryView
311+
summary: View shown as a bottom accessory attached to the tab group.
312+
description: |
313+
Adds a custom view as a bottom accessory of the tab group. Available on iOS 26+ only (uses the new iOS tab group accessories).
314+
315+
Note: Label subviews require explicit width and height set to render properly. Be sure to set `width` and `height` on any `Ti.UI.Label` added to this view.
316+
type: Titanium.UI.View
317+
osver: {ios: {min: "26.0"}}
318+
platforms: [iphone, ipad, macos]
319+
since: "13.0.0"
320+
321+
- name: minimizeBehavior
322+
summary: Defines the minimize behavior for the tab group, if it is supported.
323+
type: Number
324+
constants: Titanium.UI.iOS.TAB_GROUP_MINIMIZE_BEHAVIOR_*
325+
osver: {ios: {min: "26.0"}}
326+
platforms: [iphone, ipad, macos]
327+
since: "13.0.0"
328+
310329
- name: enabled
311330
summary: |
312331
Enables or disables the menu in a BottomNavigation. If disabled you can't change to a different tab.
@@ -534,16 +553,16 @@ properties:
534553
notes: Deprecated in favor of [Titanium.UI.TabGroup.tintColor](Titanium.UI.TabGroup.tintColor) or alternatively [Titanium.UI.Tab.tintColor](Titanium.UI.Tab.tintColor).
535554

536555
- name: tabsTranslucent
537-
summary: A Boolean value that indicates whether the tab bar is translucent.
556+
summary: A Boolean value that indicates whether the tab group is translucent.
538557
description: |
539558
When the value of this property is `true`, the tab group adds a translucent effect to its background
540-
image or tint color. When translucency is enabled, part of the tab bar's underlying content is able
541-
to show through, although the amount that shows through depends on the rest of the tab bar configuration.
559+
image or tint color. When translucency is enabled, part of the tab group's underlying content is able
560+
to show through, although the amount that shows through depends on the rest of the tab group configuration.
542561
For example, a background image can wholly or partially obscure the background content. Setting this
543-
property to NO causes the tab bar to render its bar tint color or background image on top of an opaque backdrop.
562+
property to NO causes the tab group to render its bar tint color or background image on top of an opaque backdrop.
544563
545-
The default value of this property is dependent on the configuration of the tab bar:
546-
* The default value is `true` when the tab bar does not have a custom background image.
564+
The default value of this property is dependent on the configuration of the tab group:
565+
* The default value is `true` when the tab group does not have a custom background image.
547566
* The default value is `true` when a custom background image contains any transparency - that is,
548567
at least one pixel has an alpha value of less than 1.0.
549568
* The default value is `false` when the custom background image is completely opaque - that is,
@@ -606,7 +625,7 @@ properties:
606625
notes: Deprecated in favor of [Titanium.UI.TabGroup.tintColor](Titanium.UI.TabGroup.tintColor) or alternatively [Titanium.UI.Tab.tintColor](Titanium.UI.Tab.tintColor).
607626

608627
- name: shadowImage
609-
summary: Image of the shadow placed between the tab bar and the content area.
628+
summary: Image of the shadow placed between the tab group and the content area.
610629
description: |
611630
The <Titanium.UI.TabGroup.tabsBackgroundImage> property must also be set
612631
in order for this to take effect.
@@ -646,7 +665,7 @@ properties:
646665
since: { iphone: "3.1.0", ipad: "3.1.0" }
647666

648667
- name: tabBarVisible
649-
summary: Programmatically shows / hides the bottom tab bar of the tab group.
668+
summary: Programmatically shows / hides the bottom tab group of the tab group.
650669
description: |
651670
This method also updates iOS 18+ [Elevated Tab Bar on iPad](https://developer.apple.com/documentation/uikit/elevating-your-ipad-app-with-a-tab-bar-and-sidebar).
652671
Notes: Animation effect is applied on iOS <= 17, but will be removed in SDK 13.0.0.

apidoc/Titanium/UI/iOS/iOS.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,46 @@ properties:
12901290
since: "8.0.0"
12911291
permission: read-only
12921292

1293+
- name: TAB_GROUP_MINIMIZE_BEHAVIOR_AUTOMATIC
1294+
summary: Automatically determine when the tab group minimizes.
1295+
description: |
1296+
Use with <Titanium.UI.TabGroup.minimizeBehavior> to let the system choose the appropriate
1297+
minimize behavior based on context and platform conventions.
1298+
type: Number
1299+
osver: { ios: { min: "26.0" } }
1300+
since: "13.0.0"
1301+
permission: read-only
1302+
1303+
- name: TAB_GROUP_MINIMIZE_BEHAVIOR_NEVER
1304+
summary: Do not minimize the tab group.
1305+
description: |
1306+
Use with <Titanium.UI.TabGroup.minimizeBehavior> to keep the tab group visible and prevent
1307+
it from minimizing in response to scrolling.
1308+
type: Number
1309+
osver: { ios: { min: "26.0" } }
1310+
since: "13.0.0"
1311+
permission: read-only
1312+
1313+
- name: TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_UP
1314+
summary: Minimize the tab group when scrolling up.
1315+
description: |
1316+
Use with <Titanium.UI.TabGroup.minimizeBehavior> to minimize the tab group as the user scrolls
1317+
upward.
1318+
type: Number
1319+
osver: { ios: { min: "26.0" } }
1320+
since: "13.0.0"
1321+
permission: read-only
1322+
1323+
- name: TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_DOWN
1324+
summary: Minimize the tab group when scrolling down.
1325+
description: |
1326+
Use with <Titanium.UI.TabGroup.minimizeBehavior> to minimize the tab group as the user scrolls
1327+
downward.
1328+
type: Number
1329+
osver: { ios: { min: "26.0" } }
1330+
since: "13.0.0"
1331+
permission: read-only
1332+
12931333
---
12941334
name: SystemImageParameters
12951335
summary: |

iphone/Classes/TiUITabGroup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
NSMutableDictionary *theAttributes;
2323

2424
BOOL isTabBarHidden;
25+
TiUIView *bottomAccessoryView;
2526
}
2627

2728
- (UITabBarController *)tabController;

iphone/Classes/TiUITabGroup.m

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,34 @@ - (void)hideTabBar:(BOOL)hidden animated:(BOOL)animated
413413
}];
414414
}
415415

416+
#if IS_SDK_IOS_26
417+
- (void)setBottomAccessoryView_:(id)bottomAccessoryViewProxy
418+
{
419+
if (bottomAccessoryView != nil) {
420+
[self.proxy forgetProxy:bottomAccessoryView.proxy];
421+
RELEASE_TO_NIL(bottomAccessoryView);
422+
}
423+
424+
if (bottomAccessoryViewProxy == [NSNull null]) {
425+
[[self tabController] setBottomAccessory:nil];
426+
return;
427+
}
428+
429+
[self.proxy rememberProxy:bottomAccessoryViewProxy];
430+
431+
bottomAccessoryView = [(TiViewProxy *)bottomAccessoryViewProxy view];
432+
[bottomAccessoryView retain];
433+
434+
UITabAccessory *tabAccessory = [[UITabAccessory alloc] initWithContentView:bottomAccessoryView];
435+
[[self tabController] setBottomAccessory:tabAccessory animated:NO];
436+
}
437+
438+
- (void)setMinimizeBehavior_:(NSNumber *)minimizeBehavior
439+
{
440+
[[self tabController] setTabBarMinimizeBehavior:minimizeBehavior.integerValue];
441+
}
442+
#endif
443+
416444
- (void)setTabsBackgroundColor_:(id)value
417445
{
418446
TiColor *color = [TiUtils colorValue:value];

iphone/Classes/TiUIiOSProxy.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@
169169
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_ALWAYS;
170170
@property (nonatomic, readonly) NSNumber *LARGE_TITLE_DISPLAY_MODE_NEVER;
171171

172+
@property (nonatomic, readonly) NSNumber *TAB_GROUP_MINIMIZE_BEHAVIOR_AUTOMATIC;
173+
@property (nonatomic, readonly) NSNumber *TAB_GROUP_MINIMIZE_BEHAVIOR_NEVER;
174+
@property (nonatomic, readonly) NSNumber *TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_DOWN;
175+
@property (nonatomic, readonly) NSNumber *TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_UP;
176+
172177
/**
173178
* Checks the force touch capibility of the current device.
174179
*/

iphone/Classes/TiUIiOSProxy.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,50 @@ - (id)createWebViewProcessPool:(id)args
853853
MAKE_SYSTEM_PROP(INJECTION_TIME_DOCUMENT_END, WKUserScriptInjectionTimeAtDocumentEnd);
854854
#endif
855855

856+
- (NSNumber *)TAB_GROUP_MINIMIZE_BEHAVIOR_AUTOMATIC
857+
{
858+
#if IS_SDK_IOS_26
859+
if (@available(iOS 26.0, *)) {
860+
return @(UITabBarMinimizeBehaviorAutomatic);
861+
}
862+
#endif
863+
864+
return @(-1);
865+
}
866+
867+
- (NSNumber *)TAB_GROUP_MINIMIZE_BEHAVIOR_NEVER
868+
{
869+
#if IS_SDK_IOS_26
870+
if (@available(iOS 26.0, *)) {
871+
return @(UITabBarMinimizeBehaviorNever);
872+
}
873+
#endif
874+
875+
return @(-1);
876+
}
877+
878+
- (NSNumber *)TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_UP
879+
{
880+
#if IS_SDK_IOS_26
881+
if (@available(iOS 26.0, *)) {
882+
return @(UITabBarMinimizeBehaviorOnScrollUp);
883+
}
884+
#endif
885+
886+
return @(-1);
887+
}
888+
889+
- (NSNumber *)TAB_GROUP_MINIMIZE_BEHAVIOR_ON_SCROLL_DOWN
890+
{
891+
#if IS_SDK_IOS_26
892+
if (@available(iOS 26.0, *)) {
893+
return @(UITabBarMinimizeBehaviorOnScrollDown);
894+
}
895+
#endif
896+
897+
return @(-1);
898+
}
899+
856900
- (TiColor *)fetchSemanticColor:(id)color
857901
{
858902
ENSURE_SINGLE_ARG(color, NSString);

0 commit comments

Comments
 (0)