From 94dc6309de86fe08e83e2c6a063a24fc3dd9729f Mon Sep 17 00:00:00 2001 From: Calinteodor Date: Thu, 25 Aug 2022 14:25:13 +0300 Subject: [PATCH] feat(base/native): Switch thumb track color (#12066) * feat(base/native): Switch thumbColor and trackColor default props --- .../base/ui/components/native/Switch.tsx | 18 +++++- .../base/ui/components/native/switchStyles.ts | 5 ++ .../components/native/LobbyModeSwitch.tsx | 61 ------------------- .../lobby/components/native/styles.js | 9 --- .../polls/components/native/PollAnswer.tsx | 5 +- .../native/StartRecordingDialogContent.tsx | 12 ++-- .../security-dialog/native/SecurityDialog.js | 10 ++- .../components/native/SettingsView.js | 42 ++----------- .../settings/components/native/styles.js | 3 - 9 files changed, 37 insertions(+), 128 deletions(-) create mode 100644 react/features/base/ui/components/native/switchStyles.ts delete mode 100644 react/features/lobby/components/native/LobbyModeSwitch.tsx diff --git a/react/features/base/ui/components/native/Switch.tsx b/react/features/base/ui/components/native/Switch.tsx index a29d79471..7018906a8 100644 --- a/react/features/base/ui/components/native/Switch.tsx +++ b/react/features/base/ui/components/native/Switch.tsx @@ -4,6 +4,12 @@ import { Switch as NativeSwitch } from 'react-native-paper'; import { SwitchProps } from '../types'; +import { + DISABLED_TRACK_COLOR, + ENABLED_TRACK_COLOR, + THUMB_COLOR +} from './switchStyles'; + interface Props extends SwitchProps { /** @@ -22,7 +28,17 @@ interface Props extends SwitchProps { trackColor?: Object; } -const Switch = ({ checked, disabled, onChange, thumbColor, trackColor, style }: Props) => ( +const Switch = ({ + checked, + disabled, + onChange, + thumbColor = THUMB_COLOR, + trackColor = { + true: ENABLED_TRACK_COLOR, + false: DISABLED_TRACK_COLOR + }, + style +}: Props) => ( void; -} - -/** - * Component meant to Enable/Disable lobby mode. - * - * @returns {React$Element} - */ -function LobbyModeSwitch( - { - lobbyEnabled, - onToggleLobbyMode - }: Props) { - - return ( - - - - ); -} - -export default translate(connect()(LobbyModeSwitch)); diff --git a/react/features/lobby/components/native/styles.js b/react/features/lobby/components/native/styles.js index 15f9ec8e8..e7433ec7b 100644 --- a/react/features/lobby/components/native/styles.js +++ b/react/features/lobby/components/native/styles.js @@ -235,15 +235,6 @@ export default { color: 'white' }, - lobbySwitchContainer: { - flexDirection: 'column', - marginTop: BaseTheme.spacing[2] - }, - - lobbySwitchIcon: { - alignSelf: 'flex-end' - }, - lobbyTitle: { ...lobbyText }, diff --git a/react/features/polls/components/native/PollAnswer.tsx b/react/features/polls/components/native/PollAnswer.tsx index 44f582474..b5b7c3a29 100644 --- a/react/features/polls/components/native/PollAnswer.tsx +++ b/react/features/polls/components/native/PollAnswer.tsx @@ -4,7 +4,6 @@ import { Text, View } from 'react-native'; import { useSelector } from 'react-redux'; import { getLocalParticipant } from '../../../base/participants/functions'; -import BaseTheme from '../../../base/ui/components/BaseTheme.native'; import Button from '../../../base/ui/components/native/Button'; import Switch from '../../../base/ui/components/native/Switch'; import { BUTTON_TYPES } from '../../../base/ui/constants'; @@ -45,9 +44,7 @@ const PollAnswer = (props: AbstractProps) => { setCheckbox(index, state) } - thumbColor = { BaseTheme.palette.icon01 } - trackColor = {{ true: BaseTheme.palette.action01 }} /> + onChange = { state => setCheckbox(index, state) } /> {answer.name} ))} diff --git a/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx b/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx index 47e6c70aa..c0ae291fe 100644 --- a/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx +++ b/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx @@ -22,8 +22,7 @@ import { DROPBOX_LOGO, ICON_CLOUD, ICON_INFO, - ICON_USERS, - TRACK_COLOR + ICON_USERS // @ts-ignore } from '../styles.native'; @@ -77,8 +76,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent + style = { styles.switch } /> ) : null; return ( @@ -137,8 +135,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent + style = { styles.switch } /> ); } @@ -281,8 +278,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent + style = { styles.switch } /> ); } diff --git a/react/features/security/components/security-dialog/native/SecurityDialog.js b/react/features/security/components/security-dialog/native/SecurityDialog.js index 2676ee8dd..c74cd7359 100644 --- a/react/features/security/components/security-dialog/native/SecurityDialog.js +++ b/react/features/security/components/security-dialog/native/SecurityDialog.js @@ -14,11 +14,10 @@ import { connect } from '../../../../base/redux'; import BaseTheme from '../../../../base/ui/components/BaseTheme'; import Button from '../../../../base/ui/components/native/Button'; import Input from '../../../../base/ui/components/native/Input'; +import Switch from '../../../../base/ui/components/native/Switch'; import { BUTTON_TYPES } from '../../../../base/ui/constants'; import { isInBreakoutRoom } from '../../../../breakout-rooms/functions'; import { toggleLobbyMode } from '../../../../lobby/actions.any'; -import LobbyModeSwitch - from '../../../../lobby/components/native/LobbyModeSwitch'; import { LOCKED_LOCALLY, LOCKED_REMOTELY } from '../../../../room-lock'; import { endRoomLockRequest, @@ -27,7 +26,6 @@ import { import styles from './styles'; - /** * The style of the {@link TextInput} rendered by {@code SecurityDialog}. As it * requests the entry of a password, {@code TextInput} automatically correcting @@ -185,9 +183,9 @@ class SecurityDialog extends PureComponent { { t('lobby.toggleLabel') } - + diff --git a/react/features/settings/components/native/SettingsView.js b/react/features/settings/components/native/SettingsView.js index 54d7c8ff4..41790137b 100644 --- a/react/features/settings/components/native/SettingsView.js +++ b/react/features/settings/components/native/SettingsView.js @@ -35,12 +35,7 @@ import { import FormRow from './FormRow'; import FormSectionAccordion from './FormSectionAccordion'; -import styles, { - DISABLED_TRACK_COLOR, - ENABLED_TRACK_COLOR, - THUMB_COLOR -} from './styles'; - +import styles from './styles'; /** * Application information module. @@ -270,23 +265,13 @@ class SettingsView extends AbstractSettingsView { label = 'settingsView.startWithAudioMuted'> + onChange = { this._onStartAudioMutedChange } /> + onChange = { this._onStartVideoMutedChange } /> { label = 'settingsView.disableCallIntegration'> + onChange = { this._onDisableCallIntegration } /> @@ -340,12 +320,7 @@ class SettingsView extends AbstractSettingsView { label = 'settingsView.disableP2P'> + onChange = { this._onDisableP2P } /> {AppInfo.GOOGLE_SERVICES_ENABLED && ( @@ -354,12 +329,7 @@ class SettingsView extends AbstractSettingsView { label = 'settingsView.disableCrashReporting'> + onChange = { this._onDisableCrashReporting } /> )} diff --git a/react/features/settings/components/native/styles.js b/react/features/settings/components/native/styles.js index f2c9c4be7..bc311a79e 100644 --- a/react/features/settings/components/native/styles.js +++ b/react/features/settings/components/native/styles.js @@ -3,9 +3,6 @@ import BaseTheme from '../../../base/ui/components/BaseTheme.native'; export const ANDROID_UNDERLINE_COLOR = 'transparent'; export const PLACEHOLDER_COLOR = BaseTheme.palette.focus01; -export const ENABLED_TRACK_COLOR = BaseTheme.palette.action01; -export const DISABLED_TRACK_COLOR = BaseTheme.palette.switch01Disabled; -export const THUMB_COLOR = BaseTheme.palette.field02; const TEXT_SIZE = 14;