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.

WelcomePage.native.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import React from 'react';
  2. import { Text, TextInput, TouchableHighlight, View } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { translate } from '../../base/i18n';
  5. import { Link } from '../../base/react';
  6. import { ColorPalette } from '../../base/styles';
  7. import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
  8. import { styles } from './styles';
  9. /**
  10. * The URL at which the privacy policy is available to the user.
  11. */
  12. const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
  13. /**
  14. * The URL at which the user may send feedback.
  15. */
  16. const SEND_FEEDBACK_URL = 'mailto:support@jitsi.org';
  17. /**
  18. * The URL at which the terms (of service/use) are available to the user.
  19. */
  20. const TERMS_URL = 'https://jitsi.org/meet/terms';
  21. /**
  22. * The native container rendering the welcome page.
  23. *
  24. * @extends AbstractWelcomePage
  25. */
  26. class WelcomePage extends AbstractWelcomePage {
  27. /**
  28. * WelcomePage component's property types.
  29. *
  30. * @static
  31. */
  32. static propTypes = AbstractWelcomePage.propTypes
  33. /**
  34. * Renders a prompt for entering a room name.
  35. *
  36. * @returns {ReactElement}
  37. */
  38. render() {
  39. return (
  40. <View style = { styles.container }>
  41. {
  42. this._renderLocalVideo()
  43. }
  44. {
  45. this._renderLocalVideoOverlay()
  46. }
  47. </View>
  48. );
  49. }
  50. /**
  51. * Renders legal-related content such as Terms of service/use, Privacy
  52. * policy, etc.
  53. *
  54. * @private
  55. * @returns {ReactElement}
  56. */
  57. _renderLegalese() {
  58. const { t } = this.props;
  59. return (
  60. <View style = { styles.legaleseContainer }>
  61. <Link
  62. style = { styles.legaleseItem }
  63. url = { TERMS_URL }>
  64. { t('welcomepage.terms') }
  65. </Link>
  66. <Link
  67. style = { styles.legaleseItem }
  68. url = { PRIVACY_URL }>
  69. { t('welcomepage.privacy') }
  70. </Link>
  71. <Link
  72. style = { styles.legaleseItem }
  73. url = { SEND_FEEDBACK_URL }>
  74. { t('welcomepage.sendFeedback') }
  75. </Link>
  76. </View>
  77. );
  78. }
  79. /**
  80. * Renders a View over the local video. The latter is thought of as the
  81. * background (content) of this WelcomePage. The former is thought of as the
  82. * foreground (content) of this WelcomePage such as the room name input, the
  83. * button to initiate joining the specified room, etc.
  84. *
  85. * @private
  86. * @returns {ReactElement}
  87. */
  88. _renderLocalVideoOverlay() {
  89. const { t } = this.props;
  90. return (
  91. <View style = { styles.localVideoOverlay }>
  92. <View style = { styles.roomContainer }>
  93. <Text style = { styles.title }>
  94. { t('welcomepage.roomname') }
  95. </Text>
  96. <TextInput
  97. accessibilityLabel = { 'Input room name.' }
  98. autoCapitalize = 'none'
  99. autoComplete = { false }
  100. autoCorrect = { false }
  101. autoFocus = { false }
  102. onChangeText = { this._onRoomChange }
  103. placeholder = { t('welcomepage.roomnamePlaceHolder') }
  104. style = { styles.textInput }
  105. underlineColorAndroid = 'transparent'
  106. value = { this.state.room } />
  107. <TouchableHighlight
  108. accessibilityLabel = { 'Tap to Join.' }
  109. disabled = { this._isJoinDisabled() }
  110. onPress = { this._onJoin }
  111. style = { styles.button }
  112. underlayColor = { ColorPalette.white }>
  113. <Text style = { styles.buttonText }>
  114. { t('welcomepage.join') }
  115. </Text>
  116. </TouchableHighlight>
  117. </View>
  118. {
  119. this._renderLegalese()
  120. }
  121. </View>
  122. );
  123. }
  124. }
  125. export default translate(connect(_mapStateToProps)(WelcomePage));