Unable to do any other action than “alert” when triggering the click event on Highcharts (React Native)

前端 未结 2 1995
借酒劲吻你
借酒劲吻你 2021-01-26 14:15
  • Im using Highcharts in React Native
  • For a bar chart I have the following click event defined:

    plotOptions: {
              series: {
                           
    
    
            
2条回答
  •  感动是毒
    2021-01-26 14:43

    Only alert supports since Highcharts is rendering inside Webview. so for this

    let data = "ClickedWebView" ;
    
    • Any message it could be * Note : window.postMessage will not work . WebView version > 5 gives us this modified function,

    write the following code in config as

    plotOptions: {
          series: {
              point: {
                  events: {
                      click: function() {
                       window.ReactNativeWebView.postMessage(data);
                      }
                  }
              }
          }
        }
    

    in ChartView Code Code would be

     this.onMessage(m)} options={options}>
    

    can write custom message function as

    onMessage = (message) => { 
       console.log(message.nativeEvent.data)
    }
    

提交回复
热议问题