Skip to content

Segmentedbar crash using a number as title - 2.4.0 android #3210

Closed

Description

@FmarquezM

In android, If you use a number as title in a segmentedbar item the app crash.
Not tested in iOS.

image

<SegmentedBar>
        <SegmentedBar.items>
            <SegmentedBarItem title="1" />
            <SegmentedBarItem title="2" />
        </SegmentedBar.items>
</SegmentedBar>

Perhaps this isn't the right way but i solved it with this little "hack" in this file.

/YOUR_APP_FOLDER/platforms/android/src/main/assets/app/tns_modules/ui/segmented-bar/segmented-bar.js

In line 141 replace "||" with "+".

tab.setIndicator(tabItem.title || ""); --> tab.setIndicator(tabItem.title + "");

Activity

  1. NickIliev commented on Nov 30, 2016

    @NickIliev
    Contributor

    Hello @FmarquezM

    Thanks for reporting this issue - I have tested it and can confirm that it is reproducible on Android and iOS.

    Code to reproduce this issue here

    Possible related to these lines (Android) and the respective ones for iOS as the value received is not of type string

    https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts#L113

    https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/ui/segmented-bar/segmented-bar.android.ts#L165

  2. FmarquezM commented on Nov 30, 2016

    @FmarquezM
    Author

    Happy to can help in some way.

    Thanks a lot for your work, i'm really enjoying Nativescript !!

  3. added this to the milestone on Dec 5, 2016
  4. modified the milestones: 2.5.0, on Dec 5, 2016
  5. self-assigned this
    on Dec 8, 2016
  6. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    and removed on Jan 4, 2017
  7. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Jan 9, 2017
  8. lock commented on Aug 29, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  9. locked and limited conversation to collaborators on Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions