mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Backport fix from https://github.com/react-native-community/react-native-cli/pull/138
This commit is contained in:
@@ -39,7 +39,15 @@ function findMatchingSimulator(simulators, simulatorString) {
|
||||
}
|
||||
|
||||
var match;
|
||||
for (let version in devices) {
|
||||
for (const versionDescriptor in devices) {
|
||||
const device = devices[versionDescriptor];
|
||||
let version = versionDescriptor;
|
||||
|
||||
if ((/^com\.apple\.CoreSimulator\.SimRuntime\./g).test(version)) {
|
||||
// Transform "com.apple.CoreSimulator.SimRuntime.iOS-12-2" into "iOS 12.2"
|
||||
version = version.replace(/^com\.apple\.CoreSimulator\.SimRuntime\.([^-]+)-([^-]+)-([^-]+)$/g, '$1 $2.$3');
|
||||
}
|
||||
|
||||
// Making sure the version of the simulator is an iOS or tvOS (Removes Apple Watch, etc)
|
||||
if (!version.includes('iOS') && !version.includes('tvOS')) {
|
||||
continue;
|
||||
@@ -47,8 +55,8 @@ function findMatchingSimulator(simulators, simulatorString) {
|
||||
if (simulatorVersion && !version.endsWith(simulatorVersion)) {
|
||||
continue;
|
||||
}
|
||||
for (let i in devices[version]) {
|
||||
let simulator = devices[version][i];
|
||||
for (const i in device) {
|
||||
const simulator = device[i];
|
||||
// Skipping non-available simulator
|
||||
if (
|
||||
simulator.availability !== '(available)' &&
|
||||
|
||||
Reference in New Issue
Block a user