0

我试图使用提供的入门模板构建一个 React-native dapp

npx create-react-native-dapp

我尝试运行它,在网络上运行良好,但是在扫描 Expo QR 时会引发错误

Invariant Violation:试图注册两个具有相同名称 RNSVGRect 的视图。

RNSVGRect 错误

4

1 回答 1

0

**试试这个 ** Expo 托管应用程序现在要求您安装 react-native-svg 使用

世博会安装 react-native-svg

import React from 'react';
import { View, StyleSheet } from 'react-native';
import Svg, { Circle, Rect } from 'react-native-svg';

export default class SvgExample extends React.Component {
  render() {
    return (
      <View style={[StyleSheet.absoluteFill, { alignItems: 'center', justifyContent: 'center' }]}>
        <Svg height="50%" width="50%" viewBox="0 0 100 100">
          <Circle cx="50" cy="50" r="45" stroke="blue" strokeWidth="2.5" fill="green" />
          <Rect x="15" y="15" width="70" height="70" stroke="red" strokeWidth="2" fill="yellow" />
        </Svg>
      </View>
    );
  }
}
于 2022-02-26T18:13:22.260 回答