@uiw/react-native
Version:
UIW for React Native
35 lines (34 loc) • 857 B
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { StyleSheet, Text } from 'react-native';
import { useTheme } from '@shopify/restyle';
function createStyles({
textColor
}) {
return StyleSheet.create({
default: {
fontStyle: 'italic',
color: textColor
}
});
}
export default function Em(props) {
const theme = useTheme();
const styles = createStyles({
textColor: theme.colors.primary_text || '#ccc'
});
return React.cloneElement(<Text />, {
...props,
style: [styles.default, props.style]
});
// return (
// <Text {...props} style={[styles.default, props.style]}>
// {props.children}
// </Text>
// );
}
Em.propTypes = {
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node, PropTypes.string]),
style: PropTypes.any
};
Em.defaultProps = {};