Thanks to visit codestin.com
Credit goes to github.com

Skip to content

The color of font icon in action bar is not changing after initial rendering #8211

Open
@xuhcc

Description

@xuhcc

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: 6.3.0
  • Cross-platform modules: 6.3.0
  • Android Runtime: 6.3.0
  • iOS Runtime: -
  • Plugin(s): -

Describe the bug

The color of font icon in action bar is not changing after initial rendering of a page.

To Reproduce

I'm seeing this behaviour in a nativescript-angular app on Android.

HTML:

<ActionItem
    icon="font://&#xe161;"
    class="action-bar-icon"
    [class.disabled]="someCondition()"
></ActionItem>

CSS:

.action-bar-icon {
    color: #FFFFFF;
}
.disabled {
    color: #666666;
}

Expected behavior

The color of icon in action bar should change from #FFFFFF to #666666 when the condition changes.

Additional context

Currently the following workaround could be used:

<ActionBar (loaded)="onActionBarLoaded($event)">
onActionBarLoaded(event: any): void {
    const actionBar = event.object;
    someConditionObservable.subscribe(() => {
        // Delay update so it will be done after class toggle
        setTimeout(() => {
            actionBar.update();
        }, 0);
    });
}

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