2018-02-02 14:48:43 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { Text, View } from 'react-native';
|
|
|
|
|
|
|
|
import { translate } from '../../../base/i18n';
|
|
|
|
|
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link FormSectionHeader}
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The i18n key of the text label of the section.
|
|
|
|
*/
|
2018-05-29 12:51:55 +00:00
|
|
|
label: string,
|
2018-02-02 14:48:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An external style object passed to the component.
|
|
|
|
*/
|
|
|
|
style: Object,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a React {@code Component} which renders a section header on a
|
|
|
|
* form.
|
|
|
|
*/
|
|
|
|
class FormSectionHeader extends Component<Props> {
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @override
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2018-05-29 12:51:55 +00:00
|
|
|
const { label, style, t } = this.props;
|
2018-02-02 14:48:43 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<View
|
|
|
|
style = { [
|
|
|
|
styles.formSectionTitle,
|
|
|
|
style
|
|
|
|
] } >
|
|
|
|
<Text>
|
2018-05-29 12:51:55 +00:00
|
|
|
{ t(label) }
|
2018-02-02 14:48:43 +00:00
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default translate(FormSectionHeader);
|