Entonces, estoy tratando de usar la biblioteca Victory para reaccionar de forma nativa a fin de dibujar un gráfico de líneas para mi aplicación de presupuesto. Aquí está el código que tengo en mi componente Graph
import React from 'react'; import { View, StyleSheet } from 'react-native'; import { VictoryLine } from 'victory'; export default function Graph() { return ( <View> <VictoryLine /> </View> ) }Aquí está el código de dónde se está importando el componente
import React from 'react' import { View, Text, StyleSheet, TextInput } from 'react-native' import Graph from './Line' export default function MonthSummary() { return ( <View style={styles.container}> <Text style={styles.title}>My Summary</Text> <Text style={styles.subtitle}>£1,325</Text> <Graph /> </View> ) } const styles = StyleSheet.create({ container: { backgroundColor: 'white', width: 350, height: 200, padding: 20, shadowColor: "#000", shadowOffset: { width: 0, height: 2, }, shadowOpacity: 0.25, shadowRadius: 3.84, elevation: 5, }, title: { textTransform: 'uppercase', fontSize: 14, fontWeight: '600', color: '#333333', }, subtitle: { color: '#333333', fontSize: 30, marginTop: 5, } });Pero cuando ejecuto mi aplicación, aparece un error de excepción de componente. Captura de pantalla aquí . ¡Si alguien pudiera ayudar, sería increíble, ya que he estado luchando con eso durante horas!
Parece que está utilizando la biblioteca web en lugar de la nativa de reacción. Siga esto para configurarlo y cambiar su componente gráfico para que se vea así
import React from 'react'; import { View, StyleSheet } from 'react-native'; import { VictoryLine } from 'victory-native'; export default function Graph() { return ( <View> <VictoryLine /> </View> ) }