I'm starting with react-native and I'm getting this problem: I can't log to bundler metro server.
If I create my application using create-react-native-app
, I can do 'console.log' and value are logged to metro bundler (running on port 8081).
But if I create my application with react-native init <project>
, this doesn't work. To make console.log
work, I need to open Chrome DevTools and set remote debug in application.
So my question is: is there any way to make native code to log in bundler console with console.log? I don't want to work with 'create-react-native-app' because it uses Expo and 'realm' database doesn't support expo.
I've tried with react-native 0.55.4 and 0.56, both in windows and linux.
You can also see the console.log() outputs using these commands:
$ react-native log-android
$ react-native log-ios
Note: It also works to debug native errors, for example when you have a blank screen and metro bundler doesn't show errors neither.
For more information you can check this out
Don't know if I correctly understand your question (because of my english), but you can try this:
Run adb logcat *:S ReactNative:V ReactNativeJS:V in a terminal to see your Android app's logs.
Taken from Using adb logcat for React Native Debugging
I discovered that console.log are omitted from console log if your disable remote debug from the debug menu
You can download React Native Debugger and Open your JS Debugger in development menu. You can see everything into RN Debugger.
On Mac. While on ios simulator Clicked on
Command-d->Stop Debugging
.This made logging work for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With