reactjs - 使用 alert 打印文本以外的其他内容
问题描述
我是 React Native 的新手,我想知道是否可以使用 alert() 打印文本以外的其他内容,在我的情况下,我需要打印 QR 码(使用 ID)
其实我在这一点上:
async function fetchFirebaseQRCode(id) {
const path = await firebase.storage().ref(`${id}.png`).getDownloadURL();
alert(path);
}
通过按下按钮,我得到了文本中的 id:
<Button
onPress={() => fetchFirebaseQRCode(item.id)}
title="QR Code"
accessibilityLabel="qrcodeButton"
color="#000000"
/>
那么问题来了,我可以在警报中打印图片/二维码吗?还是我需要使用模态?如果是这样,是否有一个我可以使用的简单模式?
谢谢
解决方案
您可以使用视图。当有二维码时,将其显示在屏幕中央。如果它不存在,请将其隐藏。
推荐阅读
- javascript - React 转换服务器响应(向对象添加额外字段)
- java - 如何知道 runtime.exec() 应用程序窗口是否处于活动状态(在 java 中)
- c# - 如何在 ASP.NET Core 中添加 Mime 类型
- c# - ASP.NET MVC C# Web App - 从数据库中过滤/搜索得到错误
- selenium-webdriver - Firefox 驱动程序未导航到新选项卡
- python - 无法使用 Ctrl C 命令在 Python 脚本中杀死 Greenlets
- spring-boot - 构建 Jnuit 测试时无法加载应用程序上下文异常
- python - Spinnaker 管道即代码
- java - 在我的模型中引入分支
- reactjs - 在 React 中进行倒计时