@dokuhero/react-native-components
Version:
Sets of React Native components that works with dokuhero/react-native-theme and react-i18next
27 lines • 1.11 kB
JavaScript
import { withTheme } from '@dokuhero/react-native-theme';
import React from 'react';
import { View } from 'react-native';
import { FormLabel, FormValidationMessage } from 'react-native-elements';
export var FormField = withTheme(function (_a) {
var containerStyle = _a.containerStyle, labelStyle = _a.labelStyle, label = _a.label, children = _a.children, errors = _a.errors, theme = _a.theme;
return (<View style={containerStyle}>
{label && (<FormLabel fontFamily={theme.fontName.semiBold} labelStyle={[
{
fontFamily: theme.fontName.semiBold,
fontSize: theme.fontSize.small
},
labelStyle
]}>
{label}
</FormLabel>)}
{children}
{errors &&
errors.map(function (err, idx) { return (<FormValidationMessage key={"errmsg-" + idx} fontFamily={theme.fontName.regular} labelStyle={{
color: theme.color.danger,
fontFamily: theme.fontName.regular
}}>
{err}
</FormValidationMessage>); })}
</View>);
});
//# sourceMappingURL=FormField.js.map