React native application when run from terminal cannot debug in safari - react-native

When React native application is run from terminal using
npx react-native run-ios
Cannot debug webview from safari. Safari develop menu does not show the simulator in the devices .

I could not debug the application in safari when run using command
npx react-native run-ios.
But when I tried running the application using Xcode ,simulator was available in
safari develop menu. To debug your web url you need to go to
safari>develop>simulator name> web url

Related

React Native App Crashing when opening React Native Developer Tools

I have Custom Development Client App build with EAS and it is always crashing when I try to open React Native Debbuger without any log.
Steps to reproduce:
eas build --profile development --platform android
Start Emulator and download build from link produced in step 1. Open the App.
expo start --dev-client
Press a │ open Android
Press m │ toggle menu
Press "Debug Remote JS" on device/emulator
React Native Debugger opens in th browser but app is crashing and does it everytime I try to open it again.
Same thing happens on the physical device.
React Native application might be using a library that uses JSI, e.g React Native Reanimated 2 (https://docs.swmansion.com/react-native-reanimated/docs/#known-problems-and-limitations) or React Native MMKV (https://github.com/mrousavy/react-native-mmkv#limitations).
With these libraries, remote debugging won't execute properly. I'd start on checking of known limitations on your project's 3rd party libs.
I noticed that connecting expo-dev-client via localhost automatically crashes the app.
Try to use LAN network and make sure that your device and computer are on the same network.

APK of react-native app shows blank screen

I have built a react-native app which works perfectly fine in development, but when I generate the APK with expo build:android, it doesn't work. If I load the app on my android device, the splash screen is displayed for a few moments and then it just shows a blank screen. I am unsure how to check what the error is when using the apk. How do I do so?
The issue could be with the SDK version. Check your device API level and the SDK version your building with.
You could set up a ADB (Android Debug Bridge) and install the apk onto a device/emulator. There you have a number of options for debugging.
Edit:
If there isn't any android specific code that uses the API then you can ignore what I said before.
Uninstall the app on your device. Settings > Apps > [Your App] > Uninstall
In your development run 'expo start'
If dev is working, then run 'expo start --no-dev --minify'
If that works then you can build 'expo build:android'
Install apk on your device || with ADB preferably
Information need for further troubleshooting:-
Device Version [Found on device Settings>System>About]
Expo SDK [Found in app.json]
ADB logs

React Native Expo app - unable to open app in iOS emulator

I want to run my React Native app in the iOS emulator. Here is what I done so far:
I installed XCode, along with its command line tools, and can bring up the emulator without issue.
I created an empty React Native app using the Expo CLI, per the instructions here. https://facebook.github.io/react-native/docs/getting-started. I am running on Node v10.0.0 on a Mac.
Afterwards I install all the necessary dependencies.
I then run "sudo npm run ios". This fires up the Metro Bundler as well as the iOS simulator. The Simulator loads up after about 5 minutes of waiting, but my app does not start up.
What am I missing here?
I should note that I prefer to stick with Expo, so I'd prefer not to have to eject.

How can I install a React Native app without releasing it to any store?

I wanna be able to use my app on my iPhone or my Android phone without the need of releasing it to App Store or Google Play Store.
or just use EXPO tools if you are open to using expo development environment for react native
If your project is based on React-Native-CLI and your development environment is all set-up then just run command 'react-native run-android' in the terminal. It will generate a debug apk file which you can be found in the directory:
android > app > build > outputs > apk > debug > app-debug.apk
You can directly install this debug apk in your android phone by connecting the device in the debugging mode and run the above command!
In Xcode, add your Apple ID to Accounts preferences, described in
Adding Your Apple ID Account in Xcode.
In the project navigator, select the project and your target to
display the project editor.
Click General and choose your name from the Team pop-up menu.
Connect the device to your Mac and choose your device from the Scheme
toolbar menu.
Below the Team pop-up menu, click Fix Issue.
Xcode creates a free provisioning profile for you and the warning text
under the Team pop-up menu disappears.
Click the Run button.
Xcode installs the app on the device before launching the app.
Test iOS app on device without apple developer program or jailbreak
For IOS you must have a developer account firstly. And then, you can send your app to itunesconnect and get the app from testflight. Or You can run your ios app on device by using cable. But you dont run your app in developer mode.
For android you just need get the apk from android studio. But some steps there are. Follow this steps for get the apk.
How can I generate an apk that can run without server with react-native?
You can Side load your react native app in iPhone or iPad using Xcode
Open your_projectname.xcworkspace from ios folder in Xcode
XCode - Choose your destination device simulator or device from
Product -> Destination -> Select the device
Create a Temporary provision profile From project Target -> Signing
& Capabilities (Required only for physical device, for simulator don't
require this)
Build and Run your project
React Native's official site has a guide on how to install your app without releasing it.
The tl;dr is as follows:
For ios:
cd AwesomeProject
react-native run-ios
For android:
cd AwesomeProject
react-native run-android

console.log doesn't work with react-native

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
You can download React Native Debugger and Open your JS Debugger in development menu. You can see everything into RN Debugger.
I discovered that console.log are omitted from console log if your disable remote debug from the debug menu
On Mac. While on ios simulator Clicked on
Command-d->Stop Debugging
.This made logging work for me.