diff --git a/react/features/base/dialog/components/BottomSheet.native.js b/react/features/base/dialog/components/BottomSheet.native.js new file mode 100644 index 000000000..4b06fedb6 --- /dev/null +++ b/react/features/base/dialog/components/BottomSheet.native.js @@ -0,0 +1,84 @@ +// @flow + +import React, { Component, type Node } from 'react'; +import { Modal, TouchableWithoutFeedback, View } from 'react-native'; + +import { bottomSheetStyles as styles } from './styles'; + +/** + * The type of {@code BottomSheet}'s React {@code Component} prop types. + */ +type Props = { + + /** + * The children to be displayed within this component. + */ + children: Node, + + /** + * Handler for the cancel event, which happens when the user dismisses + * the sheet. + */ + onCancel: ?Function +}; + +/** + * A component emulating Android's BottomSheet. For all intents and purposes, + * this component has been designed to work and behave as a {@code Dialog}. + */ +export default class BottomSheet extends Component { + /** + * Initializes a new {@code BottomSheet} instance. + * + * @inheritdoc + */ + constructor(props: Props) { + super(props); + + this._onCancel = this._onCancel.bind(this); + } + + /** + * Implements React's {@link Component#render()}. + * + * @inheritdoc + * @returns {ReactElement} + */ + render() { + return [ + , + + + + + + + { this.props.children } + + + + ]; + } + + _onCancel: () => void; + + /** + * Cancels the dialog by calling the onCancel prop callback. + * + * @private + * @returns {void} + */ + _onCancel() { + const { onCancel } = this.props; + + onCancel && onCancel(); + } +} diff --git a/react/features/base/dialog/components/SimpleBottomSheet.web.js b/react/features/base/dialog/components/BottomSheet.web.js similarity index 100% rename from react/features/base/dialog/components/SimpleBottomSheet.web.js rename to react/features/base/dialog/components/BottomSheet.web.js diff --git a/react/features/base/dialog/components/SimpleBottomSheet.native.js b/react/features/base/dialog/components/SimpleBottomSheet.native.js deleted file mode 100644 index 73d4c2390..000000000 --- a/react/features/base/dialog/components/SimpleBottomSheet.native.js +++ /dev/null @@ -1,206 +0,0 @@ -// @flow - -import React, { Component } from 'react'; -import { - Modal, - Text, - TouchableHighlight, - TouchableWithoutFeedback, - View -} from 'react-native'; -import { connect } from 'react-redux'; - -import { Icon } from '../../font-icons'; - -import { simpleBottomSheet as styles } from './styles'; - -/** - * Underlay color for the buttons on the sheet. - * - * @type {string} - */ -const BUTTON_UNDERLAY_COLOR = '#eee'; - -type Option = { - - /** - * Name of the icon which will be rendered on the right. - */ - iconName: string, - - /** - * True if the element is selected (will be highlighted in blue), - * false otherwise. - */ - selected: boolean, - - /** - * Text which will be rendered in the row. - */ - text: string -}; - - -/** - * The type of {@code SimpleBottomSheet}'s React {@code Component} prop types. - */ -type Props = { - - /** - * Handler for the cancel event, which happens when the user dismisses - * the sheet. - */ - onCancel: Function, - - /** - * Handler for the event when an option has been selected in the sheet. - */ - onSubmit: Function, - - /** - * Array of options which will be rendered as rows. - */ - options: Array