Skip to content
Browse files

fix(onShouldStartLoadWithRequest): android event was missing fields (#…


`onShouldStartLoadWithRequest` event had only `url` in payload on android.
I've fixed it according to js event definition.
  • Loading branch information...
punksta authored and Titozzz committed Mar 13, 2019
1 parent 455e22e commit a25997bf65196d3dad857cb07ab8ae89f7a34407
@@ -159,16 +159,20 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {

public boolean shouldOverrideUrlLoading(WebView view, String url) {
dispatchEvent(view, new TopShouldStartLoadWithRequestEvent(view.getId(), url));
new TopShouldStartLoadWithRequestEvent(
createWebViewEvent(view, url)));
return true;

public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
dispatchEvent(view, new TopShouldStartLoadWithRequestEvent(view.getId(), request.getUrl().toString()));
return true;
final String url = request.getUrl().toString();
return this.shouldOverrideUrlLoading(view, url);


This file was deleted.

@@ -0,0 +1,27 @@

import com.facebook.react.bridge.WritableMap

* Event emitted when shouldOverrideUrlLoading is called
class TopShouldStartLoadWithRequestEvent(viewId: Int, private val mData: WritableMap) : Event<TopShouldStartLoadWithRequestEvent>(viewId) {
companion object {
const val EVENT_NAME = "topShouldStartLoadWithRequest"

init {
mData.putString("navigationType", "other")

override fun getEventName(): String = EVENT_NAME

override fun canCoalesce(): Boolean = false

override fun getCoalescingKey(): Short = 0

override fun dispatch(rctEventEmitter: RCTEventEmitter) =
rctEventEmitter.receiveEvent(viewTag, EVENT_NAME, mData)

0 comments on commit a25997b

Please sign in to comment.
You can’t perform that action at this time.