@@ -52,44 +52,46 @@ export const getViewerComponentName = ({
5252 }
5353}
5454
55- const ViewerByFile = ( {
56- file,
57- onClose,
58- renderFallbackExtraContent,
59- gestures,
60- gesturesRef,
61- onSwipe,
62- breakpoints : { isDesktop } ,
63- componentsProps
64- } ) => {
65- const isOnlyOfficeEnabled = componentsProps ?. OnlyOfficeViewer ?. isEnabled
66- const onlyOfficeOpener = componentsProps ?. OnlyOfficeViewer ?. opener
55+ const ViewerByFile = withBreakpoints ( ) (
56+ ( {
57+ file,
58+ onClose,
59+ renderFallbackExtraContent,
60+ gestures,
61+ gesturesRef,
62+ onSwipe,
63+ breakpoints : { isDesktop } ,
64+ componentsProps
65+ } ) => {
66+ const isOnlyOfficeEnabled = componentsProps ?. OnlyOfficeViewer ?. isEnabled
67+ const onlyOfficeOpener = componentsProps ?. OnlyOfficeViewer ?. opener
6768
68- const { url } = useEncrypted ( )
69+ const { url } = useEncrypted ( )
6970
70- const ComponentName = useMemo (
71- ( ) =>
72- getViewerComponentName ( {
73- file,
74- isDesktop,
75- isOnlyOfficeEnabled
76- } ) ,
77- [ file , isDesktop , isOnlyOfficeEnabled ]
78- )
71+ const ComponentName = useMemo (
72+ ( ) =>
73+ getViewerComponentName ( {
74+ file,
75+ isDesktop,
76+ isOnlyOfficeEnabled
77+ } ) ,
78+ [ file , isDesktop , isOnlyOfficeEnabled ]
79+ )
7980
80- return (
81- < ComponentName
82- file = { file }
83- url = { url }
84- onClose = { onClose }
85- renderFallbackExtraContent = { renderFallbackExtraContent }
86- gestures = { gestures }
87- gesturesRef = { gesturesRef }
88- onSwipe = { onSwipe }
89- onlyOfficeOpener = { onlyOfficeOpener }
90- />
91- )
92- }
81+ return (
82+ < ComponentName
83+ file = { file }
84+ url = { url }
85+ onClose = { onClose }
86+ renderFallbackExtraContent = { renderFallbackExtraContent }
87+ gestures = { gestures }
88+ gesturesRef = { gesturesRef }
89+ onSwipe = { onSwipe }
90+ onlyOfficeOpener = { onlyOfficeOpener }
91+ />
92+ )
93+ }
94+ )
9395
9496ViewerByFile . propTypes = {
9597 file : FileDoctype . isRequired ,
@@ -102,4 +104,6 @@ ViewerByFile.propTypes = {
102104 componentsProps : PropTypes . object
103105}
104106
105- export default withBreakpoints ( ) ( ViewerByFile )
107+ ViewerByFile . displayName = 'ViewerByFile'
108+
109+ export default ViewerByFile
0 commit comments