1 | 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); }
|
2 |
|
3 | import color from 'color';
|
4 | import * as React from 'react';
|
5 | import { I18nManager, StyleSheet } from 'react-native';
|
6 | import Text from './Text';
|
7 | import { withTheme } from '../../core/theming';
|
8 |
|
9 | const StyledText = _ref => {
|
10 | let {
|
11 | theme,
|
12 | alpha,
|
13 | family,
|
14 | style,
|
15 | ...rest
|
16 | } = _ref;
|
17 | const textColor = color(theme.colors.text).alpha(alpha).rgb().string();
|
18 | const font = theme.fonts[family];
|
19 | const writingDirection = I18nManager.isRTL ? 'rtl' : 'ltr';
|
20 | return React.createElement(Text, _extends({}, rest, {
|
21 | style: [styles.text, {
|
22 | color: textColor,
|
23 | ...font,
|
24 | writingDirection
|
25 | }, style]
|
26 | }));
|
27 | };
|
28 |
|
29 | const styles = StyleSheet.create({
|
30 | text: {
|
31 | textAlign: 'left'
|
32 | }
|
33 | });
|
34 | export default withTheme(StyledText);
|
35 |
|
\ | No newline at end of file |