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

DisplayNamePrompt.tsx 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import InputDialog from '../../../base/dialog/components/native/InputDialog';
  4. import { onSetDisplayName } from '../../functions';
  5. import { IProps } from '../../types';
  6. /**
  7. * Implements a component to render a display name prompt.
  8. */
  9. class DisplayNamePrompt extends Component<IProps> {
  10. _onSetDisplayName: (displayName: string) => boolean;
  11. /**
  12. * Initializes a new {@code DisplayNamePrompt} instance.
  13. *
  14. * @param {Object} props - The read-only properties with which the new
  15. * instance is to be initialized.
  16. */
  17. constructor(props: IProps) {
  18. super(props);
  19. // Bind event handlers so they are only bound once for every instance.
  20. this._onSetDisplayName = onSetDisplayName(props.dispatch, props.onPostSubmit);
  21. }
  22. /**
  23. * Implements React's {@link Component#render()}.
  24. *
  25. * @inheritdoc
  26. */
  27. render() {
  28. return (
  29. <InputDialog
  30. descriptionKey = 'dialog.enterDisplayName'
  31. disableCancel = { true }
  32. onSubmit = { this._onSetDisplayName }
  33. titleKey = 'dialog.displayNameRequired'
  34. validateInput = { this.props.validateInput } />
  35. );
  36. }
  37. }
  38. export default connect()(DisplayNamePrompt);