iosxcodereact-nativeios-simulatorreact-native-ios

React Native set default iPhone simulator


I want to set a default simulator for my react native project so if I run the script yarn ios or npx react-native run-ios it always start the "iPhone 12 Pro Max".

So my question is where in the project the value of these simulators are saved, and how to change it. Is it set somewhere in .xcworkspace or .xcodeproj? If someone clones this project and runs the app might start on different devices on their machine.

Note: I am not searching for answers including setting --simulator flag


Solution

  • 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"