diff --git a/packages/app/package.json b/packages/app/package.json index eae56d0c5..8afade044 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -120,7 +120,7 @@ "@callstack/react-native-visionos": "0.76 - 0.79", "@expo/config-plugins": ">=5.0", "react": "18.2 - 19.2", - "react-native": "0.76 - 0.86 || >=0.86.0-0 <0.87.0", + "react-native": "0.76 - 0.87 || >=0.88.0-0 <0.88.0", "react-native-macos": "^0.0.0-0 || 0.76 - 0.81", "react-native-windows": "^0.0.0-0 || 0.76 - 0.83" }, diff --git a/packages/app/scripts/internal/set-react-version.mts b/packages/app/scripts/internal/set-react-version.mts index d4a12384c..51d790573 100644 --- a/packages/app/scripts/internal/set-react-version.mts +++ b/packages/app/scripts/internal/set-react-version.mts @@ -85,17 +85,23 @@ function fetchPackageInfo(pkg: string, version: string): Promise { /** * Fetches the template manifest for the specified React Native version. */ -function fetchTemplateManifest(version: string): Promise { +async function fetchTemplateManifest(version: string): Promise { const url = `https://raw.githubusercontent.com/react-native-community/template/refs/heads/${version}-stable/template/package.json`; console.log(`Fetching template manifest from ${url}`); - return fetch(url, { + const res = await fetch(url, { headers: { Accept: "application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*", }, - }) - .then((res) => res.text()) - .then((text) => JSON.parse(text)); + }); + + const body = await res.text(); + if (res.status !== 200) { + console.error(`Failed to fetch template: ${body}`); + return { name: "", version: "" }; + } + + return JSON.parse(body); } /** diff --git a/yarn.lock b/yarn.lock index 07135d44a..06bf42214 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13355,7 +13355,7 @@ __metadata: "@callstack/react-native-visionos": 0.76 - 0.79 "@expo/config-plugins": ">=5.0" react: 18.2 - 19.2 - react-native: 0.76 - 0.86 || >=0.86.0-0 <0.87.0 + react-native: 0.76 - 0.87 || >=0.88.0-0 <0.88.0 react-native-macos: ^0.0.0-0 || 0.76 - 0.81 react-native-windows: ^0.0.0-0 || 0.76 - 0.83 peerDependenciesMeta: