Skip to content

[Android] BottomNavigation crash when using :active + no Image in TabStripItem #8311

Closed

Description

@NickIliev

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: latest (6.3.3)
  • Cross-platform modules: latest (6.3.0) and next (^6.3.0-next-2020-01-30-213549-03)
  • Android Runtime: 6.3.0
  • iOS Runtime: n/a

To Reproduce

  • Use this app (template with tab navigation)
  • Observe the CSS files for Android
  • Remove/comment all Image tags from all TabStripItem elements (e.g. here)
  • Press on any tab - as a result, thapp will crash with
System.err: An uncaught Exception occurred on "main" thread.
System.err: Calling js method onSelectedPositionChange failed
System.err: Error: undefined is not a valid file or resource.
System.err: 
System.err: StackTrace:
System.err: push.../node_modules/@nativescript/core/image-source/image-source.js.ImageSource.fromFileOrResourceSync(file:///node_modules/@nativescript/core/image-source/image-source.js:118:0)
System.err:     at push.../node_modules/@nativescript/core/ui/bottom-navigation/bottom-navigation.js.BottomNavigation.getIcon(file:///node_modules/@nativescript/core/ui/bottom-navigation/bottom-navigation.js:474:0)
System.err:     at push.../node_modules/@nativescript/core/ui/bottom-navigation/bottom-navigation.js.BottomNavigation.setTabBarIconColor(file:///node_modules/@nativescript/core/ui/bottom-navigation/bottom-navigation.js:533:0)
System.err:     at (file:///node_modules/@nativescript/core/ui/tab-navigation-base/tab-strip-item/tab-strip-item.js:97:0)

Expected behavior
The app doesn't crash when using :active state in combination with TabStripItem (with no Image)

Sample project
https://github.com/NickIliev/NS-Issues-2020/tree/master/others/t-1452319

Additional context
The issue is not present if we remove the :active state CSS class.

Reported via t.1452320

Activity

  1. changed the title [-][Android] BottomNavigation crash when using :active + no Image in TabStrtipItem[/-] [+][Android] BottomNavigation crash when using :active + no Image in TabStripItem[/+] on Feb 6, 2020
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