当我运行npm test时
➜ mobile git:(develop) ✗ npm test
> jest
FAIL __tests__/index.js
● Test suite failed to run
TypeError: Cannot read property 'fs' of undefined
at Object.<anonymous> (node_modules/react-native-cached-image/utils/fsUtils.js:9:12)
at Object.<anon
我在中找不到任何地方的函数-当用new调用时,应该将其原型的constructor属性设置为它们自己。
当然,规范说内置构造函数(对象、数组、字符串和c)都将它们的prototype.constructor属性设置为自己(即Object.prototype.constructor = Object),但我找不到任何地方说明必须/应该对其他构造函数执行此操作(似乎它应该在[[Construct]]部分(13.2.2 [[Construct]])中详细说明,但事实并非如此:
function F() {};
var obj = new F();
Object.getPrototypeOf(obj)
以下是App.js的解释: App.js the first file in any React Native app that is the entry point of the app development process. Whatever you write inside this file, it will get displayed on the mobile device. App是否被认为是React Native框架中的一个组件,并且与任何其他组件一样具有生命周期?