react-native-webview / react-native-webview

React Native Cross-Platform WebView
https://github.com/react-native-community/discussions-and-proposals/pull/3
MIT License
6.32k stars 2.96k forks source link

🟥 BUG NEED HELP -------- > IOS Crashed when using webview and Modal #3345

Closed Martin2037 closed 2 months ago

Martin2037 commented 3 months ago

Bug description: react-native-webview + modal = crash example:

  1. react-native-webview + web3Modal
  2. react-native-webview + react-native-actions-sheet

To Reproduce: https://github.com/Martin2037/rn-modal-crash

Expected behavior: Do not crash

Screenshots/Videos: e74b3cd0-1ed8-4153-9714-359fa0dead23 Environment:

Just run the following commands to reproduce this weird bug.👇 cd ios RCT_NEW_ARCH_ENABLED=1 bundle exec pod install

After that, start up the project again. It'll compile just fine, no errors. But as soon as you click the button to open the modal, bam! The whole thing crashes.

Martin2037 commented 3 months ago

update: I think the supportedOrientations is the main reason?

Nalymoslih commented 3 months ago

Any update ?

Martin2037 commented 3 months ago

Any update ? 任何更新 ?

No updates yet, bro... I've been actively looking for a solution. I've checked all the source code about modal in webview, but I think the code is fine, so I'm guessing it's a problem with react-native?.....

Martin2037 commented 3 months ago

@Titozzz

hramos commented 3 months ago

The sample repo that you provided does not use react-native-webview at all, other than declaring it as a node dependency.

Martin2037 commented 3 months ago

The sample repo that you provided does not use react-native-webview at all, other than declaring it as a node dependency.

This is the weirdest thing - as soon as I install react-native-webview and open a modal, it crashed. And get this, I haven't even declared a webview in my code!

hramos commented 3 months ago

Since it is not being used, it's unlikely that RNW itself is the culprit, but rather might be an issue in a particular version of some other common dependency between RNW and another of your installed packages.

Compare your yarn.lock or package-lock.json before and after installing react-native-webview, and see which other dependencies are being pulled in. That may give you a clue as to which package might be leading to your troubles with the modal.

ignaciosantise commented 3 months ago

Hi @hramos thanks for the insight!

Im using yarn, and there's no big differences in the dependencies after installing react-native-webview:

  1. escape-string-regexp@2.0.0

    Screenshot 2024-03-11 at 15 26 28
  2. invariant@2.2.4

    Screenshot 2024-03-11 at 15 26 33
  3. react-native-webview

    Screenshot 2024-03-11 at 15 26 40

Those are all the differences before - after installing 🤔

netmaxt3r commented 2 months ago

root cause of this issue is a bug in codegen in new architecture for more details see rn-issue. for now only hope for you is disable new architecture .

@titozzz @jamonholmgren this is not a react-native-webview bug, can we close this citing the upstream issue