(props)
| 38 | } |
| 39 | |
| 40 | export function TextElement(props) { |
| 41 | // Remove empty white space lines used just to move element in new line. |
| 42 | // Use "p" or "br" to add new line. |
| 43 | const textualChildElements = decodeHtmlEntities( |
| 44 | removeWhiteSpace(props.childElements), |
| 45 | ); |
| 46 | |
| 47 | if (textualChildElements.length === 0) { |
| 48 | // Even if there is no children to render, the Text must be rendered |
| 49 | // because otherwise RN may render a View to wrap a "null" which may lead to |
| 50 | // a case where a View is in the Text. |
| 51 | return <Text style={{ height: 0 }} />; |
| 52 | } |
| 53 | |
| 54 | // Must be the RN Text so that style inheritance chain |
| 55 | // doesn't break with additional layer. |
| 56 | return <Text {...props}>{textualChildElements}</Text>; |
| 57 | } |
| 58 | |
| 59 | TextElement.propTypes = { |
| 60 | ...ElementPropTypes, |
nothing calls this directly
no test coverage detected