Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to pass a function as parent for <Trans /> component #424

Conversation

rafauke
Copy link
Contributor

@rafauke rafauke commented Apr 27, 2018

Currently if you pass something different than ReactNode to parent prop, propTypes validation throws an error:

Warning: Failed prop type: Invalid prop `parent` supplied to `Trans`, expected a ReactNode.

This would happen if you use glamorousComponent for example.

// RenderedComponent.js

<Trans
  i18nkey='common.myTransKey'
  parent={Text}
  dynamicVal={dynamicVal}
>
  My <strong>interpolation</strong> and this is my <i>{{dynamicVal}}</i>
</Trans>

// Text.js

export const Text = glamorous.p({
  fontSize: 16,
  marginTop: 10
})

@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.481% when pulling 8a18a3b on rafauke:feature/change-props-validation-for-trans-component into cebdc88 on i18next:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.481% when pulling 8a18a3b on rafauke:feature/change-props-validation-for-trans-component into cebdc88 on i18next:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 81.481% when pulling 8a18a3b on rafauke:feature/change-props-validation-for-trans-component into cebdc88 on i18next:master.

@jamuhl jamuhl merged commit f4f0964 into i18next:master Apr 27, 2018
@jamuhl
Copy link
Member

jamuhl commented Apr 28, 2018

published in react-i18next@7.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants