11import * as React from 'react' ;
2- import type { HostElement , Root } from 'universal-test-renderer/react-native ' ;
3- import { createRoot } from 'universal-test-renderer/react-native ' ;
2+ import type { HostElement , Root , RootOptions } from 'universal-test-renderer' ;
3+ import { createRoot } from 'universal-test-renderer' ;
44
55import act from './act' ;
66import { addToCleanupQueue } from './cleanup' ;
77import { getConfig } from './config' ;
88import type { DebugOptions } from './helpers/debug' ;
99import { debug } from './helpers/debug' ;
10+ import { HOST_TEXT_NAMES } from './helpers/host-component-names' ;
1011import { setRenderResult } from './screen' ;
1112import { getQueriesForElement } from './within' ;
1213
@@ -22,19 +23,20 @@ export interface RenderOptions {
2223
2324export type RenderResult = ReturnType < typeof render > ;
2425
26+ const createRootOptions : RootOptions = {
27+ textComponents : HOST_TEXT_NAMES ,
28+ } ;
29+
2530/**
2631 * Renders test component deeply using React Test Renderer and exposes helpers
2732 * to assert on the output.
2833 */
29- export default function render < T > ( element : React . ReactElement < T > , options : RenderOptions = { } ) {
30- return renderInternal ( element , options ) ;
31- }
32-
33- export function renderInternal < T > ( element : React . ReactElement < T > , options ?: RenderOptions ) {
34+ export function render < T > ( element : React . ReactElement < T > , options : RenderOptions = { } ) {
3435 const { wrapper : Wrapper } = options || { } ;
3536
3637 const wrap = ( element : React . ReactElement ) => ( Wrapper ? < Wrapper > { element } </ Wrapper > : element ) ;
3738 const renderer = createRoot ( {
39+ ...createRootOptions ,
3840 createNodeMock : options ?. createNodeMock ,
3941 } ) ;
4042 void act ( ( ) => {
0 commit comments