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 !
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)" .
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.
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
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
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