Importing a component into the entry React component causes dismount of the whole tree
See original GitHub issueHi @inokawa ! First of all wanted to say thank you for this awesome library! It’s quite cool, and very niche and I love it. I encountered one issue tho, maybe it’s a bug, maybe it’s intentional, either way I wanted to ask if you could provide a solution.
Your library works great when my React entry file is a single component, for example:
const Root = () => {
return <div>Hello</div>
}
export default renderWebView(<Root />)
But the moment I try to import another React component, let’s call it Test.js
, the result I get in the RN WebView is a blank page (I assume React dismounts the whole component tree due to some kind of error, although no error listeners on the WebView trigger).
How to replicate: Use the demo app, create another react component called Test.js
const Test = () => {
return <div>Test</div>
}
Try to import and render Test in our Root entry component like so:
import Test from './Test'
const Root = () => {
return <div>
Hello
<Test />
</div>
}
export default renderWebView(<Root />)
The result is an empty WebView in RN, without any error!
Could you try and think of a solution? I was thinking maybe I should wrap my Test
export in renderWebView
, but I’m not sure that is the right approach. I appreciate any input on this!
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@inokawa It works! The issue was the React import indeed. I cleared metro’s cache and build cache and rebuilt. Thanks!
Still an empty screen in my env.
The webview
onLoad
triggers, but still no errors.