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.

FormSectionHeader.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { Text, View } from 'react-native';
  4. import { translate } from '../../../base/i18n';
  5. import styles from './styles';
  6. /**
  7. * The type of the React {@code Component} props of {@link FormSectionHeader}
  8. */
  9. type Props = {
  10. /**
  11. * The i18n key of the text label of the section.
  12. */
  13. label: string,
  14. /**
  15. * An external style object passed to the component.
  16. */
  17. style: Object,
  18. /**
  19. * Invoked to obtain translated strings.
  20. */
  21. t: Function
  22. }
  23. /**
  24. * Implements a React {@code Component} which renders a section header on a
  25. * form.
  26. */
  27. class FormSectionHeader extends Component<Props> {
  28. /**
  29. * Implements React's {@link Component#render()}.
  30. *
  31. * @inheritdoc
  32. * @override
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. const { label, style, t } = this.props;
  37. return (
  38. <View
  39. style = { [
  40. styles.formSectionTitle,
  41. style
  42. ] } >
  43. <Text>
  44. { t(label) }
  45. </Text>
  46. </View>
  47. );
  48. }
  49. }
  50. export default translate(FormSectionHeader);