Only render preview if picker has a preview function (#8667)

This commit is contained in:
Ryan Mehri 2023-10-30 13:03:38 -07:00 committed by GitHub
parent 7d7ed78681
commit d0430f1c81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -795,7 +795,8 @@ impl<T: Item + 'static + Send + Sync> Component for Picker<T> {
// | | | |
// +---------+ +---------+
let render_preview = self.show_preview && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
let render_preview =
self.show_preview && self.file_fn.is_some() && area.width > MIN_AREA_WIDTH_FOR_PREVIEW;
let picker_width = if render_preview {
area.width / 2