React Native Change Default iOS Simulator Device
Specify a simulator using the --simulator
flag.
These are the available devices for iOS 14.0 onwards:
npx react-native run-ios --simulator="iPhone 8"
npx react-native run-ios --simulator="iPhone 8 Plus"
npx react-native run-ios --simulator="iPhone 11"
npx react-native run-ios --simulator="iPhone 11 Pro"
npx react-native run-ios --simulator="iPhone 11 Pro Max"
npx react-native run-ios --simulator="iPhone SE (2nd generation)"
npx react-native run-ios --simulator="iPhone 12 mini"
npx react-native run-ios --simulator="iPhone 12"
npx react-native run-ios --simulator="iPhone 12 Pro"
npx react-native run-ios --simulator="iPhone 12 Pro Max"
npx react-native run-ios --simulator="iPhone 13 Pro"
npx react-native run-ios --simulator="iPhone 13 Pro Max"
npx react-native run-ios --simulator="iPhone 13 mini"
npx react-native run-ios --simulator="iPhone 13"
npx react-native run-ios --simulator="iPod touch (7th generation)"
npx react-native run-ios --simulator="iPad Pro (9.7-inch)"
npx react-native run-ios --simulator="iPad (9th generation)"
npx react-native run-ios --simulator="iPad Air (4th generation)"
npx react-native run-ios --simulator="iPad Pro (11-inch) (3rd generation)"
npx react-native run-ios --simulator="iPad Pro (12.9-inch) (5th generation)"
npx react-native run-ios --simulator="iPad mini (6th generation)"
List all available iOS devices:
xcrun simctl list devices
There is currently no way to set a default.
React Native Docs: Running On Simulator
Change default iOS simulator device in react-native
You can add --simulator
flag to change your device model. For example:
react-native run-ios --simulator="iPhone 13"
Run xcrun simctl list devices
to get a list of available devices
React Native set default iPhone simulator
There is currently no official way besides --simulator
to set device for run-ios
as doc
You can try to edit in ./node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js the default in end of file:
var _default = {
...
options: [{
...
default: 'iPhone 8'
},
...
}
"react-native": "0.63.4"
React Native: Default iOS device inside simulator
It is possible to set default value by changing this file:
node_modules/react-native/local-cli/runIOS/runIOS.js
This block is useful for setting iOS simulator, Xcode scheme and root project location:
const args = parseCommandLine([
{
command: 'simulator',
description: 'Explicitly set simulator to use',
type: 'string',
required: false,
default: 'iPhone 6',
}, {
command: 'scheme',
description: 'Explicitly set Xcode scheme to use',
type: 'string',
required: false,
}, {
command: 'project-path',
description: 'Path relative to project root where the Xcode project (.xcodeproj) lives. The default is \'ios\'.',
type: 'string',
required: false,
default: 'ios',
}
], argv);
How to change the default Xcode iphone simulator when testing in the terminal?
You can provide your preferred simulator in the command as:
react-native run-ios --simulator="iPhone5"
You can check the available simulators by running this command from the terminal:
xcrun simctl list devices
React Native: Default iOS device inside simulator
It is possible to set default value by changing this file:
node_modules/react-native/local-cli/runIOS/runIOS.js
This block is useful for setting iOS simulator, Xcode scheme and root project location:
const args = parseCommandLine([
{
command: 'simulator',
description: 'Explicitly set simulator to use',
type: 'string',
required: false,
default: 'iPhone 6',
}, {
command: 'scheme',
description: 'Explicitly set Xcode scheme to use',
type: 'string',
required: false,
}, {
command: 'project-path',
description: 'Path relative to project root where the Xcode project (.xcodeproj) lives. The default is \'ios\'.',
type: 'string',
required: false,
default: 'ios',
}
], argv);
Change iOS simulator device in launch.js for react native project
Add the lines below into your .vscode/settings.json
file (create if now exist)
{
"react-native.ios.runArguments.simulator": [
"--simulator", "iPhone 6"
]
}
Related Topics
How to Use Device Instead of Simulator
iPad Multitasking Support Requires These Orientations
Width and Height Equal to Its Superview Using Autolayout Programmatically
Saving PDF Files with Swift in iOS and Display Them
iOS Certificate Pinning with Swift and Nsurlsession
Detecting Active Avaudiosessions on iOS Device
Problems with Ssl Pinning and Afnetworking 2.5.0 (Nsurlerrordomain Error -1012.)
Get List of All Installed Application in iOS 8
Uitableview:Viewforheaderinsection: Not Called During Reloaddata:
How to Upload Audio with Alamofire Multipart Upload
Cordova: Start Specific iOS Emulator Image
Find Where Object Is Retained with Arc
iOS Avplayer Trigger Streaming Is Out of Buffer
Profile Doesn't Match the Entitlements File's Value for the Application-Identifier Entitlement
Xcode Info.Plist Build Variable ${Product_Name:Rfc1034Identifier} Seems Completely Undocumented