TypeError:TypeError:未定义不是对象(正在评估'_expo.Icon.Ionicons')

时间:2020-06-10 02:52:06

标签: node.js reactjs react-native expo

我刚刚将我的SDK升级到^ 34.0.0,当我使用expo start时,我应该能够在Expo客户端中显示我的应用程序。而是显示了此消息

警告:React.createElement:类型无效-预期为字符串(对于内置组件)或类/函数(对于复合组件),但得到:%s。%s%s,未定义,您可能忘记了从其定义的文件中导出组件,或者您可能混淆了默认导入和命名导入。

TypeError:TypeError:未定义不是对象(正在评估'_expo.Icon.Ionicons')

这是我的app.js

import React from "react";
import { StyleSheet, Text, View } from "react-native";

import { AppLoading, Asset } from "expo";

import Navigation from "./navigation";
import { Block } from "./components";

// import all used images

export default class App extends React.Component {
  state = {
    isLoadingComplete: false,
  };

  handleResourcesAsync = async () => {
    // we're caching all the images
    // for better performance on the app

    const cacheImages = images.map((image) => {
      return Asset.fromModule(image).downloadAsync();
    });

    return Promise.all(cacheImages);
  };

  render() {
    if (!this.state.isLoadingComplete && !this.props.skipLoadingScreen) {
      return (
        <AppLoading
          startAsync={this.handleResourcesAsync}
          onError={(error) => console.warn(error)}
          onFinish={() => this.setState({ isLoadingComplete: true })}
        />
      );
    }

    return (
      <Block white>
        <Navigation />
      </Block>
    );
  }
}

const styles = StyleSheet.create({});

这是我的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"

  },
  "dependencies": {
    "axios": "^0.19.0",
    "expo": "^35.0.0",
    "moment": "^2.24.0",
    "react": "16.8.3",
    "react-dom": "16.8.3",
    "react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
    "react-native-card-stack": "^0.2.8",
    "react-native-currency-formatter": "^1.0.3",
    "react-native-gesture-handler": "~1.3.0",
    "react-native-modal": "^11.2.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-web": "^0.11.7",
    "react-navigation": "^3.11.1",
    "react-native-screens": "~1.0.0-alpha.23"
  },
  "devDependencies": {
    "babel-preset-expo": "^7.0.0"
  },
  "private": true
}

我是这个新手,我不知道如何解决。我尝试运行npm start -- -c并没有任何改变。我在终端中收到日志,但是模拟器显示红色屏幕。

0 个答案:

没有答案
相关问题