question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[WebView] in >= 0.7 crashes if wraps by another component

See original GitHub issue

If WebView component in version 0.7 and above, wraps by another custom component, after couple of refreshes, crashes the react-native.

Here’s the code the sample code which causes crash after refresh the view couple of times.

'use strict';

var React = require('react-native');

var {
  AppRegistry,
  View,
  WebView,
  Component
} = React;

class CustomWebView extends Component {
  reload() {
    this.refs.internalWebView.reload();
  }
  render() {
    return (
      <WebView ref="internalWebView" {...this.props}/>
    );
  }
}

var Sample1 = React.createClass({
  componentDidMount() {
    this.refs.AWESOME.reload();
  },
  render: function() {
    var url = "http://google.com";
    return (
      <CustomWebView ref="AWESOME" url={url}/>
    );
  }
});

AppRegistry.registerComponent('Sample1', () => Sample1);

Here’s the error code

RCTWebViewManager.m:78
2015-07-15 15:29:12.885 Sample1[32006:13476976] *** 
Terminating app due to uncaught exception 'NSInternalInconsistencyException',
 reason: 'Invalid view returned from registry, expecting RKWebView, got: (null)'

So it seems that viewRegistry contains only RCTRootContentView and React.findNodeHandle(this.refs[RCT_WEBVIEW_REF]) returns a handler that doesn’t exists in viewRegistry.

** btw, It works perfectly fine on 0.6 **

Any thoughts?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mkonicekcommented, Apr 10, 2016

Hi there! This issue is being closed because it has been inactive for a while.

But don’t worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/webview-in-07-crashes-if-wraps-by-another-component

ProductPains helps the community prioritize the most important issues thanks to its voting feature. It is easy to use - just login with GitHub.

Also, if this issue is a bug, please consider sending a PR with a fix. We’re a small team and rely on the community for bug fixes of issues that don’t affect fb apps.

0reactions
CorpusCallosumcommented, Nov 20, 2015

I am getting the same issues when loading/unloading instances of the webview inside a ScrollView component.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android is crashing when "WebView" is wrapped by "View" #811
Using androidLayerType="software" solves the problem, but performance becomes horrible this way. Another workaround is to unmount the webview ...
Read more >
Here's how to fix those mysterious Android WebView crashes
Tap the three-dot menu at the top right of this screen, then select "Uninstall updates." This won't uninstall Android System WebView completely— ...
Read more >
WebView crashes on navigation popBackStack() with Jetpack ...
I have WebView inside the LazyColumn. It shows up fine. The thing is when I try to navigate back by calling navController.
Read more >
Secure Integration of Web Content and Applications on ...
The WebView class in Android and UIWebView/WKWebView class in iOS are UI widgets that display remote web ele- ments or entire web pages...
Read more >
BC3 change log - Scooter Software
Fixed crash when using "Up One Level on Both Sides" and the current base folders are filtered out in the parent comparison. -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found