Especializa / nativescript-ng-shadow

Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Apache License 2.0
54 stars 38 forks source link

ERROR TypeError: Cannot read property 'unit' of null #19

Open devlfm opened 6 years ago

devlfm commented 6 years ago

Hi,

I'm not able to use shadow when inside of a RadListView and ng-template. Always throw that error..

Any workaround?

Thanks

bzaruk commented 6 years ago

+1

this is how my listview item looks

<ng-template tkTemplateKey="error" let-item="item.payload">
    <Stacklayout class="light-background" margin="15, 15, 20, 15" shadow="7">
        <Label class="slight-dark-color" margin="10" [text]="item.errorText"></Label>
    </Stacklayout>
</ng-template>
ERROR TypeError: Cannot read property 'payload' of undefined
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 50970627,
JS:       "rootNodeFlags": 3,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 0,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": -1,
JS:           "flags": 2,
JS:           "childFlags": 0,
JS:           "directChildFlags": 0,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 0,
JS:           "bindings": [],
JS:           "bindingFlags": 8,
JS:           "outputs": [],
JS:           "element": null,
JS:           "provider": null,
JS:           "text": {
JS:             "prefix": "\n            "
JS:           },
JS:           "query": null,
JS:           "ngContent": null
JS:         },
JS:         {
JS:           "nodeIndex": 1,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputI...
bzaruk commented 6 years ago

Hi @TheOriginalJosh - Sorry to bother you but I wonder if you will have any idea how can we fix it?

bzaruk commented 6 years ago

@devlfm -

I was able to workaround this issue with creating shadow to the element dynamically on itemLoading event.

Like this: HTML:

<RadListView class="full-stretch" [items]="items" (itemLoading)="onItemLoading($event)">
</RadListView>

TS:

public onItemLoading(args: ListViewEventData) {
    Shadow.apply(args.view, { elevation: 7 });
}
darkmantle commented 6 years ago

@shabib3 How did you get access to Shadow ? What import did you use?

darkmantle commented 6 years ago

Figured that out, yet it doesn't work for me either. There is still no shadow in the ListItem - even when removing all styling as I had a background set before.

vahidvdn commented 5 years ago

I have the same issue with nativescript-fresco. I think this relates to RadlistView component. Any workaround?