Open
Description
Describe the issue
On native, view-backed RSD elements such as html.div render a single string child correctly, but text disappears when JSX interpolation produces multiple primitive children.
For example, the first element below renders Count: 3, while the second is empty:
const count = 3;
<html.div>{`Count: ${count}`}</html.div>
<html.div>Count: {count}</html.div>The interpolated form produces children equivalent to ['Count: ', 3].
Expected behavior
Both elements should render Count: 3, matching normal React DOM behaviour.
Steps to reproduce
- Render the example above in a React Native application using React Strict DOM.
- Observe that the template-string example renders.
- Observe that the interpolated string/number example is empty.
Test case
import { html } from 'react-strict-dom';
export function Example() {
const count = 3;
return (
<>
<html.div>{`Count: ${count}`}</html.div>
<html.div>Count: {count}</html.div>
</>
);
}Additional comments
Reproduced with:
react-strict-dom0.0.55- React Native 0.85.3
The native implementation appears to wrap children in TextString only when typeof children === 'string'. Interpolation produces an iterable containing a string and number, which is passed directly to the native View and is not rendered.
Suggested fix
Replace typeof children === 'string' with the following checks:
function getTextContent(children: React.Node): ?string {
const nodes = React.Children.toArray(children);
const isTextOnly =
nodes.length > 0 &&
nodes.every(
(node) =>
typeof node === 'string' ||
typeof node === 'number' ||
typeof node === 'bigint'
);
return isTextOnly
? nodes.map((node) => String(node)).join('')
: null;
}Reacted by Pooria
Metadata
Metadata
Assignees
Labels
No labels
Activity
pooriamo commentedon Oct 27, 2026
I just tested this and it works. I think it makes sense especially that the code base says:
So this could also be a part of the workaround