fix(ios-tabview): crash when setting tab text color (#7188)

This commit is contained in:
Martin Yankov
2019-05-07 13:17:24 +03:00
committed by GitHub
parent dfb08c170f
commit 77c45da790
3 changed files with 26 additions and 1 deletions

View File

@ -27,5 +27,6 @@ export function loadExamples() {
examples.set("tab-view-tab-text-font-size", "tab-view/tab-view-tab-text-font-size");
examples.set("tab-view-android-swipe", "tab-view/tab-view-android-swipe");
examples.set("tab-view-icon-title-placement", "tab-view/icon-title-placement");
examples.set("tab-text-color", "tab-view/tab-text-color");
return examples;
}

View File

@ -0,0 +1,24 @@
<Page>
<TabView tabTextColor="red">
<TabView.items>
<TabViewItem title="Tab 1">
<TabViewItem.view>
<Label text="Label 1" />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Tab 2">
<TabViewItem.view>
<Label text="Label 2" />
</TabViewItem.view>
</TabViewItem>
<TabViewItem title="Tab 3">
<TabViewItem.view>
<Label text="Label 3" />
</TabViewItem.view>
</TabViewItem>
</TabView.items>
</TabView>
</Page>

View File

@ -576,7 +576,7 @@ function getTitleAttributesForStates(tabView: TabView): TabStates {
}
const tabSelectedItemTextColor = tabView.style.selectedTabTextColor;
const selectedTextColor = tabItemTextColor instanceof Color ? tabSelectedItemTextColor.ios : null;
const selectedTextColor = tabSelectedItemTextColor instanceof Color ? tabSelectedItemTextColor.ios : null;
result.selectedState = { [NSFontAttributeName]: font }
if (selectedTextColor) {
result.selectedState[UITextAttributeTextColor] = selectedTextColor