Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

open iOS iPad simulator with React Native by default

By default, simulator is iPhone when you test React Native app. I know there is the --simulator flag :

react-native run-ios --simulator 'iPad 2'

Ok, but how to simulate ipad by default without this flag...

Thank you !

like image 701
dotMastaz Avatar asked Jul 06 '16 15:07

dotMastaz


People also ask

How do I open iOS simulator in React Native?

You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone 13" . If you wish to run your app on an iPhone SE (2nd generation), run npx react-native run-ios --simulator="iPhone SE (2nd generation)" .

How do I run iOS real device in React Native?

The first thing to do is to connect your iOS device to your Mac with a USB cable. Open your react native app's directory, navigate to ios folder, and double-click on . xcworkspace file to open the Xcode. Next, open the Product menu, go to Destination, and select your device.


2 Answers

You could as well use "scripts" part of package.json:

"scripts": {
  "start": "node node_modules/react-native/local-cli/cli.js start",
  "ipad": "react-native run-ios --simulator 'iPad Air'"
}

And then run: npm run ipad

like image 50
Bohdan Ganicky Avatar answered Jan 12 '23 09:01

Bohdan Ganicky


You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone X". If you wish to run your app on an iPad Pro (9.7-inch), run

react-native run-ios --simulator="iPad Pro (9.7-inch)".

You can check all your available devices

xcrun simctl list devices

from the console. Refer this: https://facebook.github.io/react-native/docs/running-on-simulator-ios

like image 44
vendeeshwaran Chandran Avatar answered Jan 12 '23 09:01

vendeeshwaran Chandran