Skip to content

Commit f95153e

Browse files
DracoBluefacebook-github-bot
authored andcommitted
Loading-State when reloading Android WebView
Summary: This commit enables state WebViewState before triggering reload on WebView. This will (if defined) trigger the loading screen again. On iOS the LoadingIndicator will be called whenever you reload the WebView. On Android this feature is missing (see #11013). This PR adds this behaviour. Important: One might think that "onLoadStart" is the right area to add this code, but on Android onLoadStart will also trigger for sub-resources -> the loading screen will also appear when loading iframes on the same page. I expect thats why this was not added in first place. (Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!) Closes #15538 Differential Revision: D5653257 Pulled By: hramos fbshipit-source-id: 908b82ddaf2c34048bcb833bc07e03ab68d09467
1 parent 0d3039f commit f95153e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Libraries/Components/WebView/WebView.android.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ class WebView extends React.Component {
313313
};
314314

315315
reload = () => {
316+
this.setState({
317+
viewState: WebViewState.LOADING
318+
});
316319
UIManager.dispatchViewManagerCommand(
317320
this.getWebViewHandle(),
318321
UIManager.RCTWebView.Commands.reload,

0 commit comments

Comments
 (0)