当我按照其他类似的报告时,无论我尝试安装(babel明智),都会继续收到此错误.这是堆栈跟踪:
Run Code Online (Sandbox Code Playgroud)error: bundling failed: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "C:\\Users\\Admin-ESS\\Absent\\node_modules\\@babel\\preset-env\\lib\\index.js") at throwVersionError (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11) at Object.assertVersion (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11) at _default (C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\lib\index.js:150:7) at C:\Users\Admin-ESS\Absent\node_modules\@babel\preset-env\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12 at C:\Users\Admin-ESS\Absent\node_modules\metro\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46 …
我正在创建这个应该由强制门户触发的登陆页面。在我的登陆页面上,有一个按钮可以触发打开<video>
元素,然后用于扫描二维码。默认情况下,在访问网络摄像头或设备的摄像头时,浏览器将首先询问用户的许可。所以基本上一切都工作正常并且都在浏览器上。
将其作为强制门户触发的登陆页面后,出现了一些不一致的情况。在我同事拥有的大多数 Android 手机上,他们只是默认拒绝该权限。在某些 Android 设备上,会显示请求许可的弹出消息,并且像浏览器版本一样按预期工作。在 IOS 设备上,弹出窗口只是被阻止(不是被拒绝,而是被忽略)我知道它在 IOS 上被忽略,因为错误消息甚至没有显示,就好像强制门户没有对弹出窗口执行任何操作。
我读过几个关于强制门户的论坛,所有这些都让我相信强制门户本质上只是内置浏览器的轻量级版本,它根本没有运行能力window.alert()
,window.confirm()
也没有保存 cookie 的能力。我的“研究”还让我相信强制门户具有操作系统独有的不同行为集,而不是操作系统本身安装的浏览器。
我今天读到的第 1 篇博客,特别是评论部分,提到从 IOS 11.2 开始,强制门户应该已经能够运行window.alert()
和window.confirm()
. 然而,经过测试,情况并非如此。
所以我的问题是,有没有办法解决这个限制,仍然允许用户决定是否允许或拒绝相机访问?
我的“研究”表明,不可能以编程方式重定向强制门户以在浏览器上打开,并且只有少数手机具有带有“在浏览器中打开”选项的强制门户。
有谁知道有什么方法可以拦截正在运行的权限弹出窗口并将其显示为普通的 HTML 元素,然后以编程方式传回用户响应?
提前致谢!:)
我有以下设置,当用户使用 ImagePicker 拍照时,它将FileSystem.documentDirectory
使用以下代码保存:
saveAvatar = async (uri) => {
await Expo.FileSystem.moveAsync({
from: uri,
to: Expo.FileSystem.documentDirectory + 'avatar/profile'
})
}
_takePhoto = async () => {
const result = await ImagePicker.launchCameraAsync({
allowsEditing: false,
base64: true,
quality: 0.4
});
if (!result.cancelled) {
this.setState({ image: result.base64 });
this.saveAvatar(result.uri)
}
};
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用以下方法检查检索它:
ensureDirAsync = async () => {
const props = await FileSystem.getInfoAsync(FileSystem.documentDirectory + 'avatar/');
if (props.exists && props.isDirectory) {
return props;
}
try {
await FileSystem.makeDirectoryAsync(FileSystem.documentDirectory + 'avatar/', { intermediates: true …
Run Code Online (Sandbox Code Playgroud)