Skip to content

Commit ebf1813

Browse files
committed
Add onRenderProcessGone
1 parent 87c091d commit ebf1813

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

Diff for: README.md

+7
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,13 @@ Specifies function to be invoked when the WebView starts or ends loading.
660660

661661
Note that this method will not be invoked on hash URL changes (e.g. from https://example.com/users#list to https://example.com/users#help). A workaround may be found in the [Guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#intercepting-hash-url-changes).
662662

663+
#### `onRenderProcessGone: WebViewRenderProcessGone.t => unit`
664+
665+
_Android only_
666+
Function that is invoked when the `WebView` process crashes or is killed by the OS.
667+
668+
<https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#onRenderProcessGone>
669+
663670
#### `onShouldStartLoadWithRequest: Js.t(webViewShouldStartLoadWithRequest) => bool`
664671

665672
Allows custom handling of any `WebView` requests. Specified function should return `true` to allow requests and `false` to stop loading.

Diff for: src/ReactNativeWebView.bs.js

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ var WebViewProgressEvent = {};
3232

3333
Event$ReactNative.SyntheticEvent({});
3434

35+
var WebViewRenderProcessGone = {};
36+
37+
Event$ReactNative.SyntheticEvent({});
38+
3539
var WebViewTerminatedEvent = {};
3640

3741
var UnionCallback = ReactNativeWebView_UnionCallback.Make({});
@@ -52,6 +56,7 @@ exports.WebViewHttpErrorEvent = WebViewHttpErrorEvent;
5256
exports.WebViewMessageEvent = WebViewMessageEvent;
5357
exports.WebViewNavigationEvent = WebViewNavigationEvent;
5458
exports.WebViewProgressEvent = WebViewProgressEvent;
59+
exports.WebViewRenderProcessGone = WebViewRenderProcessGone;
5560
exports.WebViewTerminatedEvent = WebViewTerminatedEvent;
5661
exports.UnionCallback = UnionCallback;
5762
/* Not a pure module */

Diff for: src/ReactNativeWebView.re

+7
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ module WebViewProgressEvent = {
125125
type _payload = payload;
126126
});
127127
};
128+
module WebViewRenderProcessGone = {
129+
type payload = {didCrash: bool};
130+
include Event.SyntheticEvent({
131+
type _payload = payload;
132+
});
133+
};
128134
module WebViewTerminatedEvent = {
129135
type payload = Js.t(webViewNativeEvent);
130136
include Event.SyntheticEvent({
@@ -210,6 +216,7 @@ external make:
210216
~onLoadStart: WebViewNavigationEvent.t => unit=?,
211217
~onMessage: WebViewMessageEvent.t => unit=?,
212218
~onNavigationStateChange: Js.t(webViewNavigation) => unit=?,
219+
~onRenderProcessGone: WebViewRenderProcessGone.t => unit=?,
213220
~onShouldStartLoadWithRequest: Js.t(webViewShouldStartLoadWithRequest) =>
214221
bool
215222
=?,

0 commit comments

Comments
 (0)