Skip to content

Commit

Permalink
fix: flashing issue when customizing texts for ios
Browse files Browse the repository at this point in the history
  • Loading branch information
maitrungduc1410 committed Dec 9, 2023
1 parent b4b1a92 commit a4c37fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions ios/VideoTrim.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit a4c37fc

Please sign in to comment.