diff --git a/ios/VideoTrim.swift b/ios/VideoTrim.swift index 0b60693..9ea2805 100644 --- a/ios/VideoTrim.swift +++ b/ios/VideoTrim.swift @@ -65,8 +65,13 @@ class VideoTrim: RCTEventEmitter, UIVideoEditorControllerDelegate, UINavigationC root.present(editController, animated: true, completion: { self.emitEventToJS("onShow", eventData: nil) self.isShowing = true - - if let topItem = editController.navigationBar.topItem{ + }) + + // run "during" presenting so that user sees texts update immediately + // putting inside "present" will briefly show old texts then changed to new one, user can clearly see this + // with out DispatchQueue.main.asyncAfter, topItem is still nil + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + if let topItem = editController.navigationBar.topItem { if let title = config["title"] as? String, !title.isEmpty { topItem.title = title } @@ -82,7 +87,7 @@ class VideoTrim: RCTEventEmitter, UIVideoEditorControllerDelegate, UINavigationC topItem.rightBarButtonItem = UIBarButtonItem(title: saveBtnText, style: topItem.rightBarButtonItem?.style ?? .plain, target: topItem.rightBarButtonItem?.target, action: topItem.rightBarButtonItem?.action) } } - }) + } } } } else { diff --git a/package.json b/package.json index 77c57f2..687d57c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-video-trim", - "version": "1.0.9", + "version": "1.0.10", "description": "Video trimmer for your React Native app", "main": "lib/commonjs/index", "module": "lib/module/index",