Expo: Change default IOS simulator

React NativeExpo

React Native Problem Overview


I am new in expo and react-native Whenever i run the app from IOS simulator (inside expo) it always boots up the IphoneX. If i need to change the simulator,I have to open it through Xcode, is there any way we can change the default simulator ?

React Native Solutions


Solution 1 - React Native

expo included an option in recent commits regarding this issue.

now you can tap shift+i on terminal which expo server is running.It will list all simulators and you need to select your choice.

https://github.com/expo/expo-cli/pull/2541

Solution 2 - React Native

Currently there is no way of changing the simulator from Expo. Expo just uses the last opened simulator in Xcode.

If that doesn't work, try this (updated here from my comment) :

  1. When the simulator is open click on Hardware>Device> Select the other iphone.

  2. Now both will be open. Next exit the simulator from the dock.

  3. Now try and open your project in the ios simulator from expo. It should open in the Simulator you selected from the hardware menu.

Solution 3 - React Native

This worked for me on Feb 2021

on Mac OS with Big sur, expo v4.1.6

  1. Clean your EXPO cache with expo start -c (on your project location)
  2. In the expo terminal press shift + i (see screenshot below)

List item

  1. Then press shift + i and you should be able to select the Simulator by pressing enter on the one you need (see screnshot)enter image description here

lastly Just wanted to share all the available options if you just press i in the metro terminal window.

enter image description here

Solution 4 - React Native

It is possible, but you can't target it from the command line. Expo will just target the last opened simulator.

  1. Click on Hardware > Device and choose the device you desire

  2. You now have two simulators open, make sure the one you want is active.

  3. Now quit the simulator app with Command + Q

  4. Now in your command line, when running the expo server, just click i

  5. The simulator will open with your targeted device.

Solution 5 - React Native

(As of December 3, 2020)

  1. Open Simulator
  2. Click on File ... (in the top-left menu bar)
  3. Click on Open Device ... (in the drop down list)
  4. Select your desired device and let it launch completely
  5. Quit Simulator ... (command + Q)
  6. Done

Running your app on iOS Simulator will automatically launch to this desired device now =)

Solution 6 - React Native

Change the open iOS simulator device(s), and Expo will use it.

Expo directs its output to the open iOS simulator, so this must be done in the simulator itself rather than in Expo. It is simple to do. You can direct expo output to different devices. Here's how. BTW, other approaches described here didn't work when I tried them.

Open a second simulator in iOS Simulator by:

  1. select eg Simulator->Hardware->Device->iOS12.1->iPhone 8

  2. Select the simulator that you don't want to use (eg the current default as of writing, iPhone XR). Press Command-W to close the simulator window, leaving the iPhone 8 simulator still running.

  3. In Expo, deploy the code to simulator as usual, either using the i at the command line, or selecting 'run on iOS Simulator' from the browser version of Expo.

  4. It is possible to get expo to display to more than one simulator that is running at once (eg to test rendering on multiple screen sizes). Once you get expo running on one device (steps 1-3), you can repeat on an additional device (or presumably more). Expo will then be running on multiple simulators. They will simultaneously display the output. When I change my code, it immediately updates to multiple simulators/screen sizes without requiring any additional steps. Haven't re-tested exactly the order of steps to do this most easily, but it's working.

Hope this works for you!

Solution 7 - React Native

You just need to open the desirable simulator through Xcode, and then just run: npm run ios
from your project directory or a similar command to start your app

Solution 8 - React Native

I believe that yarn passes unrecognized arguments through to react-native run-ios, so you should be able to pass --simulator="foo" as described here: https://facebook.github.io/react-native/docs/running-on-simulator-ios.

Solution 9 - React Native

I know the exact answer Once you open the Simulator from the Expo, go to Help menu and Search for "iphone11", "iphoneX" .... Then you should be fine

Solution 10 - React Native

Go to /Users/username/.expo/ios-simulator-app-cache/ and remove all files in there.

Run the ios simulator you want and run your expo project.

Solution 11 - React Native

Restarting the computer was the only thing that worked for me. Without it pressing "Shift+i" had no effect. Neither Expo client would be installed on new simulator instance.

This was on macOS and M1 MacBook Pro for me.

Solution 12 - React Native

Just launch simulator on which you want to run app and then run command i.e. "yarn run ios" or "npm run ios" to run on simulator. App will run on both simulator.

If it doesn't work then quit all simulator and then run the command i.e. "yarn run ios" or "npm run ios", then app automatically run on simulator which was latter launched.

Hope this may help you!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionHena ShiekhView Question on Stackoverflow
Solution 1 - React Nativevamshi krishnaView Answer on Stackoverflow
Solution 2 - React NativeVarun NathView Answer on Stackoverflow
Solution 3 - React NativeJonathan SanchezView Answer on Stackoverflow
Solution 4 - React NativeSabba KeynejadView Answer on Stackoverflow
Solution 5 - React NativeBennyTheNerdView Answer on Stackoverflow
Solution 6 - React Nativeuser2330237View Answer on Stackoverflow
Solution 7 - React NativeMAP Inc.View Answer on Stackoverflow
Solution 8 - React NativeTim KeatingView Answer on Stackoverflow
Solution 9 - React NativeGuvanchView Answer on Stackoverflow
Solution 10 - React NativeDerek YangView Answer on Stackoverflow
Solution 11 - React NativeMisha ReyzlinView Answer on Stackoverflow
Solution 12 - React NativeVibha ThakurView Answer on Stackoverflow