Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(onShouldStartLoadWithRequest): android event was missing fields (#…
…385) `onShouldStartLoadWithRequest` event had only `url` in payload on android. I've fixed it according to js event definition. https://github.com/react-native-community/react-native-webview/blob/master/js/WebViewTypes.js#L34
- Loading branch information
Showing
3 changed files
with
34 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 0 additions & 40 deletions
40
...main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.java
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
...c/main/java/com/reactnativecommunity/webview/events/TopShouldStartLoadWithRequestEvent.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.reactnativecommunity.webview.events | ||
|
||
import com.facebook.react.bridge.WritableMap | ||
import com.facebook.react.uimanager.events.Event | ||
import com.facebook.react.uimanager.events.RCTEventEmitter | ||
|
||
/** | ||
* 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) | ||
} |