Merge pull request #3012 from saghul/overflow-menu-dismiss
[RN] Dismiss OverflowMenu after selecting an option
This commit is contained in:
commit
62cc44f791
|
@ -7,6 +7,11 @@ import ToolboxItem from './ToolboxItem';
|
|||
|
||||
export type Props = {
|
||||
|
||||
/**
|
||||
* Function to be called after the click handler has been processed.
|
||||
*/
|
||||
afterClick: ?Function,
|
||||
|
||||
/**
|
||||
* Whether to show the label or not.
|
||||
*/
|
||||
|
@ -38,6 +43,7 @@ export type Props = {
|
|||
*/
|
||||
export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
||||
static defaultProps = {
|
||||
afterClick: undefined,
|
||||
showLabel: false,
|
||||
styles: undefined,
|
||||
toggledStyles: undefined,
|
||||
|
@ -165,7 +171,10 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
|||
* @returns {void}
|
||||
*/
|
||||
_onClick() {
|
||||
const { afterClick } = this.props;
|
||||
|
||||
this._handleClick();
|
||||
afterClick && afterClick();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,23 +56,19 @@ class OverflowMenu extends Component<Props> {
|
|||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
const buttonProps = {
|
||||
afterClick: this._onCancel,
|
||||
showLabel: true,
|
||||
styles: overflowMenuItemStyles
|
||||
};
|
||||
|
||||
return (
|
||||
<BottomSheet onCancel = { this._onCancel }>
|
||||
<AudioRouteButton
|
||||
showLabel = { true }
|
||||
styles = { overflowMenuItemStyles } />
|
||||
<ToggleCameraButton
|
||||
showLabel = { true }
|
||||
styles = { overflowMenuItemStyles } />
|
||||
<AudioOnlyButton
|
||||
showLabel = { true }
|
||||
styles = { overflowMenuItemStyles } />
|
||||
<RoomLockButton
|
||||
showLabel = { true }
|
||||
styles = { overflowMenuItemStyles } />
|
||||
<PictureInPictureButton
|
||||
showLabel = { true }
|
||||
styles = { overflowMenuItemStyles } />
|
||||
<AudioRouteButton { ...buttonProps } />
|
||||
<ToggleCameraButton { ...buttonProps } />
|
||||
<AudioOnlyButton { ...buttonProps } />
|
||||
<RoomLockButton { ...buttonProps } />
|
||||
<PictureInPictureButton { ...buttonProps } />
|
||||
</BottomSheet>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue