Skip to content

Commit

Permalink
Merge branch 'feature/tab-bar-item-props' into version-2.3
Browse files Browse the repository at this point in the history
* feature/tab-bar-item-props:
  Add totally awesome spec which verifies that the image inset feature works
  Add image inset support for tab bar item
  • Loading branch information
ryanlntn committed Jan 23, 2015
2 parents 7a69786 + 2f1a4f6 commit 7f49202
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/test_screens/tab_screen.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TabScreen < PM::Screen
title "Tab"
tab_bar_item title: "Tab Item", item: "list"
tab_bar_item title: "Tab Item", item: "list", image_insets: [5,5,5,5]
end
1 change: 1 addition & 0 deletions lib/ProMotion/tabs/tabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def create_tab_bar_item(tab={})
tab_bar_item = create_tab_bar_item_custom(title, tab[:item], current_tag) if tab[:item]

tab_bar_item.badgeValue = tab[:badge_number].to_s unless tab[:badge_number].nil? || tab[:badge_number] <= 0
tab_bar_item.imageInsets = tab[:image_insets] if tab[:image_insets]

tab_bar_item
end
Expand Down
4 changes: 4 additions & 0 deletions spec/unit/tab_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
@tab_bar.tabBar.items.first.title.should == "Tab Item"
end

it "should allow setting image insets" do
@tab_bar.tabBar.items.first.imageInsets.should == UIEdgeInsetsMake(5,5,5,5)
end

it "should have set the others to their respective titles" do
@tab_bar.tabBar.items[1].title.should == "Basic"
@tab_bar.tabBar.items[2].title.should == "Home"
Expand Down

0 comments on commit 7f49202

Please sign in to comment.