Skip to content

Commit

Permalink
[NavigationSuite] Introduce custom class MDCBottomNavigationBarItem t…
Browse files Browse the repository at this point in the history
…hat supports setting a custom badge appearance for each UITabBarItem. Add API to MDCBottomNavigationBar to allow users to set an array of MDCBottomNavigationBarItems.

PiperOrigin-RevId: 697712760
  • Loading branch information
loading-google authored and material-automation committed Nov 18, 2024
1 parent c4743a1 commit b1bd6f2
Show file tree
Hide file tree
Showing 5 changed files with 364 additions and 12 deletions.
16 changes: 16 additions & 0 deletions components/BottomNavigation/src/MDCBottomNavigationBar.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// TODO(b/151929968): Delete import of MDCBottomNavigationBarDelegate.h when client code has been
// migrated to no longer import MDCBottomNavigationBarDelegate as a transitive dependency.
#import "MDCBottomNavigationBarDelegate.h"
#import "MDCBottomNavigationBarItem.h"
#import "MaterialElevation.h"
#import "MDCMinimumOS.h" // IWYU pragma: keep
#import "MaterialShadow.h"
Expand Down Expand Up @@ -117,14 +118,29 @@ typedef NS_ENUM(NSInteger, MDCBottomNavigationBarAlignment) {
recommended the array contain at least three items and no more than five items -- appearance may
degrade outside of this range.
*/
// TODO(b/378528228): Remove this property once all clients have migrated to using `barItems`.
@property(nonatomic, copy, nonnull) NSArray<UITabBarItem *> *items;

/**
An array of MDCBottomNavigationBarItems that is used to populate bottom navigation bar content. It
is strongly recommended the array contain at least three items and no more than five items --
appearance may degrade outside of this range.
*/
@property(nonatomic, copy, nonnull) NSArray<MDCBottomNavigationBarItem *> *barItems;

/**
Selected item in the bottom navigation bar.
Default is no item selected.
*/
// TODO(b/378528228): Remove this property once all clients have migrated to using `barItems`.
@property(nonatomic, weak, nullable) UITabBarItem *selectedItem;

/**
Selected MDCBottomNavigationBarItem in the bottom navigation bar.
Default is no item selected.
*/
@property(nonatomic, weak, nullable) MDCBottomNavigationBarItem *selectedBarItem;

/**
Display font used for item titles.
Default is system font.
Expand Down
Loading

0 comments on commit b1bd6f2

Please sign in to comment.