You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LobbyModeSwitch.tsx 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { View } from 'react-native';
  4. import { translate } from '../../../base/i18n/functions';
  5. import { connect } from '../../../base/redux/functions';
  6. import Switch from '../../../base/ui/components/native/Switch';
  7. import {
  8. DISABLED_TRACK_COLOR,
  9. ENABLED_TRACK_COLOR,
  10. THUMB_COLOR
  11. // @ts-ignore
  12. } from '../../../settings/components/native/styles';
  13. // @ts-ignore
  14. import styles from './styles';
  15. /**
  16. * The type of the React {@code Component} props of {@link LobbyModeSwitch}.
  17. */
  18. interface Props extends WithTranslation {
  19. /**
  20. * True if the lobby mode is currently enabled for this conference.
  21. */
  22. lobbyEnabled: boolean,
  23. /**
  24. * Callback to be invoked when handling enable-disable lobby mode switch.
  25. */
  26. onToggleLobbyMode: (on?: boolean) => void;
  27. }
  28. /**
  29. * Component meant to Enable/Disable lobby mode.
  30. *
  31. * @returns {React$Element<any>}
  32. */
  33. function LobbyModeSwitch(
  34. {
  35. lobbyEnabled,
  36. onToggleLobbyMode
  37. }: Props) {
  38. return (
  39. <View style = { styles.lobbySwitchContainer }>
  40. <Switch
  41. checked = { lobbyEnabled }
  42. onChange = { onToggleLobbyMode }
  43. style = { styles.lobbySwitchIcon }
  44. thumbColor = { THUMB_COLOR }
  45. trackColor = {{
  46. true: ENABLED_TRACK_COLOR,
  47. false: DISABLED_TRACK_COLOR
  48. }} />
  49. </View>
  50. );
  51. }
  52. export default translate(connect()(LobbyModeSwitch));