react95-native
Version:
Refreshed Windows 95 style UI components for your React Native app
38 lines (31 loc) • 1.19 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import React from 'react';
import { Text as NativeText } from 'react-native';
import { withTheme } from '../../core/theming';
import { builtTextStyles } from '../../styles/styles';
// TODO: set proper lineHeight and make it so that it automatically adjusts for every fontSize
const Text = ({
bold = false,
children,
disabled = false,
secondary = false,
theme,
style,
...rest
}) => {
const textStyles = builtTextStyles(theme);
const getTextStyle = () => {
if (disabled) {
return textStyles.disabled;
}
if (secondary) {
return textStyles.secondary;
}
return textStyles.default;
};
return /*#__PURE__*/React.createElement(NativeText, _extends({
style: [bold ? textStyles.bold : textStyles.regular, getTextStyle(), style]
}, rest), children);
};
export default withTheme(Text);
//# sourceMappingURL=Text.js.map