Skip to content

app freezing for 5 seconds withe nativescript-photo-editor #1726

Open
@Serge-SDL

Description

@Serge-SDL

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: 5.1.0
  • Android Runtime: 5.1.0
  • Plugin(s): nativescript-photo-editor
  • NativeScript-Angular: 7.1.0
  • Angular: 7.1.0

Describe the bug
Hello, I have got a strange behavior using nativescript-photo-editor plugin. I post here because I don't think it's related to the plugin : same exact code woks fine on pure nativescript (without angular).
When I edit a phot with PhotoEditor and cancel (or save or whatever), the app is like feezing for 5 seconds. I tryed to add timers to see if it was the actual behavior -> and il looks like 1 second setTimeOut take 5 seconds to be executed (same time as freezing feeling on app).
When I execute de code I got this logs:

  • setTimeout 100 after 115ms -> this one is expected
  • setTimeout 1000 after 5101ms -> this one is not expected (takes 5 seconds to handle 1000ms timeout !!!)
    Same exact code and pure js nativescript gives "setTimeout 1000 after 1004ms"...

To Reproduce

  • start from hello-world angular ns template
  • add nativescript-photo-editor pluging
  • Change HomeComponent (add editImage method):
editImage() {
        const photoEditor = new PhotoEditor();
        const imageSource: ImageSource = fromFileOrResource("~/app/test-image.jpg");
    
        photoEditor.editPhoto({
            imageSource: imageSource, // originalImage.imageSource,
            hiddenControls: [],
        }).then((newImage: ImageSource) => {
            console.log('NEW IMAGE: ', newImage.height, newImage.width);
        }).catch((e) => {
            console.log('ERROR', e);
            var time = (new Date()).getTime();
            setTimeout(() => console.log('setTimeout 1000 after ' + ((new Date()).getTime() - time) + 'ms'), 1000);
            setTimeout(() => console.log('setTimeout 100 after ' + ((new Date()).getTime() - time) + 'ms'), 100);
        });
}
  • Change homme.component.html template (add image and button):
<ActionBar class="action-bar">
    <Label class="action-bar-title" text="Home"></Label>
</ActionBar>

<StackLayout>
    <Image src="~/app/test-image.jpg" stretch="aspectFit"></Image>
    <Button (tap)="editImage()" text="Lauch"></Button>
</StackLayout>

Do anyone have an idea ?
thanks

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