Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic issues with RN versions ≥ 0.72.x when using React UI libraries(MUI) inside Webview App #183

Closed
JJSLIoT opened this issue Jun 20, 2024 · 5 comments · Fixed by #193
Labels
help wanted Extra attention is needed

Comments

@JJSLIoT
Copy link

JJSLIoT commented Jun 20, 2024

Describe the bug
The react-native-react-bridge library used to work just fine on RN versions < 0.72.0. For older RN versions, I have to use 0.11.2 version of the rnrb library. After upgrading from RN 71 to RN 72, I started facing very cryptic errors, but the errors seem to originate from @mui/material library that is used inside the React app running in Webview. The issue might not be limited to @mui/material library but may occur on other vast React libraries. Here is the exact error that I get when I use any MUI component in the provided DemoApp:

 ERROR  ReferenceError: Property 'zh' doesn't exist, js engine: hermes 
    at ContextNavigator (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:143683:24)
    at ExpoRoot (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:143639:28)
    at App
    at ErrorToastContainer (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:187845:24)
    at ErrorOverlay
    at withDevTools(ErrorOverlay) (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:187348:27)
    at RCTView
    at View (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:40757:43)
    at RCTView
    at View (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:40757:43)
    at AppContainer (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:40600:25)
    at main(RootComponent) (http://192.168.1.3:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=true&transform.routerRoot=app:118930:28)

Screenshot

Simulator Screenshot - iPhone 15 Pro
-

To Reproduce
To reproduce this issue I was able to create a minimum reproducible app. Here are the links to the public repos:

Both these repos have the same code just the versions of RN, expo and react-native-react-bridge are different.

Expected behavior
The library should work fine like it used to work before - using older RN versions and react-native-react-bridge version < 0.12.0.

Platform:

  • Version of [react-native, expo]: react-native ≥ 0.72.0, expo ≥ 49
  • Version of this package: 0.12.0
  • OS: iOS and Android both
  • Running on: Device and Simulator both
  • JavaScript engine: Hermes

Additional context
The new version app works fine if we comment out MUI components from the code. For this, I have added a comment in WebApp/index.jsx file:

{/* FIXME: None of the components from @mui/material work when used inside
the Webview React app. When this Box is removed, the app works just fine.
This issue started popping after React Native 0.72.x. Earlier to this version
the react-native-react-bridge had no issues rendering any component from 
@mui/material */}
@JJSLIoT JJSLIoT changed the title Very cryptic issues with newer react native versions >= 0.72.x when using React UI libraries Very cryptic issues with newer react native versions >= 0.72.x when using React UI libraries(MUI) inside Webview App Jun 20, 2024
@JJSLIoT JJSLIoT changed the title Very cryptic issues with newer react native versions >= 0.72.x when using React UI libraries(MUI) inside Webview App Cryptic issues with RN versions ≥ 0.72.x when using React UI libraries(MUI) inside Webview App Jun 20, 2024
@hichemfantar
Copy link

I also get this with three.js and expo-gl

@hichemfantar
Copy link

Did you create a custom build for the Old RN version project?
Because eas build fails to create a custom build and expo go sdk48 apk isn't working for me.

@inokawa inokawa added the help wanted Extra attention is needed label Jul 9, 2024
@aik117
Copy link

aik117 commented Jul 31, 2024

Any fix for this? I am also getting the same issue with different property with react-native version 0.74.3 and react-native-react-bridge version 0.12.0

@JJSLIoT
Copy link
Author

JJSLIoT commented Aug 12, 2024

Hi @inokawa, this is an awesome module, and we're really grateful for your work on it.

This issue is a blocker for our team and is preventing us from upgrading our React Native version beyond 71. Could we please get an update on this? Any pointers on potential reasons behind the issue would be greatly appreciated. We're eager to contribute, but at first glance, the source code seems beyond our expertise at the moment.

Thanks again for your hard work and for considering this request!

@ieow
Copy link
Contributor

ieow commented Sep 19, 2024

is it possible it is due to

Note that Hermes currently does not fully implement the ES6 spec. esbuild, on the other hand, does not fully support lowering to ES5. This essentially means that you may have to add additional plugins if you're seeing esbuild outputting "target environment is not supported yet" errors during bundle. For an example, see the error and its solution in #1743.

https://www.npmjs.com/package/@rnx-kit/metro-serializer-esbuild

microsoft/rnx-kit#1743

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants