有没有办法用命令运行特定的目标

react-native run-ios

对于Android,我使用以下命令

react-native run-android --variant=targetRelease

推荐答案

ios --scheme有吗

 react-native run-ios --scheme "TargetName"

对于其他参数,我只是提取了runIos.来自本地cli的js文件

这是数据,

{
  name: 'run-ios',
  description: 'builds your app and starts it on iOS simulator',
  func: runIOS,
  examples: [
  {
    desc: 'Run on a different simulator, e.g. iPhone 5',
    cmd: 'react-native run-ios --simulator "iPhone 5"',
  },
  {
    desc: 'Pass a non-standard location of iOS directory',
    cmd: 'react-native run-ios --project-path "./app/ios"',
  },
  {
    desc: "Run on a connected device, e.g. Max's iPhone",
    cmd: 'react-native run-ios --device "Max\'s iPhone"',
  },
  {
    desc: 'Run on the AppleTV simulator',
    cmd: 'react-native run-ios --simulator "Apple TV"  --scheme "helloworld-tvOS"',
  }
  ],
  options: [{
    command: '--simulator [string]',
    description: 'Explicitly set simulator to use',
    default: 'iPhone 6',
  } , {
    command: '--configuration [string]',
    description: 'Explicitly set the scheme configuration to use',
  } , {
    command: '--scheme [string]',
    description: 'Explicitly set Xcode scheme to use',
  }, {
    command: '--project-path [string]',
    description: 'Path relative to project root where the Xcode project '
      + '(.xcodeproj) lives. The default is \'ios\'.',
    default: 'ios',
  }, {
    command: '--device [string]',
    description: 'Explicitly set device to use by name.  The value is not required if you have a single device connected.',
  }, {
    command: '--udid [string]',
    description: 'Explicitly set device to use by udid',
  }, {
    command: '--no-packager',
    description: 'Do not launch packager while building',
  }, {
    command: '--verbose',
    description: 'Do not use xcpretty even if installed',
  },{
    command: '--port [number]',
    default: process.env.RCT_METRO_PORT || 8081,
    parse: (val: string) => Number(val),
  }],
};

React-native相关问答推荐

为什么我的expoav视频不会自动播放?

将值从一个 js 文件传递​​到 react native 中的另一个 js 文件:react native

react平面列表渲染项

TextInput 防止 ScrollView 滚动

React Native 在升级到 0.56 版本后崩溃

使用react native获取设备令牌

React Native:双击退出应用程序

React Native - 如何判断 UI/元素?

如何解决此错误您可能需要适当的加载程序来处理此文件类型

React-Native 构建失败的应用程序:mergeDebugAssets

React Native 使视图 Hug键盘顶部

在特定屏幕上使用react-navigation修改后退按钮

更新 this.state.dataSource 不会更新 ListView

如何将 React Native Promise 连接到 Swift

React Native onLayout 与 React Hooks

在 ReactNative 中单击按钮时如何获取 TextInput 中的值

React-Native 元素卡在 :app:installDebug

键盘可见时无法单击按钮

无法运行 jetifier React Native

React Navigation获取堆栈标题高度