Git Product home page Git Product logo

Comments (4)

rdlauer avatar rdlauer commented on July 17, 2024 3

Dang, that was it! Thank you @NathanWalker and I have to say after coming back to {N} after all these years, the dev experience is really slick. 🙏

from plugins.

NathanWalker avatar NathanWalker commented on July 17, 2024 1

Thank you for confirming, let us know any other snags - your feedback is always much appreciated!

from plugins.

shiv19 avatar shiv19 commented on July 17, 2024 1

Welcome back @rdlauer 😄

from plugins.

NathanWalker avatar NathanWalker commented on July 17, 2024

Hi @rdlauer! Indeed 2.0 and above brought a small breaking change in the return result to provide more rich information noted here:
https://github.com/NativeScript/plugins/tree/main/packages/imagepicker#installation - can see the Note in that section.

Looking at the SB sample looks like this:

imagePicker
      .authorize()
      .then(() => {
        return imagePicker.present();
      })
      .then((selection) => {
        console.log('Selection done: ' + JSON.stringify(selection));

just needs to be updated to this:

imagePicker
      .authorize()
      .then(() => {
        return imagePicker.present();
      })
      .then((selection) => {
        console.log('Selection done: ' + JSON.stringify(selection));
        this.set(
          'imageSrc',
          this.isSingleMode && selection.length > 0 ? selection[0].asset : null
        );

        // set the images to be loaded from the assets with optimal sizes (optimize memory usage)
        selection.forEach((item: imagePickerPlugin.ImagePickerSelection) => {
          item.asset.options.width = this.isSingleMode
            ? this.previewSize
            : this.thumbSize;
          item.asset.options.height = this.isSingleMode
            ? this.previewSize
            : this.thumbSize;
        });

        this.set(
          'imageAssets',
          selection.map((item, i) => ({ imageAsset: item.asset, index: i }))
        );
      })

This forked SB has the change: https://stackblitz.com/edit/nativescript-stackblitz-templates-1byxnc?file=package.json,app%2Fmain-view-model.ts

Stackblitz has a Wasm issue on file uploads at moment so if link doesn't run in Preview, you can run it locally.
Let us know if that clears ya!

from plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.