I am trying to convert in pdf and download to my phone . I am trying below example . I have done npm i react-native-html-to-pdf and below code . But after presing "Download Receipt" it is coming to the fucntion but after that app is getting crash . Please help me . What is the best solution in react native for this
import RNHTMLtoPDF from 'react-native-html-to-pdf';
async createPDF() {
let options = {
html: '<h1>PDF TEST</h1>',
fileName: 'test.pdf',
directory: 'Documents',
};
let file = await RNHTMLtoPDF.convert(options)
console.log("file name ",file);
//console.log(file.filePath);
//alert(file.filePath);
}
<TouchableOpacity onPress={() => this.createPDF()} style={{ flex: 1, marginTop: hp(2) }}>
<RegularText text='Download Receipt' textColor={signatureStartColor} style={{ fontSize: hp('2%'), textAlign: 'center' }} />
</TouchableOpacity>