React native:开玩笑不使用react-native-elements

时间:2019-07-15 20:10:59

标签: reactjs react-native expo

使用RN0.59.8设置项目。当我使用react-native-elements并使用Jest ^ 24.8.0运行测试时,出现错误:

    .../node_modules/@expo/vector-icons/Zocial.js:1({"Object.
<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Zocial from './build/Zocial';
                                                                                                        ^^^^^^

    SyntaxError: Unexpected identifier

我已经运行了Expo并创建了该项目。尝试了所有不同的方法,例如删除node_modules,全新安装,解决方案2 https://github.com/react-native-training/react-native-elements/issues/620

基于本机的相同问题...

我的package.json:

{
    "main": "node_modules/expo/AppEntry.js",
    "scripts": {
        "start": "expo start",
        "android": "expo start --android",
        "ios": "expo start --ios",
        "web": "expo start --web",
        "eject": "expo eject",
        "test": "jest"
    },
    "dependencies": {
        "@types/jest": "^24.0.15",
        "enzyme": "^3.10.0",
        "enzyme-adapter-react-16": "^1.14.0",
        "enzyme-to-json": "^3.3.5",
        "expo": "^33.0.0",
        "expo-font": "~5.0.1",
        "from": "^0.1.7",
        "jest": "^24.8.0",
        "moment": "^2.24.0",
        "native-base": "^2.12.1",
        "react": "16.8.3",
        "react-dom": "^16.8.6",
        "react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
        "react-native-cli": "^2.0.1",
        "react-native-gesture-handler": "^1.3.0",
        "react-native-vector-icons": "^6.6.0",
        "react-native-web": "^0.11.4",
        "react-navigation": "^3.11.1",
        "react-test-renderer": "^16.8.6",
        "sinon": "^7.3.2"
    },
    "devDependencies": {
        "@types/react": "^16.8.19",
        "@types/react-native": "^0.57.60",
        "@typescript-eslint/eslint-plugin": "^1.11.0",
        "@typescript-eslint/parser": "^1.11.0",
        "babel-preset-expo": "^5.1.1",
        "eslint": "^6.0.1",
        "typescript": "^3.4.5"
    },
    "jest": {
        "setupFilesAfterEnv": [
            "./setupTests.js"
        ],
        "preset": "react-native",
        "verbose": true,
        "transform": {
            "^.+\\.tsx?$": "babel-jest"
        },
        "moduleDirectories": [
            "node_modules",
            "/components"
        ]
    },
    "private": true,
    "eslint.packageManager": "yarn"
}

0 个答案:

没有答案