Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
- CLI: 5.3.2
- Cross-platform modules:
- Android Runtime:
- iOS Runtime: 12.2
- Plugin(s):
Describe the bug
is crashing on iOS when tabTextColor attribute is provided.
*** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: undefined is not an object (evaluating 'tabSelectedItemTextColor.ios')
You must also set selectedTabTextColor attribute also to prevent crash.
As @rigor789 noticed, bug is most likely caused by this line:
|
const selectedTextColor = tabItemTextColor instanceof Color ? tabSelectedItemTextColor.ios : null; |
It checks if tabItemTextColor is instance of Color, but then accesses tabSelectedItemTextColor instead.
To Reproduce
Load a view with the following code:
<template>
<Page actionBarHidden="true">
<TabView tabBackgroundColor="white" tabTextColor="red">
<TabViewItem title="Tab1">
<Label text="Content for Tab 1" />
</TabViewItem>
<TabViewItem title="Tab2">
<Label text="Content for Tab 2" />
</TabViewItem>
<TabViewItem title="Tab3">
<Label text="Content for Tab 3" />
</TabViewItem>
<TabViewItem title="Tab4">
<Label text="Content for Tab 4"/>
</TabViewItem>
</TabView>
</Page>
</template>
Expected behavior
It should not crash as well as set default tabSelectedItemTextColor
Sample project
https://play.nativescript.org/?template=play-vue&id=JM3nZz
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
Describe the bug
is crashing on iOS when tabTextColor attribute is provided.
You must also set selectedTabTextColor attribute also to prevent crash.
As @rigor789 noticed, bug is most likely caused by this line:
NativeScript/tns-core-modules/ui/tab-view/tab-view.ios.ts
Line 579 in 4e56c89
It checks if tabItemTextColor is instance of Color, but then accesses tabSelectedItemTextColor instead.
To Reproduce
Load a view with the following code:
<template> <Page actionBarHidden="true"> <TabView tabBackgroundColor="white" tabTextColor="red"> <TabViewItem title="Tab1"> <Label text="Content for Tab 1" /> </TabViewItem> <TabViewItem title="Tab2"> <Label text="Content for Tab 2" /> </TabViewItem> <TabViewItem title="Tab3"> <Label text="Content for Tab 3" /> </TabViewItem> <TabViewItem title="Tab4"> <Label text="Content for Tab 4"/> </TabViewItem> </TabView> </Page> </template>Expected behavior
It should not crash as well as set default tabSelectedItemTextColor
Sample project
https://play.nativescript.org/?template=play-vue&id=JM3nZz