From 579d08e27e7f2b4e57dd3e3e81d83dc6dd09d5e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Mon, 23 Mar 2020 09:37:35 +0100 Subject: [PATCH] bottom-sheet: tweak UI - re-add thepand icon, shaped like a pill - round top corners --- .../dialog/components/native/BottomSheet.js | 10 +++++-- .../base/dialog/components/native/styles.js | 6 ++++ react/features/base/icons/svg/drag-handle.svg | 11 +++++++ react/features/base/icons/svg/index.js | 1 + .../toolbox/components/native/OverflowMenu.js | 30 +++++++++++++++++-- .../toolbox/components/native/styles.js | 12 ++++++++ 6 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 react/features/base/icons/svg/drag-handle.svg diff --git a/react/features/base/dialog/components/native/BottomSheet.js b/react/features/base/dialog/components/native/BottomSheet.js index 73c60c5918..bdd2f29a13 100644 --- a/react/features/base/dialog/components/native/BottomSheet.js +++ b/react/features/base/dialog/components/native/BottomSheet.js @@ -44,7 +44,12 @@ type Props = { /** * Callback to be attached to the custom swipe event of the BottomSheet. */ - onSwipe?: Function + onSwipe?: Function, + + /** + * Function to render a bottom sheet header element, if necessary. + */ + renderHeader: ?Function }; /** @@ -75,7 +80,7 @@ class BottomSheet extends PureComponent { * @returns {ReactElement} */ render() { - const { _styles } = this.props; + const { _styles, renderHeader } = this.props; return ( { + { renderHeader && renderHeader() } + + + diff --git a/react/features/base/icons/svg/index.js b/react/features/base/icons/svg/index.js index c8af0b11c0..c8d04e340f 100644 --- a/react/features/base/icons/svg/index.js +++ b/react/features/base/icons/svg/index.js @@ -25,6 +25,7 @@ export { default as IconDeviceHeadphone } from './headset.svg'; export { default as IconDeviceSpeaker } from './volume.svg'; export { default as IconDominantSpeaker } from './dominant-speaker.svg'; export { default as IconDownload } from './download.svg'; +export { default as IconDragHandle } from './drag-handle.svg'; export { default as IconEventNote } from './event_note.svg'; export { default as IconExitFullScreen } from './exit-full-screen.svg'; export { default as IconFeedback } from './feedback.svg'; diff --git a/react/features/toolbox/components/native/OverflowMenu.js b/react/features/toolbox/components/native/OverflowMenu.js index 701cd08c56..b37b511cf4 100644 --- a/react/features/toolbox/components/native/OverflowMenu.js +++ b/react/features/toolbox/components/native/OverflowMenu.js @@ -1,11 +1,12 @@ // @flow import React, { PureComponent } from 'react'; -import { Platform } from 'react-native'; +import { Platform, TouchableOpacity, View } from 'react-native'; import Collapsible from 'react-native-collapsible'; import { ColorSchemeRegistry } from '../../../base/color-scheme'; import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog'; +import { IconDragHandle } from '../../../base/icons'; import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags'; import { connect } from '../../../base/redux'; import { StyleType } from '../../../base/styles'; @@ -23,6 +24,7 @@ import AudioOnlyButton from './AudioOnlyButton'; import MoreOptionsButton from './MoreOptionsButton'; import RaiseHandButton from './RaiseHandButton'; import ToggleCameraButton from './ToggleCameraButton'; +import styles from './styles'; /** * The type of the React {@code Component} props of {@link OverflowMenu}. @@ -99,6 +101,7 @@ class OverflowMenu extends PureComponent { this._onCancel = this._onCancel.bind(this); this._onSwipe = this._onSwipe.bind(this); this._onToggleMenu = this._onToggleMenu.bind(this); + this._renderMenuExpandToggle = this._renderMenuExpandToggle.bind(this); } /** @@ -126,7 +129,8 @@ class OverflowMenu extends PureComponent { return ( + onSwipe = { this._onSwipe } + renderHeader = { this._renderMenuExpandToggle }> @@ -153,6 +157,28 @@ class OverflowMenu extends PureComponent { ); } + _renderMenuExpandToggle: () => React$Element; + + /** + * Function to render the menu toggle in the bottom sheet header area. + * + * @returns {React$Element} + */ + _renderMenuExpandToggle() { + return ( + + + { /* $FlowFixMeProps */ } + + + + ); + } + _onCancel: () => boolean; /** diff --git a/react/features/toolbox/components/native/styles.js b/react/features/toolbox/components/native/styles.js index 6b8e4813a4..84694aa206 100644 --- a/react/features/toolbox/components/native/styles.js +++ b/react/features/toolbox/components/native/styles.js @@ -55,6 +55,18 @@ const whiteToolbarButtonIcon = { */ const styles = { + expandMenuContainer: { + alignItems: 'center', + borderTopLeftRadius: 16, + borderTopRightRadius: 16, + flexDirection: 'column' + }, + + sheetGestureRecognizer: { + alignItems: 'stretch', + flexDirection: 'column' + }, + /** * The style of the toolbar. */