NativeScript / plugins

@nativescript plugins to help with your developments.
https://docs.nativescript.org/plugins/index.html
Apache License 2.0
190 stars 107 forks source link

Don't pick image #464

Closed Salmankhan033 closed 1 year ago

Salmankhan033 commented 1 year ago

When I try to get an image in IOS Simulator then it returns an empty object. How to get images from storage? I am using react hooks Versions:

   "react": "^16.14.0",
    "react-nativescript": "^4.0.0",
  "@nativescript/core": "~8.4.0",
    "@nativescript/imagepicker": "^1.0.9",

Code:

Screenshot 2023-03-15 at 5 49 32 PM

OUTPUT:

Screenshot 2023-03-15 at 5 50 18 PM
rigor789 commented 1 year ago

The output looks correct to me - returns an array of ImageAssets - in your logs you are logging out an ImageAsset (doesn't say in the console, but looks like it):

selected... {
"observers": {}
...
"keepAspectRatio": true
...
}

^ that's an ImageAsset instance

Depending on what you want to do with the image... For example you can display it in your app:

<Image src={selected} ...

should display the image

ImageAsset API: https://docs.nativescript.org/api-reference/classes/imageasset

davecoffin commented 1 year ago

As of 2.0 it would be selected.asset. See docs for 2.0 updates.