React-i18next: Trans component support for react-native

Created on 4 Dec 2019  路  3Comments  路  Source: i18next/react-i18next

Hello, my question is if component is supported for react-native or not since when i use it it doesn't work.

Examples:

defaults="hello <0>{{what}}"
values={{ what: 'world'}}
components={[
universe
]}
/>

defaults="hello <0>{{what}}"
values={{ what: 'world'}}
components={[Text]}
/>

Most helpful comment

Oh yes, my bad, so i guess this is the correct way to do it?

defaults="hello <0>{{what}}"
values={{what: 'world'}}
parent={Text}
components={[]}
/>

All 3 comments

What error you get? should work with react-native...but you might have to define a parent component for your case -> as a string is not a valid react-native component...https://react.i18next.com/latest/trans-component#trans-props --> parent

Oh yes, my bad, so i guess this is the correct way to do it?

defaults="hello <0>{{what}}"
values={{what: 'world'}}
parent={Text}
components={[]}
/>

<Text> <Trans defaults="hello {{what}}" values={{ what: 'world'}} /> </Text>

Was this page helpful?
0 / 5 - 0 ratings