Closed cstpraveen closed 6 years ago
@cstpraveen You can't use methods in this module like you do. You need to use window.postMessage() in highchart config, when you need fire action and onMessage={this.onMessage} in module props.
<ChartView
style={{ height: 200, opacity }}
config={config}
options={options}
onMessage={this.onMessage}
/>
events: {
click: () => {
window.postMessage(JSON.stringify({ type: 'click', x: this.x }));
}
}
onMessage()
onMessage = (event: NativeEventType) => {
const data = JSON.parse(event.nativeEvent.data);
if (data.type === 'click') {
this.setState({ value: data.x });
}
}
It's not a better way, but enough for you situation
@OverVlad It works like a charm.
It seems window.postMessage
is the only solution. As because they are used webview. And also onemore thing here is that it won't post message if the path is "/web"
we need to change the webview path as http://localhost
.
@cstpraveen for me it's work with /web
path too
For me it is not working if I use /web
as path.
Hi here is my component.
When I try to call
getSingleData
the method is not calling.