You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			19 lines
		
	
	
		
			533 B
		
	
	
	
		
			TypeScript
		
	
			
		
		
	
	
			19 lines
		
	
	
		
			533 B
		
	
	
	
		
			TypeScript
		
	
| import React from 'react';
 | |
| import { RenderTextCallbackType } from '../../types/Util';
 | |
| 
 | |
| type Props = {
 | |
|   text: string;
 | |
|   /** Allows you to customize now non-newlines are rendered. Simplest is just a <span>. */
 | |
|   renderNonNewLine: RenderTextCallbackType;
 | |
|   isGroup: boolean;
 | |
| };
 | |
| 
 | |
| export const AddNewLines = (props: Props) => {
 | |
|   const { text, renderNonNewLine, isGroup } = props;
 | |
|   const rendered = renderNonNewLine({ text, key: 0, isGroup });
 | |
|   if (typeof rendered === 'string') {
 | |
|     return <>{rendered}</>;
 | |
|   }
 | |
|   return rendered;
 | |
| };
 |