olofd / react-native-photos-framework

A modern and comprehensive CameraRoll/iCloud-library-API for React Native 📸 📹
MIT License
220 stars 99 forks source link

Asset delete issue - unreocgnized selector sent to instance #53

Closed rossmartin closed 7 years ago

rossmartin commented 7 years ago

If you have an ImageAsset and call the delete function on it you'll receive unreocgnized selector sent to instance.

This is due to the problem with following code -

src/asset.js -

delete() {
  //return NativeApi.deleteAssets([this.localIdentifier]); // WRONG
  return NativeApi.deleteAssets([this]); // RIGHT
}

src/index.js

deleteAssets(assets) {
  return RNPFManager.deleteAssets(assets.map(asset => asset.localIdentifier));
}

If you call RNPhotosFramework.deleteAssets manually with an array of ImageAssets it will work but not if you call the delete function on an individual ImageAsset. I modified src/asset.js to the above and both calls work correctly. I can submit a PR if you would like.