# All files / form FormValidationMessage.js

100% Statements 5/5
100% Branches 6/6
100% Functions 1/1
100% Lines 5/5

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55

    1x

    2x
    2x

    1x

    1x

     import PropTypes from 'prop-types';
    import React from 'react';
    import { StyleSheet, View, Text as NativeText } from 'react-native';
    import colors from '../config/colors';
    import Text from '../text/Text';
    import normalize from '../helpers/normalizeText';
    import ViewPropTypes from '../config/ViewPropTypes';

    const FormValidationMessage = props => {
      const {
        containerStyle,
        labelStyle,
        children,
        fontFamily,
        ...attributes
      } = props;
      return (
        <View
          style={[styles.container, containerStyle && containerStyle]}
          {...attributes}
        >
          <Text
            style={[
              styles.label,
              labelStyle && labelStyle,
              fontFamily && { fontFamily },
            ]}
          >
            {children}
          </Text>
        </View>
      );
    };

    FormValidationMessage.propTypes = {
      containerStyle: ViewPropTypes.style,
      labelStyle: NativeText.propTypes.style,
      children: PropTypes.any,
      fontFamily: PropTypes.string,
    };

    const styles = StyleSheet.create({
      container: {},
      label: {
        marginLeft: 20,
        marginRight: 20,
        marginTop: 5,
        marginBottom: 1,
        color: colors.error,
        fontSize: normalize(12),
      },
    });

    export default FormValidationMessage;