JoshDSommer / nativescript-ngx-shadow

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

[iOS] NativescriptAnimationModule doesn't work when using shadow on iOS #21

Open acivier-serial opened 4 years ago

acivier-serial commented 4 years ago

When using the NativeScriptAnimationsModule with shadow on a element you got this error: ERROR Error: View already has a parent. View: Button(3) Parent: StackLayout(2)

Which platform(s) does your issue occur on?

Please, provide the following version numbers that your issue occurs with:

Please, tell us how to recreate the issue in as much detail as possible.

Just import the NativeScriptAnimationsModule in your app.module.ts then use the shadow directive on an element.

This is probably caused by the addIosWrapper function inside the directive https://github.com/JoshDSommer/nativescript-ngx-shadow/blob/6ca285021bf6ff853a7a74554ecd713e6bb97b6a/lib/src/nativescript-ngx-shadow/ng-shadow.directive.ts#L126-L140

Is there any code involved?

Here is a sample project to reproduce the issue : https://github.com/acivier-serial/issue-ngx-shadow-angular-animation

pekevski commented 4 years ago

This is impacting me as well.

alexist commented 3 years ago

same issue for me, is there a workaround ?

alexist commented 3 years ago

just found a workaround

    this.render.removeChild(parent, originalElement); 
    if (originalElement.parentNode) {
        originalElement.parentNode.removeChild(originalElement);
    }