Friday, November 6, 2026
HomeiOS Developmentandroid - React native go state/props worth to customized web page?

android – React native go state/props worth to customized web page?

[ad_1]

I must create a pdf bill utilizing html in react native. for that i am utilizing
'react-native-html-to-pdf'. Truly pdf is creating efficiently. However my concern is i must go these values from state to that hardcoded html tag. To this point i’ve hardcoded some values contained in the tag. nonetheless i must go my state worth as an alternative of that.(To get clear thought, see the remark contained in the code) is there any means to do this?

import RNHTMLtoPDF from "react-native-html-to-pdf";

this.state = {
  Stability: 100,
  Complete: 200,
  Quantity: 400,
};

onPressRequestButton = async () => {
  const html = `<html>
    <head>
        <meta charset="utf-8">
        <title>Bill</title>
        <hyperlink rel="stylesheet" href="fashion.css">
        <hyperlink rel="license" href="https://www.opensource.org/licenses/mit-license/">
        <script src="script.js"></script>
    </head>
    <physique>
        <header>
            <span><img alt="" src="http://www.jonathantneal.com/examples/bill/emblem.png"><enter kind="file" settle for="picture/*"></span>
        </header>
        <article>
            <h1>Recipient</h1>
            <desk class="stability">
                <tr>
                    <th><span contenteditable>Complete</span></th>
                    <td><span data-prefix>$</span><span>600.00</span></td> // right here i must set complete quantity {this.state.quantity} will not be working in any respect.
                </tr>
                <tr>
                    <th><span contenteditable>Quantity Paid</span></th>
                    <td><span data-prefix>$</span><span contenteditable>600.00</span></td>
                </tr>
                <tr>
                    <th><span contenteditable>Stability Due</span></th>
                    <td><span data-prefix>$</span><span>600.00</span></td>
                </tr>
            </desk>
        </article>
    </physique>
    </html> `;

  let choices = {
    html: html,
    fileName: "take a look at",
    listing: "Paperwork",
  };

  let file = await RNHTMLtoPDF.convert(choices);
  alert(file.filePath);
};

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments