在 UIManager 中找不到“ARTShape” - React Native

M.K*_*ass 7 react-native

请找到下面的图片以供参考

我正在使用 React Native Expo(36.0.0)。我正在为我的项目开发仪表板屏幕。所以,我只想在仪表板屏幕中显示一些饼图。我已经尝试了许多用于各种图表的库。没有什么对我有用。最后我在 youtube 视频的帮助下使用了react-native-pie。它仍然向我显示同样的错误。

我是 React Native 的新手。

谢谢!

import React, { Component } from 'react';
import { View, Text, ScrollView, StyleSheet, TouchableOpacity, ActivityIndicator, Dimensions } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import Pie from 'react-native-pie';

class HomeScreen extends Component
{
constructor(props)
{
  super(props);
}
render()
{
return(
  <ScrollView>
    <View style={styles.homeContainer}>
      <View style={{paddingVertical:15, flexDirection:'row', width:350, justifyContent:'center'}}>
        <Pie
          radius={80}
          sections={[
            {
              percentage:10,
              color:'red'
            },
            {
              percentage:30,
              color:'green'
            },
            {
              percentage:60,
              color:'orange'
            }
          ]}
        />
      </View>
    </View>
  </ScrollView>
)
}
}

const styles = StyleSheet.create({
   homeContainer:
   {
     alignItems:'center',
     justifyContent:'center'
   },
})

export default HomeScreen;
Run Code Online (Sandbox Code Playgroud)

Sab*_*dar 6

我认为,RN 0.62 中没有添加自动链接功能,所以你可以这样做:

转到您的 ios 文件夹和项目,然后单击 podfile,然后将以下行添加到其他类似的 pod,或将其添加到 podfile 的末尾。

  pod 'ReactNativeART', :path => '../node_modules/@react-native-community/art'
Run Code Online (Sandbox Code Playgroud)

之后,转到编辑器终端从根文件夹打开您的项目,然后:

cd ios
pod install
cd ..
react-native run-ios
Run Code Online (Sandbox Code Playgroud)


小智 5

针对 Android 的修复

步骤1

将此行添加到 android/settings.gradle

include ':react-native-art'
project(':react-native-art').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/art/android')
Run Code Online (Sandbox Code Playgroud)

第2步

将此行添加到 android/app/build.gradle

dependencies {
   ...
   implementation project(':react-native-art')
}
Run Code Online (Sandbox Code Playgroud)

步骤3

将此行添加到 android/app/src/main/.../MainApplication.java

import com.reactnativecommunity.art.ARTPackage;

...

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      
      ...
      
      packages.add(new ARTPackage());
      
      ...
      
      return packages;
    }
Run Code Online (Sandbox Code Playgroud)

感谢未知亚洲人的帮助https://bocoder.tistory.com/m/40