2021-06-25 00:47:16 +08:00
|
|
|
import React, { useContext } from 'react';
|
2019-04-24 22:20:53 +08:00
|
|
|
import FullscreenButtonComponent from './component';
|
2019-07-27 00:48:51 +08:00
|
|
|
import FullscreenService from './service';
|
2021-06-25 00:47:16 +08:00
|
|
|
import { NLayoutContext } from '../layout/context/context';
|
2019-04-24 22:20:53 +08:00
|
|
|
|
|
|
|
const FullscreenButtonContainer = props => <FullscreenButtonComponent {...props} />;
|
|
|
|
|
|
|
|
export default (props) => {
|
2019-07-27 00:48:51 +08:00
|
|
|
const handleToggleFullScreen = ref => FullscreenService.toggleFullScreen(ref);
|
2020-10-15 22:20:06 +08:00
|
|
|
const isIphone = (navigator.userAgent.match(/iPhone/i)) ? true : false;
|
2021-06-25 00:47:16 +08:00
|
|
|
|
|
|
|
const newLayoutContext = useContext(NLayoutContext);
|
|
|
|
const { newLayoutContextState, newLayoutContextDispatch } = newLayoutContext;
|
|
|
|
const { layoutLoaded: layoutManagerLoaded } = newLayoutContextState;
|
|
|
|
const { input } = newLayoutContextState;
|
2021-07-06 00:52:25 +08:00
|
|
|
const { fullscreen } = input;
|
|
|
|
const { element } = fullscreen;
|
|
|
|
const isFullscreen = layoutManagerLoaded === 'new' ? !!element : props.isFullscreen;
|
2021-06-25 00:47:16 +08:00
|
|
|
|
2019-04-24 22:20:53 +08:00
|
|
|
return (
|
2021-06-25 00:47:16 +08:00
|
|
|
<FullscreenButtonContainer {...props} {...{
|
|
|
|
handleToggleFullScreen,
|
|
|
|
isIphone,
|
|
|
|
layoutManagerLoaded,
|
|
|
|
isFullscreen,
|
2021-07-06 00:52:25 +08:00
|
|
|
element,
|
2021-06-25 00:47:16 +08:00
|
|
|
newLayoutContextDispatch
|
|
|
|
}} />
|
2019-04-24 22:20:53 +08:00
|
|
|
);
|
|
|
|
};
|