Skip to content

TNS 3.1 breaks background-color through css binding for iOS #4450

Closed

Description

@PeterStaev

This is regarding the DropDown plugin. In TNS 3.0 binding the value of the class that has some background-color property defined worked flawlessly. Now after I've upgraded the demo project to 3.1 setting the background-color fails with the following error:

CONSOLE ERROR file:///app/tns_modules/tns-core-modules/trace/trace.js:165:30: Error: Failed to apply property [background-color
] with value [blue] to DropDown<dd>@file:///app/main-page.xml:3:5;. TypeError: value1.equals is not a function. (In 'value1.equ
als(value2)', 'value1.equals' is undefined)

After debugging the issue turns out that here:

let prev = this[computedValue];
the oldValue ends up an instance of UIColor instead of Color and thus the comparison is failing. I have not made any changes to the styling so it must be some of the changes to the TNS core that is messing up the value. In addition testing the same demo app with TNS 3.0 oldValue ends up correctly as an instance of Color

The issue can be easily simulated by using the demo project for the drop down and upgrading it to 3.1 and pressing Change Styles button once it runs.

Activity

  1. bradmartin commented on Jun 26, 2017

    @bradmartin
    Contributor
  2. sserdyuk commented on Jun 28, 2017

    @sserdyuk

    @PeterStaev @tsonevn This isn't just iOS or a plugin issue. It's a general 3.1 issue, here's the test app: https://github.com/sserdyuk/ns-bug-4450

    JS: Error: Failed to apply property [background-color] with value [red] to Switch(16)@file:///app/main-page.xml:7:9;. TypeError: value1.equals is not a function
    JS: Error: Failed to apply property [background-color] with value [red] to Switch(16)@file:///app/main-page.xml:7:9;. TypeError: value1.equals is not a function
    JS: Error: Failed to apply property [background-color] with value [red] to Switch(16)@file:///app/main-page.xml:7:9;. TypeError: value1.equals is not a function
    JS: Error: Failed to apply property [background-color] with value [red] to Switch(16)@file:///app/main-page.xml:7:9;. TypeError: value1.equals is not a function
    Executing before-prepare hook from /home/sergei/Projects/Tests/SwitchBackgroundColor/hooks/before-prepare/nativescript-dev-typescript.js
    
    
  3. NickIliev commented on Jun 29, 2017

    @NickIliev
    Contributor

    @sserdyuk using your test application I was not able to reproduce the issue neither on Android (tested API19 and API25) or iOS.

    @PeterStaev I have also tried to reproduce the issue using your demo project but I was not able to run the demo (entry point error) so I have made this test project based on your demo logic. However, the issue is not preproducible (tested both iOS and Android - can you take a look at the test project and let me know if you can reproduce the issue?

  4. PeterStaev commented on Jun 29, 2017

    @PeterStaev
    ContributorAuthor

    @NickIliev , sorry but I cannot download the test project as it is included in one huge repo and I do not want to download everything...

    Attaching the demo project from the DropDown repo with updated deps. So simply run tns run ios and then press Change Styles in the app.
    demo.zip

  5. sserdyuk commented on Jun 29, 2017

    @sserdyuk

    @NickIliev Did you check the log in the terminal? The switch does change color, so it's working as expected, but each time you toggle it, an error is printed in the terminal.

  6. PeterStaev commented on Jun 29, 2017

    @PeterStaev
    ContributorAuthor

    Yes, sometimes styles are changed, sometimes the widget is totally messed up. So the error does not crash the app, but still seems a problem with the applying the styles.

  7. bradmartin commented on Jun 29, 2017

    @bradmartin
    Contributor

    @manijak - does any of this look familiar from the cardview debugging you did last week?

  8. NickIliev commented on Jul 4, 2017

    @NickIliev
    Contributor

    App to reproduce the issue can be found in this linked issue

  9. sserdyuk commented on Jul 7, 2017

    @sserdyuk

    @NickIliev Any update on this issue?

  10. NickIliev commented on Jul 7, 2017

    @NickIliev
    Contributor

    +1 reproducible also on Android via SB template

    sample application here

    Steps to reproduce:

    • go to "Edit" and use the slider (Android)
  11. added this to the milestone on Jul 11, 2017
  12. sserdyuk commented on Jul 16, 2017

    @sserdyuk

    @tsonevn I was using debugger for other reasons and stopped on this exception. Hopefully you can fix it quick, seems like Color.equals is called with a wrong type of parameter. I

    image

    $ tns info
    All NativeScript components versions information
    ┌──────────────────┬─────────────────┬────────────────┬─────────────┐
    │ Component        │ Current version │ Latest version │ Information │
    │ nativescript     │ 3.1.2           │ 3.1.2          │ Up to date  │
    │ tns-core-modules │ 3.1.0           │ 3.1.0          │ Up to date  │
    │ tns-android      │ 3.1.1           │ 3.1.1          │ Up to date  │
    │ tns-ios          │ 3.1.0           │ 3.1.0          │ Up to date  │
    
    
  13. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Jul 26, 2017
  14. SvetoslavTsenov commented on Jul 27, 2017

    @SvetoslavTsenov
    Contributor

    The fix is already available in tns-core-modules@next and will be released officially with tns-core-modules@3.2.0.

  15. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Jul 27, 2017
  16. modified the milestones: 3.1.1, on Jul 28, 2017
  17. lock commented on Aug 28, 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.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions