@dokuhero/react-native-components
Version:
Sets of React Native components that works with dokuhero/react-native-theme and react-i18next
51 lines • 2.04 kB
JavaScript
import * as tslib_1 from "tslib";
import { withTheme } from '@dokuhero/react-native-theme';
import React from 'react';
import { Button as Btn } from 'react-native-elements';
export var Button = withTheme(function (_a) {
var backgroundColor = _a.backgroundColor, color = _a.color, containerViewStyle = _a.containerViewStyle, theme = _a.theme, reverseColor = _a.reverseColor, kind = _a.kind, rest = tslib_1.__rest(_a, ["backgroundColor", "color", "containerViewStyle", "theme", "reverseColor", "kind"]);
switch (kind) {
case 'primary':
backgroundColor = theme.color.primary;
color = theme.color.primaryReverse;
break;
case 'secondary':
backgroundColor = theme.color.secondary;
color = theme.color.secondaryReverse;
break;
case 'success':
backgroundColor = theme.color.success;
color = theme.color.successReverse;
break;
case 'warning':
backgroundColor = theme.color.warning;
color = theme.color.warningReverse;
break;
case 'danger':
backgroundColor = theme.color.danger;
color = theme.color.dangerReverse;
break;
default:
backgroundColor = backgroundColor || theme.color.grey;
color = color || theme.color.greyReverse;
}
if (reverseColor) {
var bClr = backgroundColor;
backgroundColor = color;
color = bClr;
}
var style = {};
if (rest.full) {
style = {
width: '100%',
marginLeft: 0,
marginRight: 0
};
}
return (<Btn borderRadius={theme.radius.big} fontFamily={theme.fontName.semiBold} fontSize={theme.fontSize.medium} {...rest} containerViewStyle={[
style,
{ borderRadius: theme.radius.big },
containerViewStyle
]} backgroundColor={backgroundColor} color={color}/>);
});
//# sourceMappingURL=Button.js.map