Docs: allow AppText to inherit font-size

This commit is contained in:
Nicolas Gallagher
2017-09-28 14:48:46 -07:00
parent 6ef19c3ccd
commit a9e61b4cd5
+13 -2
View File
@@ -4,16 +4,27 @@
* @flow * @flow
*/ */
import { bool } from 'prop-types';
import React from 'react'; import React from 'react';
import { StyleSheet, Text } from 'react-native'; import { StyleSheet, Text } from 'react-native';
const AppText = ({ style, ...rest }) => ( class AppText extends React.PureComponent {
static contextTypes = {
isInAParentText: bool
};
render() {
const { style, ...rest } = this.props;
const isInAParentText = this.context;
return (
<Text <Text
{...rest} {...rest}
accessibilityRole={rest.href ? 'link' : undefined} accessibilityRole={rest.href ? 'link' : undefined}
style={[styles.baseText, style, rest.href && styles.link]} style={[!isInAParentText && styles.baseText, style, rest.href && styles.link]}
/> />
); );
}
}
export default AppText; export default AppText;