我已经放弃了世博会的项目.
更改info.plist后,现在我可以将我的应用程序放在"打开应用程序列表"列表中,并且实际上能够使用我的expo(React本机应用程序)打开该文件.
App.js
Linking.getInitialURL().then((url) => {
if (url) {
console.log(url);
}
}).catch(err => console.error('An error occurred', err));
Run Code Online (Sandbox Code Playgroud)
这段代码给了我这个URL.
file:///private/var/mobile/Containers/Data/Application/7E55EB55-7C49-4C0C-B4CB-63AC4F49689E/Documents/Inbox/matters-3.csv
Run Code Online (Sandbox Code Playgroud)
所以,这意味着现在我有电子邮件附件的URL,但我怎样才能在我的应用程序中获取该csv字符串的数据?
所以我假设,当我点击打开我的应用程序.从系统传递到我的应用程序的URL实际上是放在我们应用程序目录中某处的文档的副本.
但是当我尝试使用Expo.FileSystem访问此文件时.readAsStringAsync它给我一个错误说,该文件是不可读的.
是否与存储权限有关?
需要帮忙....?
在这种情况下,我们如何编写测试来检查defaultProps函数(handleChange: () => {},handleBlur: () => {},handleSubmit: () => {}),该函数
连接到dom且它们工作正常?
我知道当我们通过道具时可以测试功能,但正在寻求帮助以测试默认功能。谢谢,
import React from 'react';
import PropTypes from 'prop-types';
const LoginForm = ({
handleChange,
handleBlur,
handleSubmit,
}) => (
<form onSubmit={handleSubmit}>
<input
onChange={handleChange}
onBlur={handleBlur}
/>
<input
onChange={handleChange}
onBlur={handleBlur}
/>
<button type="submit">
Submit
</button>
</form>
);
const shape = { email: '', password: '', generic: '' };
LoginForm.propTypes = {
handleChange: PropTypes.func,
handleBlur: PropTypes.func,
handleSubmit: PropTypes.func,
};
LoginForm.defaultProps = {
handleChange: () => {},
handleBlur: () => {}, …Run Code Online (Sandbox Code Playgroud) expo ×2
react-native ×2
enzyme ×1
fileshare ×1
filesystems ×1
ios ×1
javascript ×1
jestjs ×1
reactjs ×1