FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Crashing when trying to change tabTextColor for iOS · Issue #7166 · NativeScript/NativeScript · GitHub

Crashing when trying to change tabTextColor for iOS #7166

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL