diff --git a/react/features/toolbox/components/native/ScreenSharingAndroidButton.js b/react/features/toolbox/components/native/ScreenSharingAndroidButton.js index 11ccfe04f..263679f1f 100644 --- a/react/features/toolbox/components/native/ScreenSharingAndroidButton.js +++ b/react/features/toolbox/components/native/ScreenSharingAndroidButton.js @@ -11,6 +11,11 @@ import { toggleScreensharing, isLocalVideoTrackDesktop } from '../../../base/tra */ type Props = AbstractButtonProps & { + /** + * True if the button needs to be disabled. + */ + _disabled: boolean, + /** * Whether video is currently muted or not. */ @@ -44,6 +49,16 @@ class ScreenSharingAndroidButton extends AbstractButton { this.props.dispatch(toggleScreensharing(enable)); } + /** + * Returns a boolean value indicating if this button is disabled or not. + * + * @protected + * @returns {boolean} + */ + _isDisabled() { + return this.props._disabled; + } + /** * Indicates whether this button is in toggled state or not. * @@ -63,7 +78,6 @@ class ScreenSharingAndroidButton extends AbstractButton { * @param {Object} state - The Redux state. * @private * @returns {{ - * _disabled: boolean, * _screensharing: boolean * }} */ diff --git a/react/features/toolbox/components/native/ScreenSharingButton.js b/react/features/toolbox/components/native/ScreenSharingButton.js index e75390068..ba11cc978 100644 --- a/react/features/toolbox/components/native/ScreenSharingButton.js +++ b/react/features/toolbox/components/native/ScreenSharingButton.js @@ -1,6 +1,10 @@ +// @flow + import React from 'react'; import { Platform } from 'react-native'; +import { connect } from '../../../base/redux'; + import ScreenSharingAndroidButton from './ScreenSharingAndroidButton.js'; import ScreenSharingIosButton from './ScreenSharingIosButton.js'; @@ -15,4 +19,22 @@ const ScreenSharingButton = props => ( ); -export default ScreenSharingButton; +/** + * Maps (parts of) the redux state to the associated props for the + * {@code ScreenSharingButton} component. + * + * @param {Object} state - The Redux state. + * @private + * @returns {{ + * _disabled: boolean, + * }} + */ +function _mapStateToProps(state): Object { + const disabled = state['features/base/audio-only'].enabled; + + return { + _disabled: disabled + }; +} + +export default connect(_mapStateToProps)(ScreenSharingButton); diff --git a/react/features/toolbox/components/native/ScreenSharingIosButton.js b/react/features/toolbox/components/native/ScreenSharingIosButton.js index 0eb9734d9..2bcb90ac0 100644 --- a/react/features/toolbox/components/native/ScreenSharingIosButton.js +++ b/react/features/toolbox/components/native/ScreenSharingIosButton.js @@ -16,6 +16,11 @@ import { isLocalVideoTrackDesktop } from '../../../base/tracks'; */ type Props = AbstractButtonProps & { + /** + * True if the button needs to be disabled. + */ + _disabled: boolean, + /** * Whether video is currently muted or not. */ @@ -84,6 +89,16 @@ class ScreenSharingIosButton extends AbstractButton { NativeModules.ScreenCapturePickerViewManager.show(handle); } + /** + * Returns a boolean value indicating if this button is disabled or not. + * + * @protected + * @returns {boolean} + */ + _isDisabled() { + return this.props._disabled; + } + /** * Indicates whether this button is in toggled state or not. *