hongyin163 / react-native-chart-android

react native chart modules come from mpandroidchart.
206 stars 81 forks source link

render linechart will crash when more times #52

Open samuelltk opened 8 years ago

samuelltk commented 8 years ago

The app will crash when states change more times. please help me, thanks.

getRandomData(){ var data={}; data['xValues']=[]; data['yValues']=[ { data:[], label:'test1', config:{ color:'blue' } } ]; for (var i = 0; i < 50; i++) { data.xValues.push(i+''); data.yValues[0].data.push(Math.random()*100); }; return data; } componentDidMount() { var num=0; setInterval(() => { var datas=this.getRandomData(); this.setState({ randomDatas:datas }); }, 1000); } render() { return (

    );
}
hongyin163 commented 8 years ago

is there some exception log ?

samuelltk commented 8 years ago

10-27 23:09:21.858 15712-15762/com.myvictorytest A/libc: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x90cd005c in tid 15762 (mqt_js) 10-27 23:09:24.828 15712-15712/com.myvictorytest I/Choreographer: Skipped 170 frames! The application may be doing too much work on its main thread. @hongyin163

hongyin163 commented 8 years ago

how do you update your view?

samuelltk commented 8 years ago

@hongyin163 i update the state per 1 seconds, the render will be run, wait for a moment, my app will crash on android...i am use the Galaxy S4, 5.0.1....My code look on the top.

hongyin163 commented 8 years ago

时间间隔设置长一点呢? 或者使用setTimeout试试?