1import React, { forwardRef } from 'react'; 2import { StyleSheet } from 'react-native'; 3import { em } from '../css/units'; 4import Text from '../primitives/Text'; 5import View from '../primitives/View'; 6export const P = forwardRef(({ style, ...props }, ref) => { 7 return <Text {...props} style={[styles.p, style]} ref={ref}/>; 8}); 9export const B = forwardRef(({ style, ...props }, ref) => { 10 return <P {...props} style={[styles.b, style]} ref={ref}/>; 11}); 12export const S = forwardRef(({ style, ...props }, ref) => { 13 return <P {...props} style={[styles.s, style]} ref={ref}/>; 14}); 15export const I = forwardRef(({ style, ...props }, ref) => { 16 return <P {...props} style={[styles.i, style]} ref={ref}/>; 17}); 18export const Q = forwardRef(({ children, cite, style, ...props }, ref) => { 19 return (<P {...props} style={[styles.q, style]} ref={ref}> 20 "{children}" 21 </P>); 22}); 23export const BlockQuote = forwardRef(({ style, cite, ...props }, ref) => { 24 return <View {...props} style={[styles.blockQuote, style]} ref={ref}/>; 25}); 26export const BR = forwardRef(({ style, ...props }, ref) => { 27 return <Text {...props} style={[styles.br, style]} ref={ref}/>; 28}); 29export const Small = forwardRef(({ style, ...props }, ref) => { 30 return <Text {...props} style={[styles.small, style]} ref={ref}/>; 31}); 32export const Mark = forwardRef(({ style, ...props }, ref) => { 33 return <Text {...props} style={[styles.mark, style]} ref={ref}/>; 34}); 35export const Code = forwardRef(({ style, ...props }, ref) => { 36 return <Text {...props} style={[styles.code, style]} ref={ref}/>; 37}); 38function isTextProps(props) { 39 return typeof props.children === 'string'; 40} 41export const Pre = forwardRef((props, ref) => { 42 if (isTextProps(props)) { 43 return <Text {...props} style={[styles.code, styles.pre, props.style]} ref={ref}/>; 44 } 45 return <View {...props} style={[styles.pre, props.style]} ref={ref}/>; 46}); 47// Extract dateTime to prevent passing it to the native Text element 48export const Time = forwardRef(({ dateTime, ...props }, ref) => { 49 return <Text {...props} ref={ref}/>; 50}); 51export const Strong = B; 52export const Del = S; 53export const EM = I; 54const styles = StyleSheet.create({ 55 p: { 56 marginVertical: em(1), 57 fontSize: em(1), 58 }, 59 b: { 60 fontWeight: 'bold', 61 }, 62 q: { 63 fontStyle: 'italic', 64 }, 65 code: { 66 fontFamily: 'Courier', 67 fontWeight: '500', 68 }, 69 pre: { 70 marginVertical: em(1), 71 }, 72 blockQuote: { 73 marginVertical: em(1), 74 }, 75 br: { 76 width: 0, 77 height: 8, 78 }, 79 small: { 80 fontSize: 12, 81 }, 82 s: { 83 textDecorationLine: 'line-through', 84 textDecorationStyle: 'solid', 85 }, 86 mark: { 87 backgroundColor: 'yellow', 88 color: 'black', 89 }, 90 i: { 91 fontStyle: 'italic', 92 }, 93}); 94//# sourceMappingURL=Text.js.map