React-native-chart-kit: TypeError: TypeError: TypeError: undefined is not a function (evaluating 'data.entries()[typeof Symbol === "function" ? Symbol.iterator : "@@iterator"]()')

Created on 31 Jul 2018  路  9Comments  路  Source: indiespirit/react-native-chart-kit

Hi,

I am actually trying to display a pie chart in my react-native project, you can see my code below (exactly the same as the example)

<View style={{ padding: 20, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', }}> <PieChart data={[ { name: 'Toronto', population: 2800000 }, { name: 'Dublin', population: 527612 }, { name: 'New York', population: 8538000 }, { name: 'Beijing', population: 21500000 }, { name: 'Moscow', population: 11920000 } ]} width={Dimensions.get('window').width} height={220} chartConfig={{ backgroundGradientFrom: '#ccff33', backgroundGradientTo: '#ffff33', color: () =>#000 }} accessor="population" /> </View>

But i'm getting this error:
`TypeError: TypeError: TypeError: undefined is not a function (evaluating 'data.entries()typeof Symbol === "function" ? Symbol.iterator : "@@iterator"')

This error is located at:
in PieChart (at Home.js:17)
in RCTView (at View.js:60)
in View (at Home.js:15)
in RCTView (at View.js:60)
in View (at Home.js:14)
in Home (at SceneView.js:9)
in SceneView (at createTabNavigator.js:10)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:558)
in RCTView (at View.js:60)
in View (at createAnimatedComponent.js:154)
in AnimatedComponent (at BottomNavigation.js:543)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:527)
in RCTView (at View.js:60)
in View (at BottomNavigation.js:522)
in BottomNavigation (at withTheme.js:75)
in ThemeProvider (at withTheme.js:89)
in withTheme(BottomNavigation) (at createMaterialBottomTabNavigator.js:25)
in BottomNavigationView (at createTabNavigator.js:115)
in NavigationView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)

This error is located at:
in NavigationContainer (at SceneView.js:9)
in SceneView (at SwitchView.js:12)
in SwitchView (at createNavigator.js:57)
in Navigator (at createNavigationContainer.js:383)
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)

This error is located at:
in NavigationContainer (at App.js:34)
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)

  • node_modules\paths-js\pie.js:39:25 in
  • node_modules\react-native-chart-kit\src\pie-chart.js:18:22 in render
  • ... 18 more stack frames from framework internals
    `

I thought that was a problem with a function called data.entries() in the pie_chart.js code but it doesn't exist in it.

May I have some help please ? :)

Most helpful comment

@Hermanya Problem still occurs, even after importing 'core-js/features/object/entries'

All 9 comments

Same problem here.
It runs without hassle in ios though.

Also have the same problem, running the example code and it throws this error.

Seems to be working fine when Remote Debugger is attached , but fails without it

After lil bit of digging looks like the issue is with paths-js and related to for in loop polyfill breaking react-native 0.56.0 on android

See -> https://github.com/orionsoft/meteor-apollo-accounts/issues/73

@patrykwegrzyn is this resolved then?

@Hermanya Works for me , thanks man.

I have same problem after update babel to latest version.

path-js requires a polyfill. Try installing 'core-js' and importing 'core-js/features/object/entries'

@Hermanya Problem still occurs, even after importing 'core-js/features/object/entries'

Was this page helpful?
0 / 5 - 0 ratings