react-native-video-trim 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -95,6 +95,7 @@ class VideoTrim: RCTEventEmitter {
95
95
 
96
96
  vc.cancelBtnClicked = {
97
97
  if !self.enableCancelDialog {
98
+ let _ = self.deleteFile(url: destPath) // remove the file we just copied to document directory
98
99
  self.emitEventToJS("onCancelTrimming", eventData: nil)
99
100
 
100
101
  vc.dismiss(animated: true, completion: {
@@ -109,6 +110,7 @@ class VideoTrim: RCTEventEmitter {
109
110
 
110
111
  // Create OK button with action handler
111
112
  let ok = UIAlertAction(title: self.cancelDialogConfirmText, style: .destructive, handler: { (action) -> Void in
113
+ let _ = self.deleteFile(url: destPath) // remove the file we just copied to document directory
112
114
  self.emitEventToJS("onCancelTrimming", eventData: nil)
113
115
 
114
116
  vc.dismiss(animated: true, completion: {
@@ -339,7 +341,10 @@ class VideoTrim: RCTEventEmitter {
339
341
  self.emitEventToJS("onError", eventData: eventPayload)
340
342
  }
341
343
 
342
- DispatchQueue.main.async {
344
+ // some how in case we trim a very short video the view controller is still visible after first .dismiss call
345
+ // even the file is successfully saved
346
+ // that's why we need a small delay here to ensure vc will be dismissed
347
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
343
348
  dialogMessage.dismiss(animated: false)
344
349
  viewController.dismiss(animated: true, completion: {
345
350
  self.emitEventToJS("onHide", eventData: nil)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-video-trim",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Video trimmer for your React Native app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",