Cli: Set a default iOS simulator

Created on 14 Feb 2019  路  6Comments  路  Source: react-native-community/cli

react-native run-ios defaults to the iPhone X simulator; however, my preference is to use the iPhone XS Max. Could we have a way to set a default simulator? I understand there is a --simulator option; however, I would like a faster way to switch between simulators.

Possible Implementations

react-native set ios-simulator="iPhone XS Max"

feature request ios

All 6 comments

Hello !

I managed to found that the cli.js takes into account the --simulator argument so you can do what you want from now on @JSafaiyeh by doing this :

react-native run-ios --simulator='iPhone XS Max'

And putting this into a npm script should do the trick for now o/ :

"scripts": {
   "ios": "react-native run-ios --simulator='iPhone XS Max"
...

$ npm run ios

It has to be the exact same name as the official simulator name.

I think that documenting this might be sufficient ? or not ?

(just to share, it was really satisfying to found the relevant bits of code, it's so damn well organized ! 馃挜 )

@maieonbrix we'd love to have docs on that! Unfortunately, they don't exist yet. If you feel like it, how about starting to write the packages/cli/README.md in small steps? You can base it on what we already have inside README.md and packages/global-cli/README.md 馃槂

As for @JSafaiyeh, stuff like that would require CLI config, which we haven't established yet.

Also in the topic: https://github.com/react-native-community/react-native-cli/issues/12

@thymikee I would be glad to do this ! I'm counting on you to review my english 馃槄
I will work on this tomorrow night (in France) PR open

How should I name the first header ? Or maybe can I just start with an option section like here : https://github.com/react-native-community/react-native-cli/blob/master/packages/global-cli/README.md#options and documenting what I can found in the cli.js file

Yup, start small, with just the options header for now

Hello !

I managed to found that the cli.js takes into account the --simulator argument so you can do what you want from now on @JSafaiyeh by doing this :

react-native run-ios --simulator='iPhone XS Max'

And putting this into a npm script should do the trick for now o/ :

"scripts": {
   "ios": "react-native run-ios --simulator='iPhone XS Max"
...

$ npm run ios

It has to be the exact same name as the official simulator name.

I think that documenting this might be sufficient ? or not ?

(just to share, it was really satisfying to found the relevant bits of code, it's so damn well organized ! 馃挜 )

This does not set the default simulator, the next time you run yarn ios or react-native run-ios the wrong simulator starts. I Where react-native gets the configuration on which simulator to start?

Was this page helpful?
0 / 5 - 0 ratings