question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example doesn't work on react-native v0.21

See original GitHub issue

I’m getting undefined is not an object (evaluating 'RNHTMLtoPDF.convert') error from this line: RNHTMLtoPDF.convert(options).then((result) => {

here is my code:

'use strict';

var React = require('react-native');

var {
  AlertIOS,
  AppRegistry,
  NativeModules: {
    RNHTMLtoPDF,
    RNMail
  },
  StyleSheet,
  Text,
  TouchableHighlight,
  View,
} = React;

import template from '../helpers/template';

var HTMLToPDFExample = React.createClass({

  componentDidMount() {
    var options = {
      html: template.html,
      fileName: 'test',
      directory: 'docs',
      height: 800,
      width: 1056,
      padding: 24,
    };

  RNHTMLtoPDF.convert(options).then((result) => {
    RNMail.mail({
        subject: 'Test',
        recipients: [''],
        body: '',
        attachmentPath: result,
        attachmentType: 'pdf',
      }, (error, event) => {
        if(error) {
          AlertIOS.alert('Error', 'Could not send mail. Please send a mail to support@example.com');
        }
      });
    });
  },
.....
.....

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
michshatcommented, Jun 6, 2016

@christopherdro thanks! I haven’t tried it yet. I will and let you know. Thank you again.

0reactions
ranaabumazencommented, Apr 8, 2019

@christopherdro thanks! I haven’t tried it yet. I will and let you know. Thank you again.

did you solve that problem?!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting - React Native
If you added React Native manually to your project, make sure you have included all the relevant dependencies that you are using, like...
Read more >
Could not connect to React Native development server on ...
Open your React Native app on your device. You'll see a red screen with an error. This is OK. The following steps will...
Read more >
react-native - npm
A framework for building native apps using React. Latest version: 0.70.6, last published: a month ago. Start using react-native in your ...
Read more >
React Native v0.63.x released
Update react-native-community/eslint-config to 1.1. · Update community eslint plugin in the eslint config (b2d10bc602 by @Naturalclar) · Upgrade ...
Read more >
React Native Tutorial for Beginners - YouTube
React Native Tutorial for Beginners - Learn to build an amazing React Native app for iOS & Android. Get the full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found