Switching between Expo Apps Running on Android Emulator - react-native

I am sorry for the trivial question!
While testing an Expo (react-native) app on Android Emulator, I need to switch to other apps, e.g. to the Contacts Manager to add a contact. Then, I need to go back to the Expo app to test something. How can I do that?
I tried the following.
Start the Expo app and play with it
Press the Home button
Start Contacts Manager
I could NOT find a way to start the Expo app again. I found an Expo icon in the list of apps. When I clicked on it, a screen with everything disabled, except "Open from Clipboard" appeared. The "Open from Clipboard" option seems to be for switching between different Expo apps. Anyway, when I clicked on it, I got the following error message.
Something went wrong. Could not load exp://switching/%20between%20Expo%20apps%20running%20on%20Android%20Emulator.
Environment:
Expo: 32.0.0
Android Emulator: API: 25 - Android 7.1.1 x86 - Nexus S
Thank you for your effort and time to help...

Are you using a connection localhost? if yes, on the terminal, try to press 'a'.

Related

Issue when building react-native app vie expo

I try to build react-native expo project..
!!! WORKING PERFECTLY ON SIMULATORS BOTH ANDROID AND IOS BUT NOT ON REAL DEVICE !!!
1.with eas build: -- when I download the builded .apk on a real device doesn't want to fetch any information I have error handling with alert ! And only the alert is showing
2.With expo build:android .. builds 20 minutes it says the build fails but still produce downloadable .apk when I download it on a real device now fetching works and we come to the point where the user must press a button and give permission to location to navigate to other screen where is map with directions from Google Directions API, but when you press the button and give permission its like the app freezes and won't navigate to the other screen...
ANY IDEAS ?

Hot reload using EAS

About a year ago, when I was using Expo to build react native apps, there were :-
hot reload
hosting to Expo build site, from where testers could download by scanning the QR code
run time errors display on emulator or connected device
When I revisited the app after a break of 1 year, I see that Expo is migrating to EAS (Expo Application Services). So, I ejected from Expo, and use 'eas build' .
Now I build using 'preview' profile, download the '.apk' from the EAS build site, drag it onto Android Emulator to test.
However, I don't see the above facilities of 'hot reload' and 'uploading to an Expo site for testers to download', or 'run time errors display on connected device'.
What is the alternative ? Should I go back to using react-native build ?
It a little easier to answer your question if there is only one question šŸ™‚
However, I don't see the above facilities of 'hot reload' ..
Shaking the device should show a fast refresh option
..and 'uploading to an Expo site for testers to download'
You can use EAS updates together with the dev-client
eas update --branch testers --message "Feature A"
Shake device
"Go home"
Extensions
sign in (to an expo user that is connected to an organisation)
pick the updates to try out
or 'run time errors display on connected device'.
It should display the errors (it does that for me with the dev-client)
What is the alternative ? Should I go back to using react-native build ?
There aren't many great alternative to expo - perhaps "vanilla" React Native with some firebase features or Microsoft app center?
Hope this answer your question(s).

React Native iOS Debugging in Safari Missing on M1

I'm used to debugging my React Native (0.63.2) app using Safari's dev tools. I got an M1 Mac Mini last week and have since been unable to get the console or source tabs to show anything from the iOS simulator. Not sure if this is related to the new machine, or if I missed a setting. Any ideas?
I usually do Develop > Simulator > JSContents from Safari, and everything would show up fine. I can get logs in the terminal, but Safari's devtools are much easier to manage.
Installing and using the "Safari Technology Preview" from https://developer.apple.com/safari/download/ worked for me.

test run react native app on iphone

I've signed developer account in xcode.
I connected iphone to mac.
I pressed cmd+b and it show built successful
Then what? How to make the app appear on iphone?
You can always go the route of creating a dev server that is only accessed through your WiFi.
See the following:
https://facebook.github.io/react-native/docs/running-on-device.html
When you connect your device then xcode checks if it's version matches with the device and if it matches then you just need to run the application from xcode by clicking the play button or CTRL+b. Then npm package runs through terminal and finally if the build is successful, the application automatically start running on your device.
Please have a look at the documentation: https://reactnative.dev/docs/running-on-device
If you followed the steps on the React Native website, you will be able to do the following commands on the command line
first, cd to your project directory like this:
cd MyApp
then, once you are in the same directory as your app, start the app with the following command,:
react-native run-ios
This should do it, if not, it will tell you what you are missing.
UPDATE:
I didn't realize it was specific to a real device, in that case, just press the Play button on the top left, pressing Cmd + B just builds the app, press Cmd + R to run.

React Native debug

Iā€™m doing a React Native project. It has a bug.
The bug make the APP just exit(it can functional run a while, but suddenly...just gone). So it dose not report error. How can I find out where the problem is?
My APP used react-native-bluetooth-serial.
My code on Github
Are you running it on you simulator.
If that is so you have to use real device for testing it as simulators do not have access to bluetooth peripherals.
Hope this helps.
You can use Genymotion or real device to use bluetooth enabled app. To test your bug you can also use "Debug JS remotely" feature of react native dev tools.
To enable dev tools in your real device, shake your device and dev menu will appear. In emulator you can press Ctrl + M to enable dev menu. then you can choose "Debug JS remotely" which will open in chrome. If you are familiar with web development then you might have used "Inspect element" feature which will open dev tools.
The answers are right. You might be using a simulator which doesn't support bluetooth.
To know more about the crash you can check the logs natively. For android just run this inside your android folder
adb logcat
Or you can use
react-native log-ios
react-native log-android