-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support for react-intl 3.x #28
Comments
On the top of Arrvi asked, react-intl has rewritten with Typescript in 3.x, could you also support Typescript natively? |
You can make it work by using Enzyme's getWrappingComponent and e.g const defaultMessages = new Proxy({}, { get: (target, property) => property });
let messages = defaultMessages;
export function loadTranslationObject(translations: object): object {
if (typeof translations === 'undefined') {
messages = defaultMessages;
return defaultMessages;
}
messages = translations;
return messages;
}
const WrappingComponent: React.FC = ({ children }) => (
<IntlProvider locale="en" messages={messages}>
{children}
</IntlProvider>
);
export const mountWithIntl = (node: ReactElement) =>
mount(node, { wrappingComponent: WrappingComponent }); |
Is documented here officially: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This package is not compatible with current react-intl. When trying to mount, the function crashes on old API:
The text was updated successfully, but these errors were encountered: