Sephen
Sephen

Reputation: 1111

Nativescript Font Awesome in FormattedSring Button

I want to show font-awesome icons in my nativescript application but its not showing everywhere.

<ScrollView row="0" orientation="vertical" ios.pagingEnabled="true">
    <StackLayout #container verticalAlignment="center">
        <Image src="res://logo_icon_white" stretch="none" horizontalAlignment="center"></Image>
        <label [text]="'WELCOME' | translate" class="welcome-text" horizontalAlignment="center"></label>

        <label text="&#xf230; " class="font-awesome" horizontalAlignment="center"></label> <--- WORKS!

        <Button [text]="'LOGIN_WITH_PASWWORD' | translate" (tap)="tapped()"></Button>
        <Button>
            <FormattedString>
                <Span text="&#xf230; " class="font-awesome"></Span> <--- DOESN'T WORK!
                <Span text="&#xf230; " style="font-family: FontAwesome;"></Span> <--- DOESN'T WORK!
                <Span [text]="'PROCEED_WITH_FACEBOOK' | translate" ></Span>
            </FormattedString>
        </Button>
        <Button [text]="'CREATE_AN_ACCOUNT' | translate" class="account-button"></Button>
    </StackLayout>
</ScrollView>

When i use it in a Label it shows the icon but when i want to display it in a FormattedString/Button (because i use translation) it doesn't show the icon.

I hope someone can help?

Upvotes: 1

Views: 1248

Answers (1)

Peter Staev
Peter Staev

Reputation: 1119

The Span element currently does not support styling through CSS. You should use the span's properties to set the styling. In your case the following should work:

<Span text="&#xf230;" fontFamily="FontAwesome"></Span>

Upvotes: 1

Related Questions