React Native 在项目或以下目录中找不到@rneui/base/dist/AirbnbRating/index:

yshpjwxd  于 2023-03-31  发布在  React
关注(0)|答案(1)|浏览(177)

下面的代码导致错误:
在项目或这些目录中找不到@rneui/base/dist/AirbnbRating/index
这不是我的主App.js类,而是在一个单独的类中。
我导入了以下库元素
import { StyleSheet,View,Text } from 'react-native';import { LineChart,BarChart,PieChart,ProgressChart,ContributionGraph,StackedBarChart,} from 'react-native-chart-kit';
我已经使用React原生图表工具包文档

const barData = [{ value: 15 }, { value: 30 }, { value: 26 }, { value: 40 }];
return (
<View>
  <View>
    <Text>Bezier Line Chart</Text>
    <LineChart
      data={{
        labels: ['January', 'February', 'March', 'April', 'May', 'June'],
        datasets: [
          {
            data: [
              Math.random() * 100,
              Math.random() * 100,
              Math.random() * 100,
              Math.random() * 100,
              Math.random() * 100,
              Math.random() * 100,
            ],
          },
        ],
      }}
      width={Dimensions.get('window').width} // from react-native
      height={220}
      yAxisLabel="$"
      yAxisSuffix="k"
      yAxisInterval={1} // optional, defaults to 1
      chartConfig={{
        backgroundColor: '#e26a00',
        backgroundGradientFrom: '#fb8c00',
        backgroundGradientTo: '#ffa726',
        decimalPlaces: 2, // optional, defaults to 2dp
        color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
        labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
        style: {
          borderRadius: 16,
        },
        propsForDots: {
          r: '6',
          strokeWidth: '2',
          stroke: '#ffa726',
        },
      }}
      bezier
      style={{
        marginVertical: 8,
        borderRadius: 16,
      }}
    />
  </View>
</View>

);

8yoxcaq7

8yoxcaq71#

无法从“node_modules/@rneui/themed/dist/AirbnbRating/index.js”解析“@rneui/base/dist/AirbnbRating/index”
这个包解决了我的问题:

npm install @rneui/base @rneui/themed

相关问题