olofd/react-native-photos-framework

Asset delete issue - unreocgnized selector sent to instance

rossmartin opened this issue · 0 comments

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.