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 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

This comment has been minimized.

Copy link

coveralls commented Apr 27, 2018

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

This comment has been minimized.

Copy link

coveralls commented Apr 27, 2018

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

This comment has been minimized.

Copy link

coveralls commented Apr 27, 2018

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
3 checks passed
3 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage remained the same at 81.481%
Details
@jamuhl

This comment has been minimized.

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
Projects
None yet
3 participants
You can’t perform that action at this time.