当我尝试使用react-native-webview@9.0.1
生成QR码时,我在npm react-native-qrcode-generator
遇到此错误
我在反应管理工作流中使用react-native。事实是它可以在iOS上运行,而我只能在Android上收到错误
我自己搜索了一个解决方案,并尝试安装react-native-get-random-values
,但这也没有用。
有什么想法吗?
答案 0 :(得分:5)
我在android上也遇到了同样的问题。在iOS上正常运行。
我用以下方法解决了它:
npm uninstall react-native-webview
expo install react-native-webview
。答案 1 :(得分:3)
这是对我有用的
安装react-native-get-random-values
npm install --save react-native-get-random-values
在导入Webview之前导入react-native-get-random-values(非常重要)
import 'react-native-get-random-values';
import {WebView} from 'react-native-webview';
有关更多信息,请阅读此issue。
答案 2 :(得分:1)
我使用Expo SDK 37和您提到的确切版本制作了snack:
{
"dependencies": {
"react-native-webview": "9.0.1",
"react-native-qrcode-generator": "1.2.1"
}
}
它在我的Android手机上正常工作。问题必须在您的实现中的其他地方。
如果您最近更改了版本,请尝试删除node_modules
并重新安装软件包。仔细检查我的示例,让我知道您是否做其他事情?
答案 3 :(得分:0)
尝试使用:class FormField(AbstractFormField):
CHOICES = FORM_FIELD_CHOICES + (('fileupload', 'File Upload'),)
page = ParentalKey('FormPage', on_delete=models.CASCADE, related_name='form_fields')
field_type = models.CharField(
verbose_name='field type',
max_length=16,
# use the choices tuple defined above
choices=CHOICES
)
api_fields = [
APIField('page'),
]
class CustomFormBuilder(FormBuilder):
def create_fileupload_field(self, field, options):
return forms.FileField(**options)
class FormPage(AbstractEmailForm):
form_builder = CustomFormBuilder
intro = RichTextField(blank=True)
thank_you_text = RichTextField(blank=True)
content_panels = AbstractEmailForm.content_panels + [
FieldPanel('intro', classname="full"),
InlinePanel('form_fields', label="Form fields"),
FieldPanel('thank_you_text', classname="full"),
MultiFieldPanel([
FieldRowPanel([
FieldPanel('from_address', classname="col6"),
FieldPanel('to_address', classname="col6"),
]),
FieldPanel('subject'),
], "Email"),
]
# Export fields over the API
api_fields = [
APIField('intro'),
APIField('thank_you_text'),
]
对我有用。
答案 4 :(得分:0)
他们在webview标记9.2.2中对其进行了修复,如更改日志中所示 https://github.com/react-native-community/react-native-webview/releases/tag/v9.2.2
答案 5 :(得分:0)
反应原生
Install react-native-get-random-values
Import it before uuid:
import 'react-native-get-random-values';
import { v4 as uuidv4 } from 'uuid';