您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

RoomLockSwitch.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // @flow
  2. import React from 'react';
  3. import { Switch, Text, View } from 'react-native';
  4. import { translate } from '../../base/i18n';
  5. import { connect } from '../../base/redux';
  6. import { LOCKED_REMOTELY } from '../constants';
  7. import styles, {
  8. DISABLED_THUMB_COLOR,
  9. ENABLED_THUMB_COLOR, ENABLED_TRACK_COLOR
  10. } from './styles';
  11. /**
  12. * The type of the React {@code Component} props of {@link RoomLockSwitch}.
  13. */
  14. type Props = {
  15. /**
  16. * Checks if the room is locked based on defined room lock constants.
  17. */
  18. locked: string,
  19. /**
  20. * Whether the switch is disabled.
  21. */
  22. disabled: boolean,
  23. /**
  24. * Callback to be invoked when the user toggles room lock.
  25. */
  26. onToggleRoomLock: Function,
  27. /**
  28. * Control for room lock.
  29. */
  30. toggleRoomLock: boolean,
  31. /**
  32. * Invoked to obtain translated strings.
  33. */
  34. t: Function
  35. };
  36. /**
  37. * Component meant to Add/Remove meeting password.
  38. *
  39. * @returns {React$Element<any>}
  40. */
  41. function RoomLockSwitch(
  42. {
  43. locked,
  44. disabled,
  45. onToggleRoomLock,
  46. toggleRoomLock,
  47. t
  48. }: Props) {
  49. return (
  50. <View style = { styles.roomLockSwitchContainer }>
  51. <Text>
  52. {
  53. locked === LOCKED_REMOTELY
  54. && t('passwordSetRemotely')
  55. }
  56. </Text>
  57. <Switch
  58. disabled = { disabled }
  59. onValueChange = { onToggleRoomLock }
  60. thumbColor = {
  61. toggleRoomLock
  62. ? ENABLED_THUMB_COLOR
  63. : DISABLED_THUMB_COLOR
  64. }
  65. trackColor = {{ true: ENABLED_TRACK_COLOR }}
  66. value = { toggleRoomLock } />
  67. </View>
  68. );
  69. }
  70. export default translate(connect()(RoomLockSwitch));