Преглед на файлове

bottom-sheet: tweak UI

- re-add thepand icon, shaped like a pill
- round top corners
master
Saúl Ibarra Corretgé преди 5 години
родител
ревизия
579d08e27e

+ 8
- 2
react/features/base/dialog/components/native/BottomSheet.js Целия файл

@@ -44,7 +44,12 @@ type Props = {
44 44
     /**
45 45
      * Callback to be attached to the custom swipe event of the BottomSheet.
46 46
      */
47
-    onSwipe?: Function
47
+    onSwipe?: Function,
48
+
49
+    /**
50
+     * Function to render a bottom sheet header element, if necessary.
51
+     */
52
+    renderHeader: ?Function
48 53
 };
49 54
 
50 55
 /**
@@ -75,7 +80,7 @@ class BottomSheet extends PureComponent<Props> {
75 80
      * @returns {ReactElement}
76 81
      */
77 82
     render() {
78
-        const { _styles } = this.props;
83
+        const { _styles, renderHeader } = this.props;
79 84
 
80 85
         return (
81 86
             <SlidingView
@@ -88,6 +93,7 @@ class BottomSheet extends PureComponent<Props> {
88 93
                     <View
89 94
                         pointerEvents = 'box-none'
90 95
                         style = { styles.sheetAreaCover } />
96
+                    { renderHeader && renderHeader() }
91 97
                     <SafeAreaView
92 98
                         style = { [
93 99
                             styles.sheetItemContainer,

+ 6
- 0
react/features/base/dialog/components/native/styles.js Целия файл

@@ -172,6 +172,12 @@ ColorSchemeRegistry.register('BottomSheet', {
172 172
         underlayColor: ColorPalette.overflowMenuItemUnderlay
173 173
     },
174 174
 
175
+    expandIcon: {
176
+        color: schemeColor('icon'),
177
+        fontSize: 48,
178
+        opacity: 0.8
179
+    },
180
+
175 181
     /**
176 182
      * Bottom sheet's base style.
177 183
      */

+ 11
- 0
react/features/base/icons/svg/drag-handle.svg Целия файл

@@ -0,0 +1,11 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<svg
3
+   xmlns="http://www.w3.org/2000/svg"
4
+   xmlns:xlink="http://www.w3.org/1999/xlink"
5
+   width="24"
6
+   height="24"
7
+   viewBox="0 0 24 24">
8
+   <path
9
+     d="m 5.6875,10.59375 h 12.625 c 0.779062,0 1.40625,0.627187 1.40625,1.40625 0,0.779062 -0.627188,1.40625 -1.40625,1.40625 H 5.6875 c -0.7790625,0 -1.40625,-0.627188 -1.40625,-1.40625 0,-0.779063 0.6271875,-1.40625 1.40625,-1.40625 z"
10
+     id="rect3711" />
11
+</svg>

+ 1
- 0
react/features/base/icons/svg/index.js Целия файл

@@ -25,6 +25,7 @@ export { default as IconDeviceHeadphone } from './headset.svg';
25 25
 export { default as IconDeviceSpeaker } from './volume.svg';
26 26
 export { default as IconDominantSpeaker } from './dominant-speaker.svg';
27 27
 export { default as IconDownload } from './download.svg';
28
+export { default as IconDragHandle } from './drag-handle.svg';
28 29
 export { default as IconEventNote } from './event_note.svg';
29 30
 export { default as IconExitFullScreen } from './exit-full-screen.svg';
30 31
 export { default as IconFeedback } from './feedback.svg';

+ 28
- 2
react/features/toolbox/components/native/OverflowMenu.js Целия файл

@@ -1,11 +1,12 @@
1 1
 // @flow
2 2
 
3 3
 import React, { PureComponent } from 'react';
4
-import { Platform } from 'react-native';
4
+import { Platform, TouchableOpacity, View } from 'react-native';
5 5
 import Collapsible from 'react-native-collapsible';
6 6
 
7 7
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
8 8
 import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
9
+import { IconDragHandle } from '../../../base/icons';
9 10
 import { CHAT_ENABLED, IOS_RECORDING_ENABLED, getFeatureFlag } from '../../../base/flags';
10 11
 import { connect } from '../../../base/redux';
11 12
 import { StyleType } from '../../../base/styles';
@@ -23,6 +24,7 @@ import AudioOnlyButton from './AudioOnlyButton';
23 24
 import MoreOptionsButton from './MoreOptionsButton';
24 25
 import RaiseHandButton from './RaiseHandButton';
25 26
 import ToggleCameraButton from './ToggleCameraButton';
27
+import styles from './styles';
26 28
 
27 29
 /**
28 30
  * The type of the React {@code Component} props of {@link OverflowMenu}.
@@ -99,6 +101,7 @@ class OverflowMenu extends PureComponent<Props, State> {
99 101
         this._onCancel = this._onCancel.bind(this);
100 102
         this._onSwipe = this._onSwipe.bind(this);
101 103
         this._onToggleMenu = this._onToggleMenu.bind(this);
104
+        this._renderMenuExpandToggle = this._renderMenuExpandToggle.bind(this);
102 105
     }
103 106
 
104 107
     /**
@@ -126,7 +129,8 @@ class OverflowMenu extends PureComponent<Props, State> {
126 129
         return (
127 130
             <BottomSheet
128 131
                 onCancel = { this._onCancel }
129
-                onSwipe = { this._onSwipe }>
132
+                onSwipe = { this._onSwipe }
133
+                renderHeader = { this._renderMenuExpandToggle }>
130 134
                 <AudioRouteButton { ...buttonProps } />
131 135
                 <ToggleCameraButton { ...buttonProps } />
132 136
                 <AudioOnlyButton { ...buttonProps } />
@@ -153,6 +157,28 @@ class OverflowMenu extends PureComponent<Props, State> {
153 157
         );
154 158
     }
155 159
 
160
+    _renderMenuExpandToggle: () => React$Element<any>;
161
+
162
+    /**
163
+     * Function to render the menu toggle in the bottom sheet header area.
164
+     *
165
+     * @returns {React$Element}
166
+     */
167
+    _renderMenuExpandToggle() {
168
+        return (
169
+            <View
170
+                style = { [
171
+                    this.props._bottomSheetStyles.sheet,
172
+                    styles.expandMenuContainer
173
+                ] }>
174
+                <TouchableOpacity onPress = { this._onToggleMenu }>
175
+                    { /* $FlowFixMeProps */ }
176
+                    <IconDragHandle style = { this.props._bottomSheetStyles.expandIcon } />
177
+                </TouchableOpacity>
178
+            </View>
179
+        );
180
+    }
181
+
156 182
     _onCancel: () => boolean;
157 183
 
158 184
     /**

+ 12
- 0
react/features/toolbox/components/native/styles.js Целия файл

@@ -55,6 +55,18 @@ const whiteToolbarButtonIcon = {
55 55
  */
56 56
 const styles = {
57 57
 
58
+    expandMenuContainer: {
59
+        alignItems: 'center',
60
+        borderTopLeftRadius: 16,
61
+        borderTopRightRadius: 16,
62
+        flexDirection: 'column'
63
+    },
64
+
65
+    sheetGestureRecognizer: {
66
+        alignItems: 'stretch',
67
+        flexDirection: 'column'
68
+    },
69
+
58 70
     /**
59 71
      * The style of the toolbar.
60 72
      */

Loading…
Отказ
Запис