Can't integrate with React-intl
I am trying to localize react-pdf using react-intl, but I get Unhandled Runtime Error
Error: [React Intl] Could not find required intl object. <IntlProvider> needs to exist in the component ancestry.
I created a Viewer component and wrapped with injectIntl from react-intl package. It is a standard way of internationalization of the components. As soon as I wrapped it with injectIntl I got above error.
The component is as follows, simplified
import {Document, Page, View} from "@react-pdf/renderer";
import React, {Component} from "react";
import {injectIntl} from "react-intl";
class Viewer extends Component {
render() {
let {intl}=this.props;
return (
<Document>
<Page style={styles.body} wrap>
<View
style={{
height: 100, textAlign: "center", width: "50%",
marginHorizontal: "auto"
}}>
{/*//Some components*/}
</View>
</Page>
</Document>
);
}
}
export default injectIntl(Viewer);
Cross-posted here https://www.brainpick.co.uk/questions/cant-integrate-with-react-intl-261, with a reward.
Hi @diegomura @withpublic . I am just wondering if you have any idea what is causing this bug or if there are any work-arounds we could use until it's fixable?
PS. thanks @diegomura for your work on react-pdf – it's a very useful tool.