155058f92SEvan Baconimport React, { forwardRef } from 'react'; 2600afe4bSEvan Baconimport { StyleSheet, Platform } from 'react-native'; 355058f92SEvan Baconimport { em } from '../css/units'; 455058f92SEvan Baconimport Text from '../primitives/Text'; 555058f92SEvan Baconimport View from '../primitives/View'; 655058f92SEvan Baconexport const P = forwardRef(({ style, ...props }, ref) => { 7896103abSandy return React.createElement(Text, { ...props, style: [styles.p, style], ref: ref }); 855058f92SEvan Bacon}); 955058f92SEvan Baconexport const B = forwardRef(({ style, ...props }, ref) => { 10896103abSandy return React.createElement(Text, { ...props, style: [styles.b, style], ref: ref }); 1155058f92SEvan Bacon}); 1255058f92SEvan Baconexport const S = forwardRef(({ style, ...props }, ref) => { 13896103abSandy return React.createElement(Text, { ...props, style: [styles.s, style], ref: ref }); 1455058f92SEvan Bacon}); 1555058f92SEvan Baconexport const I = forwardRef(({ style, ...props }, ref) => { 16896103abSandy return React.createElement(Text, { ...props, style: [styles.i, style], ref: ref }); 1755058f92SEvan Bacon}); 1855058f92SEvan Baconexport const Q = forwardRef(({ children, cite, style, ...props }, ref) => { 19896103abSandy return (React.createElement(Text, { ...props, style: [styles.q, style], ref: ref }, 206993d56aSEvan Bacon "\"", 216993d56aSEvan Bacon children, 226993d56aSEvan Bacon "\"")); 2355058f92SEvan Bacon}); 2455058f92SEvan Baconexport const BlockQuote = forwardRef(({ style, cite, ...props }, ref) => { 25896103abSandy return React.createElement(View, { ...props, style: [styles.blockQuote, style], ref: ref }); 2655058f92SEvan Bacon}); 2755058f92SEvan Baconexport const BR = forwardRef(({ style, ...props }, ref) => { 28896103abSandy return React.createElement(Text, { ...props, style: [styles.br, style], ref: ref }); 2955058f92SEvan Bacon}); 3055058f92SEvan Baconexport const Mark = forwardRef(({ style, ...props }, ref) => { 31896103abSandy return React.createElement(Text, { ...props, style: [styles.mark, style], ref: ref }); 3255058f92SEvan Bacon}); 3337e143d9SEvan Baconexport const Code = forwardRef(({ style, ...props }, ref) => { 34896103abSandy return React.createElement(Text, { ...props, style: [styles.code, style], ref: ref }); 3555058f92SEvan Bacon}); 3655058f92SEvan Baconfunction isTextProps(props) { 3755058f92SEvan Bacon return typeof props.children === 'string'; 3855058f92SEvan Bacon} 3955058f92SEvan Baconexport const Pre = forwardRef((props, ref) => { 4055058f92SEvan Bacon if (isTextProps(props)) { 41896103abSandy return React.createElement(Text, { ...props, style: [styles.code, styles.pre, props.style], ref: ref }); 4255058f92SEvan Bacon } 43896103abSandy return React.createElement(View, { ...props, style: [styles.pre, props.style], ref: ref }); 4455058f92SEvan Bacon}); 4555058f92SEvan Bacon// Extract dateTime to prevent passing it to the native Text element 4655058f92SEvan Baconexport const Time = forwardRef(({ dateTime, ...props }, ref) => { 47896103abSandy return React.createElement(Text, { ...props, ref: ref }); 4855058f92SEvan Bacon}); 4955058f92SEvan Baconexport const Strong = B; 5055058f92SEvan Baconexport const Del = S; 5155058f92SEvan Baconexport const EM = I; 52f4a8f663SEvan Baconexport const Span = Text; 5355058f92SEvan Baconconst styles = StyleSheet.create({ 5455058f92SEvan Bacon p: { 55*1aa8cfddSBrent Vatne // @ts-ignore 5655058f92SEvan Bacon marginVertical: em(1), 5755058f92SEvan Bacon }, 5855058f92SEvan Bacon b: { 5955058f92SEvan Bacon fontWeight: 'bold', 6055058f92SEvan Bacon }, 6155058f92SEvan Bacon q: { 6255058f92SEvan Bacon fontStyle: 'italic', 6355058f92SEvan Bacon }, 6437e143d9SEvan Bacon code: { 655a8b4edeSBrent Vatne fontFamily: Platform.select({ default: 'Courier', ios: 'Courier New', android: 'monospace' }), 6637e143d9SEvan Bacon fontWeight: '500', 6737e143d9SEvan Bacon }, 6855058f92SEvan Bacon pre: { 69*1aa8cfddSBrent Vatne // @ts-ignore 7055058f92SEvan Bacon marginVertical: em(1), 7155058f92SEvan Bacon }, 7255058f92SEvan Bacon blockQuote: { 73*1aa8cfddSBrent Vatne // @ts-ignore 7455058f92SEvan Bacon marginVertical: em(1), 7555058f92SEvan Bacon }, 7655058f92SEvan Bacon br: { 7755058f92SEvan Bacon width: 0, 78*1aa8cfddSBrent Vatne // @ts-ignore 7960ea71b8SEvan Bacon height: em(0.5), 8055058f92SEvan Bacon }, 8155058f92SEvan Bacon s: { 8255058f92SEvan Bacon textDecorationLine: 'line-through', 8355058f92SEvan Bacon textDecorationStyle: 'solid', 8455058f92SEvan Bacon }, 8555058f92SEvan Bacon mark: { 8655058f92SEvan Bacon backgroundColor: 'yellow', 8755058f92SEvan Bacon color: 'black', 8855058f92SEvan Bacon }, 8955058f92SEvan Bacon i: { 9055058f92SEvan Bacon fontStyle: 'italic', 9155058f92SEvan Bacon }, 9255058f92SEvan Bacon}); 9355058f92SEvan Bacon//# sourceMappingURL=Text.js.map