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 33 forks source link

[feature] add props "webViewStyle", support setting the style of WebView component. #56

Closed congshengwu closed 2 years ago

congshengwu commented 2 years ago

Summary

It's a little change of this PR. Add a new props webViewStyle for RNEChartsPro to support customizing WebView style. Similar to the props webViewSettings. If I set style via webViewSettings which will cover the default style from source code, I don't think it's a good choice.

I meet a crash issue which is most likely from react-native-webview, and setting opacity: 0.99 of its style will resolve the crash issue. That's why I need this PR to change the style of WebView inside the RNEChartsPro.

Besides, I think maybe users will have other needs to set the style of WebView in the future.

Test plan

Pass style like opacity: 0.2 in webViewStyle

<RNEChartsPro
  width="100%"
  height={300}
  webViewStyle={{ opacity: 0.2 }}
  option={{
    xAxis: {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: [150, 230, 224, 218, 135, 147, 260],
        type: 'line'
      }
    ]
  }}
/>

Compatibility

Android and iOS.

supervons commented 2 years ago

Thanks for your PR, test pass!

I think it's a reasonable scenario.

The next version will be released