supervons / react-native-echarts-pro

A React-Native charts based on Apache ECharts, support various charts and map.
https://supervons.github.io/react-native-echarts-pro-docs/
MIT License
216 stars 32 forks source link

小米手机使用时程序崩溃 #87

Closed lzjchina closed 1 year ago

lzjchina commented 1 year ago

import React, {useEffect, useRef, useState} from "react"; import {StyleSheet, Text, View} from "react-native"; import ECharts from "react-native-echarts-pro";

const LineChart = (props) => {

const chartRef = useRef(null);
const option = {
    backgroundColor: "white",
    title: [], //
    legend: {
        data: [],
        show: true,
        z: 3,
        icon: "roundRect",
        bottom: 15,
        itemWidth: 8,
        itemHeight: 8,
        textStyle: {
            fontSize: 10,
            color: 'gray'
        }
    },
    color: [
        "#0ac860",
        "#ed3333",
        "#2fa4ed",
        "#9e5ed9",
        "#00b0a7",
        "#ed3472",
        "#4878f9",
    ],
    tooltip: {
        trigger: "axis",

        axisPointer: {
            animation: false,
        },

    },
    xAxis: [{
        type: "time",
        splitLine: {
            show: true,
        },
        axisLine: {
            show: false,
        },
        axisTick: {
            show: false,
            interval: 3,
        },
        // maxInterval: 3 * 60 * 60 * 1000,
        axisLabel: {
            // 显示最大值和最小值
            showMinLabel: true,
            showMaxLabel: true,
            fontSize: 10,
            formatter: '{HH}:{mm}',
        },
    }],
    yAxis: [{}],
    series: [{
        name: "",
        type: "line",
        showSymbol: false,
        data: [],
        itemStyle: { normal: { opacity: 0 } },
        lineStyle: { normal: { opacity: 0 } },
        tooltip: {
            show: false,
            axisPointer: {
                type: "none",
            },
        },
    }],
}

return (
    <View style={{backgroundColor: 'white'}}>
        <ECharts
          ref={chartRef}
          option={option}
          height={300}
        />

    </View>
);

}

const styles = StyleSheet.create({ });

export default LineChart

supervons commented 1 year ago

请先参考下 issue 规范:https://github.com/supervons/react-native-echarts-pro/issues/6 提供下必要信息。

supervons commented 1 year ago

目前有发现 WebviewandroidHardwareAccelerationDisabled={true} 属性开启会导致部分机型闪退,可以去掉代码里的这行试一下。 文件位置:src/components/Echarts/index.js Line 160.