Open AlenToma opened 2 years ago
Possible duplicate of https://github.com/facebook/hermes/issues/612
Possible duplicate of #612
It is not the same as it is not working no matter how many time i do changes to a file or reload.
If you have a problem duplicating the problem, I could upload my project and remove all code from it.
This problem happened when you update an old project to a new one.
When I created a new expo bare project the debugging work somehow.
For those of you wondering, I just tried reproducing this problem on React Native 0.71.3 and it is no longer valid on Android, but I am experiencing the issue on iOS.
My basic reproduction scenario:
const testFunction = () => {
'show source';
Alert.alert('Hello world!!');
}
function App(): JSX.Element {
const isDarkMode = useColorScheme() === 'dark';
const showAlert = useCallback(() => {
console.log(testFunction.toString());
testFunction();
}, []);
....
This implementation logs the following to the console regardless of weather I am in debug or release modes using Hermes engine:
function testFunction() {
'show source';
_reactNative.Alert.alert('Hello world!!');
}
The same issue. For me, it works normally in release. However, it won't work after downloading a new js bundle using code push
, which causes my echarts
tooptip using formatter
function does not show as expected. Any fix for that?
@lchenfox
I also use the formatter
function in Echarts
, I have been watching this issue for a long time and also subscribed to this issue thread for a long time.
Finally, I have found two solutions:
Use this library wuba/react-native-echarts to render Echarts. It's not a WebView-based solution, so there will be no issue caused by bytecode conversion as there is no WebView needed.
Use this library react-native-echarts-pro(1.9.0-beta.0) or td-design/react-native-echarts. They both support using the formatter
function in string format and converting the string format function back to a real function in the WebView environment. Then there will be no bytecode conversion issue, and working for both debug and release mode.
@lchenfox I also use the
formatter
function inEcharts
, I have been watching this issue for a long time and also subscribed to this issue thread for a long time.Finally, I have found two solutions:
- Use this library wuba/react-native-echarts to render Echarts. It's not a WebView-based solution, so there will be no issue caused by bytecode conversion as there is no WebView needed.
- Use this library react-native-echarts-pro(1.9.0-beta.0) or td-design/react-native-echarts. They both support using the
formatter
function in string format and converting the string format function back to a real function in the WebView environment. Then there will be no bytecode conversion issue, and working for both debug and release mode.
Thank u so much. I'll have a try on that. Hope it works after downloading and installing a new patch package using react-native-code-push
.
@congshengwu Unfortunately, I tried react-native-echarts-pro as you said above. It does not work with react-native-code-push
. See the issue link I made Function toString does not behave the same with hermes turned on #114
I also have almost the exact same problem (using highcharts instead of echarts) I found a bad work around (emphasis on the work) for this in the mean time. while running the expo metro build, if you modify and save the file(s) with the formatter function it will for some reason re-bundle correctly (I.E without the "[bytecode]" result)
I already commented about this om https://github.com/facebook/hermes/issues/114 . Copying it here for visibility:
In order to identify whether this is a problem in Hermes, we need to be able to examine the input given to Hermes. Unfortunately we can't help debug parts of the build pipeline that happen before Hermes. It is quite possible that the "show source" annotation is stripped before it gets to the Hermes compiler, for example by a minifier.
Bug Description
I recently Upgraded react-native to 0.68.2 and decided to use hermes.
as I have some library that uses
function toString
, then I decided to implementshow source
to those files it needed.Now this is not the problem. The problem is that it is impossible to debug my app eg running
react-native run-android
as theshow source
do not work.it works fine when running
react-native run-android --variant=release
and everything works as expected.Is there is reason or settings I am missing ?
gradle clean
and confirmed this bug does not occur with JSCHermes version: 0.11.0 React Native version (if any): 0.68.2 OS version (if any): android 30 Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): armeabi-v7a (not sure) it is an emulator using genymotion
Steps To Reproduce
The Expected Behavior
Should show the source code instead I am getting [bytecode]
I will also post my package.json as I think that it has something to do with it.