4

Im trying to run a basic React Native App using the Chart Kit library I get this error: CLICK FOR IMAGE: Exception thrown while executing UI block: __NSCFNumber firstObject: unrecognized selector sent to instance 0xa3576e305374b97e

Does someone know how to fix it?

This is my code:

import React from 'react';
import { View, StyleSheet } from 'react-native';
import { LineChart, Grid } from 'react-native-svg-charts';

class LineChartExample extends React.PureComponent {
  render() {
    const data = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80];

    return (
        <LineChart
            style={{ height: 200 }}
            data={data}
            svg={{ stroke: 'rgb(134, 65, 244)' }}
            contentInset={{ top: 20, bottom: 20 }}
        >
          <Grid />
        </LineChart>
    )
  }
}

export default LineChartExample;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
1

2 Answers 2

5

Fixed it!! I'm using Expo for my project and I used npm to install react-native-chart-kit and react-native-svg. For some reason using nmp I got the error but after uninstalling it and using "expo install", to install react-native-chart-kit again, everything worked just fine.

Sign up to request clarification or add additional context in comments.

Comments

2

I have the same issue, but did not solved using "expo install install react-native-chart-kit"

the issue continue

Exception thrown while executing UI block: __NSCFNumber firstObject: unrecognized selector sent to instance 0x9d7ca23b6657dd3d

EDITING: I solved my issue, steps:

1 - use CMD aways... create your expo-project and all dependences and library using CMD prompt comand windows... dont use PowerShell

2 - install react-native-svg-charts, react-native-chart-kit, react-native-svg-charts, using "expo instal ...." DON'T use yarn add or npm install

I hope this help everyone to create charts with expo....

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.