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}); 35// TODO: Lazy load mono font on native 36export const Code = forwardRef((props, ref) => { 37 return <Text {...props} ref={ref}/>; 38}); 39function isTextProps(props) { 40 return typeof props.children === 'string'; 41} 42// TODO: Lazy load mono font on native 43export const Pre = forwardRef((props, ref) => { 44 if (isTextProps(props)) { 45 return <Text {...props} style={[styles.pre, props.style]} ref={ref}/>; 46 } 47 return <View {...props} style={[styles.pre, props.style]} ref={ref}/>; 48}); 49// Extract dateTime to prevent passing it to the native Text element 50export const Time = forwardRef(({ dateTime, ...props }, ref) => { 51 return <Text {...props} ref={ref}/>; 52}); 53export const Strong = B; 54export const Del = S; 55export const EM = I; 56const styles = StyleSheet.create({ 57 p: { 58 marginVertical: em(1), 59 fontSize: em(1), 60 }, 61 b: { 62 fontWeight: 'bold', 63 }, 64 q: { 65 fontStyle: 'italic', 66 }, 67 pre: { 68 marginVertical: em(1), 69 }, 70 blockQuote: { 71 marginVertical: em(1), 72 }, 73 br: { 74 width: 0, 75 height: 8, 76 }, 77 small: { 78 fontSize: 10, 79 }, 80 s: { 81 textDecorationLine: 'line-through', 82 textDecorationStyle: 'solid', 83 }, 84 mark: { 85 backgroundColor: 'yellow', 86 color: 'black', 87 }, 88 i: { 89 fontStyle: 'italic', 90 }, 91}); 92//# sourceMappingURL=Text.js.map