diff --git a/src/App.js b/src/App.js index 543ad581e..77b0ae045 100644 --- a/src/App.js +++ b/src/App.js @@ -17,6 +17,10 @@ import PluginContainer from './PluginContainer.js'; import Sheet from './chrome/Sheet.js'; import {ipcRenderer} from 'electron'; import PluginDebugger from './chrome/PluginDebugger.js'; +import { + ACTIVE_SHEET_BUG_REPORTER, + ACTIVE_SHEET_PLUGIN_DEBUGGER, +} from './reducers/application.js'; import type Logger from './fb-stubs/Logger.js'; import type BugReporter from './fb-stubs/BugReporter.js'; @@ -49,16 +53,17 @@ export class App extends React.Component { } getSheet = (onHide: () => mixed) => { - if (this.props.activeSheet === 'BUG_REPORTER') { + if (this.props.activeSheet === ACTIVE_SHEET_BUG_REPORTER) { return ( ); - } else if (this.props.activeSheet === 'PLUGIN_DEBUGGER') { + } else if (this.props.activeSheet === ACTIVE_SHEET_PLUGIN_DEBUGGER) { return ; } else { + // contents are added via React.Portal return null; } }; diff --git a/src/__tests__/__snapshots__/App.electron.js.snap b/src/__tests__/__snapshots__/App.electron.js.snap index 34b974c19..acf2059ca 100644 --- a/src/__tests__/__snapshots__/App.electron.js.snap +++ b/src/__tests__/__snapshots__/App.electron.js.snap @@ -5,7 +5,7 @@ exports[`Empty app state matches snapshot 1`] = ` className="css-1si6n3e" >
+
+
+
diff --git a/src/chrome/Sheet.js b/src/chrome/Sheet.js index 52cbc7e9c..1dce8fcaa 100644 --- a/src/chrome/Sheet.js +++ b/src/chrome/Sheet.js @@ -10,18 +10,23 @@ import {Transition} from 'react-transition-group'; import {setActiveSheet} from '../reducers/application.js'; import {connect} from 'react-redux'; import {styled} from 'flipper'; +import {PLUGIN_SHEET_ELEMENT_ID} from '../ui/components/Sheet'; +import {ACTIVE_SHEET_PLUGIN_SHEET} from '../reducers/application'; + +import type {ActiveSheet} from '../reducers/application'; const DialogContainer = styled('div')(({state}) => ({ transform: `translate(-50%, ${ state === 'entering' || state === 'exiting' || state === 'exited' - ? '-110' - : '0' - }%)`, + ? 'calc(-100% - 20px)' + : '0%' + })`, + opacity: state === 'exited' ? 0 : 1, transition: '.3s transform', position: 'absolute', left: '50%', top: 38, - zIndex: 2, + zIndex: 3, backgroundColor: '#EFEEEF', border: '1px solid #C6C6C6', borderTop: 'none', @@ -31,7 +36,7 @@ const DialogContainer = styled('div')(({state}) => ({ })); type Props = {| - sheetVisible: boolean, + activeSheet: ActiveSheet, onHideSheet: () => void, children: (onHide: () => mixed) => any, |}; @@ -42,11 +47,11 @@ type State = {| class Sheet extends Component { state = { - isVisible: this.props.sheetVisible, + isVisible: Boolean(this.props.activeSheet), }; static getDerivedStateFromProps(props: Props, state: State) { - if (!props.sheetVisible) { + if (!props.activeSheet) { return { isVisible: true, }; @@ -76,12 +81,23 @@ class Sheet extends Component { render() { return ( this.props.onHideSheet()} - unmountOnExit> + onExited={() => this.props.onHideSheet()}> {state => ( +
{this.props.children(this.onHide)} )} @@ -95,7 +111,7 @@ class Sheet extends Component { * run Flow. */ export default connect( ({application: {activeSheet}}) => ({ - sheetVisible: Boolean(activeSheet), + activeSheet, }), { onHideSheet: () => setActiveSheet(null), diff --git a/src/chrome/TitleBar.js b/src/chrome/TitleBar.js index 0944e9329..dc2dc1eca 100644 --- a/src/chrome/TitleBar.js +++ b/src/chrome/TitleBar.js @@ -21,6 +21,7 @@ import { setActiveSheet, toggleLeftSidebarVisible, toggleRightSidebarVisible, + ACTIVE_SHEET_BUG_REPORTER, } from '../reducers/application.js'; import DevicesButton from './DevicesButton.js'; import ScreenCaptureButtons from './ScreenCaptureButtons.js'; @@ -44,7 +45,7 @@ const AppTitleBar = styled(FlexRow)(({focused}) => ({ paddingRight: 10, justifyContent: 'space-between', WebkitAppRegion: 'drag', - zIndex: 3, + zIndex: 4, })); type Props = {| @@ -68,7 +69,7 @@ class TitleBar extends Component { {config.bugReportButtonVisible && (