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