fix(rn,bottom-sheet) fix scroll

In the past we used a PanResponder to detect user gestures in the sheet
to show a reduced version or a full-height version of it, and also to
close it.

There is an obvious conflic between the gestures and scrolling, which
didn't work all that great, but we could live with it.

After reactions were introduced we no longer rendered the 2 different
heights, so that functionaligy stopped being used but the PanResponder
still remained there.

This commit removes it completely and sets a max height of 75% on any
BottomSheet, so any tap outside will close it.
This commit is contained in:
Saúl Ibarra Corretgé
2022-06-10 11:46:52 +02:00
committed by Saúl Ibarra Corretgé
parent 98ef0e74d6
commit ad8cdcd81b
3 changed files with 91 additions and 214 deletions

View File

@@ -3,10 +3,9 @@
import React, { PureComponent } from 'react';
import { Divider } from 'react-native-paper';
import { ColorSchemeRegistry } from '../../../base/color-scheme';
import { BottomSheet, hideDialog, isDialogOpen } from '../../../base/dialog';
import { bottomSheetStyles } from '../../../base/dialog/components/native/styles';
import { connect } from '../../../base/redux';
import { StyleType } from '../../../base/styles';
import { SharedDocumentButton } from '../../../etherpad';
import { ParticipantsPaneButton } from '../../../participants-pane/components/native';
import { ReactionMenu } from '../../../reactions/components';
@@ -35,11 +34,6 @@ import ToggleSelfViewButton from './ToggleSelfViewButton';
*/
type Props = {
/**
* The color-schemed stylesheet of the dialog feature.
*/
_bottomSheetStyles: StyleType,
/**
* True if the overflow menu is currently visible, false otherwise.
*/
@@ -118,7 +112,6 @@ class OverflowMenu extends PureComponent<Props, State> {
*/
render() {
const {
_bottomSheetStyles,
_reactionsEnabled,
_selfViewHidden,
_width
@@ -128,16 +121,16 @@ class OverflowMenu extends PureComponent<Props, State> {
const buttonProps = {
afterClick: this._onCancel,
showLabel: true,
styles: _bottomSheetStyles.buttons
styles: bottomSheetStyles.buttons
};
const topButtonProps = {
afterClick: this._onCancel,
showLabel: true,
styles: {
..._bottomSheetStyles.buttons,
...bottomSheetStyles.buttons,
style: {
..._bottomSheetStyles.buttons.style,
...bottomSheetStyles.buttons.style,
borderTopLeftRadius: 16,
borderTopRightRadius: 16
}
@@ -217,7 +210,6 @@ function _mapStateToProps(state) {
const { disableSelfView } = state['features/base/settings'];
return {
_bottomSheetStyles: ColorSchemeRegistry.get(state, 'BottomSheet'),
_isOpen: isDialogOpen(state, OverflowMenu_),
_reactionsEnabled: isReactionsEnabled(state),
_selfViewHidden: Boolean(disableSelfView),