diff --git a/src/TransWithoutContext.js b/src/TransWithoutContext.js index c19edab59..94dd254f7 100644 --- a/src/TransWithoutContext.js +++ b/src/TransWithoutContext.js @@ -139,7 +139,12 @@ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, s function renderInner(child, node, rootReactNode) { const childs = getChildren(child); const mappedChildren = mapAST(childs, node.children, rootReactNode); - return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren; + // `mappedChildren` will always be empty if using the `i18nIsDynamicList` prop, + // but the children might not necessarily be react components + return (hasValidReactChildren(childs) && mappedChildren.length === 0) || + child.props?.i18nIsDynamicList + ? childs + : mappedChildren; } function pushTranslatedJSX(child, inner, mem, i, isVoid) { diff --git a/test/trans.render.dynamic.spec.js b/test/trans.render.dynamic.spec.js index b5e10a397..e0bb3fd9b 100644 --- a/test/trans.render.dynamic.spec.js +++ b/test/trans.render.dynamic.spec.js @@ -69,7 +69,7 @@ describe('Trans should render nested components', () => { `); }); - it('should render dynamic content correctly', () => { + it('should render dynamic Elements correctly', () => { const dynamicContent =