mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-09-01 12:11:07 +00:00
fix(android): onMessage on android to return baseEvent(#755)
This commit is contained in:
committed by
Thibault Malbranche
parent
cc17e65904
commit
282f81dcdd
@@ -915,7 +915,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
||||
}
|
||||
|
||||
public void onMessage(String message) {
|
||||
dispatchEvent(this, new TopMessageEvent(this.getId(), message));
|
||||
if (mRNCWebViewClient != null) {
|
||||
WebView webView = this;
|
||||
webView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WritableMap data = mRNCWebViewClient.createWebViewEvent(webView, webView.getUrl());
|
||||
data.putString("data", message);
|
||||
dispatchEvent(webView, new TopMessageEvent(webView.getId(), data));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
WritableMap eventData = Arguments.createMap();
|
||||
eventData.putString("data", message);
|
||||
dispatchEvent(this, new TopMessageEvent(this.getId(), eventData));
|
||||
}
|
||||
}
|
||||
|
||||
protected void onScrollChanged(int x, int y, int oldX, int oldY) {
|
||||
|
||||
Reference in New Issue
Block a user