Wednesday, 3 July 2019

Remote image on NavigationButton in Nativescript/Angular

I want to put the user's avatar on the left of my app's header. It works fine in IOS, but it doesn't work in android. I tried to do this:

    <NavigationButton [icon]="customImage" color="#a81b38" (tap)="toggleSideDrawer()" *ngIf="isAndroid">
    <StackLayout verticalAlignment="center">
        <Label id="avatarImg" height="45" width="45" borderRadius="50" backgroundColor="#eeeeee"></Label>
    </StackLayout>
</NavigationButton>

but I get an error during compilation. The custom image is a remote image (https://myimage), but android is looking into local file resoucers.

So I removed the [icon] and I put the image inside, trying this:

    <NavigationButton color="#a81b38" (tap)="toggleSideDrawer()" *ngIf="isAndroid">
    <StackLayout verticalAlignment="center">
        <Label [style.background-image]="customImage" style.background-position="center"
            style.background-size="cover" class="avatarImage" height="30" width="30" borderRadius="50"
            backgroundColor="#eeeeee"></Label>
    </StackLayout>
</NavigationButton>

I don't get any error, but I can't see anything in my header, it's all white. I tried also to use instead of , but same issue



from Remote image on NavigationButton in Nativescript/Angular

No comments:

Post a Comment