Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(base/native): Switch thumb track color (#12066)
Calinteodor94dc6309de86
diff --git a/react/features/base/ui/components/native/Switch.tsx b/react/features/base/ui/components/native/Switch.tsxindex a29d79471c..7018906a83 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) => (<NativeSwitchdisabled = { disabled }onValueChange = { onChange }diff --git a/react/features/base/ui/components/native/switchStyles.ts b/react/features/base/ui/components/native/switchStyles.tsnew file mode 100644index 0000000000..ddf85b8c6f--- /dev/null+++ b/react/features/base/ui/components/native/switchStyles.ts@@ -0,0 +1,5 @@+import BaseTheme from '../BaseTheme.native';++export const ENABLED_TRACK_COLOR = BaseTheme.palette.action01;+export const DISABLED_TRACK_COLOR = BaseTheme.palette.switch01Disabled;+export const THUMB_COLOR = BaseTheme.palette.icon01;diff --git a/react/features/lobby/components/native/LobbyModeSwitch.tsx b/react/features/lobby/components/native/LobbyModeSwitch.tsxdeleted file mode 100644index caf4de051c..0000000000--- a/react/features/lobby/components/native/LobbyModeSwitch.tsx+++ /dev/null@@ -1,61 +0,0 @@-import React from 'react';-import { WithTranslation } from 'react-i18next';-import { View } from 'react-native';--import { translate } from '../../../base/i18n/functions';-import { connect } from '../../../base/redux/functions';-import Switch from '../../../base/ui/components/native/Switch';-import {- DISABLED_TRACK_COLOR,- ENABLED_TRACK_COLOR,- THUMB_COLOR-- // @ts-ignore-} from '../../../settings/components/native/styles';--// @ts-ignore-import styles from './styles';--/**- * The type of the React {@code Component} props of {@link LobbyModeSwitch}.- */-interface Props extends WithTranslation {-- /**- * True if the lobby mode is currently enabled for this conference.- */- lobbyEnabled: boolean,-- /**- * Callback to be invoked when handling enable-disable lobby mode switch.- */- onToggleLobbyMode: (on?: boolean) => void;-}--/**- * Component meant to Enable/Disable lobby mode.- *- * @returns {React$Element<any>}- */-function LobbyModeSwitch(- {- lobbyEnabled,- onToggleLobbyMode- }: Props) {-- return (- <View style = { styles.lobbySwitchContainer }>- <Switch- checked = { lobbyEnabled }- onChange = { onToggleLobbyMode }- style = { styles.lobbySwitchIcon }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />- </View>- );-}--export default translate(connect()(LobbyModeSwitch));diff --git a/react/features/lobby/components/native/styles.js b/react/features/lobby/components/native/styles.jsindex 15f9ec8e8b..e7433ec7bc 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.tsxindex 44f5824747..b5b7c3a296 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) => {<Switchchecked = { checkBoxStates[index] }/* eslint-disable-next-line react/jsx-no-bind */- onChange = { state => setCheckbox(index, state) }- thumbColor = { BaseTheme.palette.icon01 }- trackColor = {{ true: BaseTheme.palette.action01 }} />+ onChange = { state => setCheckbox(index, state) } /><Text style = { chatStyles.switchLabel }>{answer.name}</Text></View>))}diff --git a/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsx b/react/features/recording/components/Recording/native/StartRecordingDialogContent.tsxindex 47e6c70aaf..c0ae291fee 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<Prchecked = { selectedRecordingService === RECORDING_TYPES.JITSI_REC_SERVICE }disabled = { isValidating }onChange = { this._onRecordingServiceSwitchChange }- style = { styles.switch }- trackColor = {{ false: TRACK_COLOR }} />+ style = { styles.switch } />) : null;return (@@ -137,8 +135,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent<Prchecked = { sharingSetting }disabled = { isValidating }onChange = { onSharingSettingChanged }- style = { styles.switch }- trackColor = {{ false: TRACK_COLOR }} />+ style = { styles.switch } /></View>);}@@ -281,8 +278,7 @@ class StartRecordingDialogContent extends AbstractStartRecordingDialogContent<Prchecked = { selectedRecordingService === RECORDING_TYPES.DROPBOX }disabled = { isValidating }onChange = { this._onDropboxSwitchChange }- style = { styles.switch }- trackColor = {{ false: TRACK_COLOR }} />+ style = { styles.switch } />);}diff --git a/react/features/security/components/security-dialog/native/SecurityDialog.js b/react/features/security/components/security-dialog/native/SecurityDialog.jsindex 2676ee8dd7..c74cd7359d 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<Props, State> {<Text style = { styles.lobbyModeLabel } >{ t('lobby.toggleLabel') }</Text>- <LobbyModeSwitch- lobbyEnabled = { _lobbyEnabled }- onToggleLobbyMode = { this._onToggleLobbyMode } />+ <Switch+ checked = { _lobbyEnabled }+ onChange = { this._onToggleLobbyMode } /></View></View></View>diff --git a/react/features/settings/components/native/SettingsView.js b/react/features/settings/components/native/SettingsView.jsindex 54d7c8ff43..41790137b0 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<Props, State> {label = 'settingsView.startWithAudioMuted'><Switchchecked = { startWithAudioMuted }- onChange = { this._onStartAudioMutedChange }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />+ onChange = { this._onStartAudioMutedChange } /></FormRow><Divider style = { styles.fieldSeparator } /><FormRow label = 'settingsView.startWithVideoMuted'><Switchchecked = { startWithVideoMuted }- onChange = { this._onStartVideoMutedChange }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />+ onChange = { this._onStartVideoMutedChange } /></FormRow></FormSectionAccordion><FormSectionAccordion@@ -326,12 +311,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {label = 'settingsView.disableCallIntegration'><Switchchecked = { disableCallIntegration }- onChange = { this._onDisableCallIntegration }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />+ onChange = { this._onDisableCallIntegration } /></FormRow><Divider style = { styles.fieldSeparator } /></>@@ -340,12 +320,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {label = 'settingsView.disableP2P'><Switchchecked = { disableP2P }- onChange = { this._onDisableP2P }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />+ onChange = { this._onDisableP2P } /></FormRow><Divider style = { styles.fieldSeparator } />{AppInfo.GOOGLE_SERVICES_ENABLED && (@@ -354,12 +329,7 @@ class SettingsView extends AbstractSettingsView<Props, State> {label = 'settingsView.disableCrashReporting'><Switchchecked = { disableCrashReporting }- onChange = { this._onDisableCrashReporting }- thumbColor = { THUMB_COLOR }- trackColor = {{- true: ENABLED_TRACK_COLOR,- false: DISABLED_TRACK_COLOR- }} />+ onChange = { this._onDisableCrashReporting } /></FormRow>)}</FormSectionAccordion>diff --git a/react/features/settings/components/native/styles.js b/react/features/settings/components/native/styles.jsindex f2c9c4be70..bc311a79ea 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;