giorgosart / react-easy-edit

Inline editing library for React
https://giorgosart.gitbook.io/react-easy-edit/
MIT License
251 stars 45 forks source link

placeholder elements are now accepted without printing annoying warnings #129

Closed nschroeter closed 3 years ago

nschroeter commented 3 years ago

We are using react-easy-edit in a multi-language application and lingui.js does all the translation work.

lingui.js uses JSX elements (e.g. <Trans> ) to process any translated strings:

<EasyEdit
    type="text"
    placeholder={
        <Trans>
            Your CO<sub>2</sub> report
        </Trans>
    }
/>

This leads to warnings during testing and in production:

Warning: Failed prop type: Invalid prop `placeholder` of type `object` supplied to `EasyEdit`, expected `string`.
        at EasyEdit (/home/nschroeter/git/react-easy-edit/src/lib/EasyEdit.jsx:19:5)

As you can imagine, there will be literally thousands of warnings because the complete UI is being translated.

This PR should make it possible to pass JSX elements as placeholder values, including tests.

giorgosart commented 3 years ago

Thank you @nschroeter for your PR, will get this deployed as soon as possible

giorgosart commented 3 years ago

@nschroeter your PR is now in and released as part of 1.13.3