UNPKG

@uiw/react-native

Version:
25 lines (24 loc) 626 B
import React from 'react'; import PropTypes from 'prop-types'; import { StyleSheet, Text } from 'react-native'; const styles = StyleSheet.create({ default: { fontStyle: 'italic' } }); export default function Em(props) { 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 = {};