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

RoomLockPrompt.native.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import React, { Component } from 'react';
  2. import Prompt from 'react-native-prompt';
  3. import { connect } from 'react-redux';
  4. import { endRoomLockRequest } from '../actions';
  5. /**
  6. * Implements a React Component which prompts the user for a password to lock a
  7. * conference/room.
  8. */
  9. class RoomLockPrompt extends Component {
  10. /**
  11. * RoomLockPrompt component's property types.
  12. *
  13. * @static
  14. */
  15. static propTypes = {
  16. /**
  17. * The JitsiConference which requires a password.
  18. *
  19. * @type {JitsiConference}
  20. */
  21. conference: React.PropTypes.object,
  22. dispatch: React.PropTypes.func
  23. }
  24. /**
  25. * Initializes a new RoomLockPrompt instance.
  26. *
  27. * @param {Object} props - The read-only properties with which the new
  28. * instance is to be initialized.
  29. */
  30. constructor(props) {
  31. super(props);
  32. // Bind event handlers so they are only bound once for every instance.
  33. this._onCancel = this._onCancel.bind(this);
  34. this._onSubmit = this._onSubmit.bind(this);
  35. }
  36. /**
  37. * Implements React's {@link Component#render()}.
  38. *
  39. * @inheritdoc
  40. * @returns {ReactElement}
  41. */
  42. render() {
  43. return (
  44. <Prompt
  45. onCancel = { this._onCancel }
  46. onSubmit = { this._onSubmit }
  47. placeholder = 'Password'
  48. title = 'Lock / Unlock room'
  49. visible = { true } />
  50. );
  51. }
  52. /**
  53. * Notifies this prompt that it has been dismissed by cancel.
  54. *
  55. * @private
  56. * @returns {void}
  57. */
  58. _onCancel() {
  59. // An undefined password is understood to cancel the request to lock the
  60. // conference/room.
  61. this._onSubmit(undefined);
  62. }
  63. /**
  64. * Notifies this prompt that it has been dismissed by submitting a specific
  65. * value.
  66. *
  67. * @param {string} value - The submitted value.
  68. * @private
  69. * @returns {void}
  70. */
  71. _onSubmit(value) {
  72. this.props.dispatch(endRoomLockRequest(this.props.conference, value));
  73. }
  74. }
  75. export default connect()(RoomLockPrompt);