Javascript 当我在react native Print中单击“打印”按钮时,打印选项不出现

Javascript 当我在react native Print中单击“打印”按钮时,打印选项不出现,javascript,reactjs,react-native,npm,yarnpkg,Javascript,Reactjs,React Native,Npm,Yarnpkg,我使用react native print打印某些pdf,但单击按钮打印后,打印不来。似乎无法工作。按钮和其他事情正在工作,但打印页面不显示。当我调试代码时,代码似乎有效,但打印选项不出现 import RNPrint from 'react-native-print'; export default class ViewPdf extends Component { async printHTML() { await RNPrint.print({ html: '&

我使用react native print打印某些pdf,但单击按钮打印后,打印不来。似乎无法工作。按钮和其他事情正在工作,但打印页面不显示。当我调试代码时,代码似乎有效,但打印选项不出现

import RNPrint from 'react-native-print';

export default class ViewPdf extends Component {

  async printHTML() {
    await RNPrint.print({
      html: '<h1>Heading 1</h1><h2>Heading 2</h2><h3>Heading 3</h3>'
    })
  }

  async printPDF() {
    const results = await RNHTMLtoPDF.convert({
      html: '<h1>Custom converted PDF Document</h1>',
      fileName: 'test',
      base64: true,
    })

    await RNPrint.print({ filePath: results.filePath })
  }

  async printRemotePDF() {
    await RNPrint.print({ filePath: 'http://africau.edu/images/default/sample.pdf' })
  }

  customOptions = () => {
    return (
      <View>
        {this.state.selectedPrinter &&
          <View>
            <Text>{`Selected Printer Name: ${this.state.selectedPrinter.name}`}</Text>
            <Text>{`Selected Printer URI: ${this.state.selectedPrinter.url}`}</Text>
          </View>
        }
      <Button onPress={this.selectPrinter} title="Select Printer" />
      <Button onPress={this.silentPrint} title="Silent Print" />
    </View>

    )
  }

  render() {
    return (
      <View style={styles.container}>
        {Platform.OS === 'ios' && this.customOptions()}
        <Button onPress={this.printHTML} title="Print HTML" />
        <Button onPress={this.printPDF} title="Print PDF" />
        <Button onPress={this.printRemotePDF} title="Print Remote PDF" />
      </View>
    );
  }
}
从“react native print”导入RNPrint;
导出默认类ViewPdf扩展组件{
异步打印HTML(){
等待RNPrint.print({
html:“标题1标题2标题3”
})
}
异步打印PDF(){
const results=await RNHTMLtoPDF.convert({
html:“自定义转换的PDF文档”,
文件名:“测试”,
base64:是的,
})
等待RNPrint.print({filePath:results.filePath})
}
异步printRemotePDF(){
等待RNPrint.print({filePath:'http://africau.edu/images/default/sample.pdf' })
}
自定义选项=()=>{
返回(
{this.state.selectedPrinter&&
{`所选打印机名称:${this.state.selectedPrinter.Name}`}
{`Selected Printer URI:${this.state.selectedPrinter.url}`}
}
)
}
render(){
返回(
{Platform.OS==='ios'&&this.customOptions()}
);
}
}