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