未捕获的错误:ReferenceError:找不到变量:Expo上的react-native-svg的React

问题描述

我想在Expo上渲染简单的svg,但显示以下错误代码

未捕获的错误:ReferenceError:找不到变量:React

我的代码

import * as React from 'react';
import { Component } from 'react';
import { View,Text} from 'react-native';
import Svg,{ Circle,Rect } from 'react-native-svg';

export default class Chart extends Component {
    render() {
        return (
            <View>
                <Svg height="20" width="20">
                <Circle cx="10" cy="10" r="10" fill="red" />
                </Svg>
            </View>
        );
    }
}

我的依赖关系如下。

Expo cli: 3.27.4
"expo": "~37.0.3","react": "~16.9.0","react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz","react-native-svg": "11.0.1",

请告知您是否知道如何解决此问题。 谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)