小编Pri*_*abu的帖子

为什么错误:元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:数字

我正在运行这个程序来显示 SVG 图像

import React, { Component } from 'react';
import { View } from 'react-native';
import Expo from './assets/check-mark.svg';
import SVG from 'react-native-svg';

export default class MyApp extends Component {
 render(){
  return (
    <View style={{backgroundColor:"black"}}>
    <Expo width={20}
    height={15} />
    </View>
   );
 }
}
Run Code Online (Sandbox Code Playgroud)

并遇到了这个错误Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: number.

我该如何解决这个问题?或者还有其他更好的方法来使用 React Native 的 SVG 图像吗?

svg reactjs react-native

9
推荐指数
3
解决办法
2万
查看次数

标签 统计

react-native ×1

reactjs ×1

svg ×1