fix: declare support for `react-native` 0.72 (#1388)
This commit is contained in:
Родитель
113e97d8f6
Коммит
53ab08dadd
|
@ -235,6 +235,7 @@ jobs:
|
|||
- name: Set up react-native@nightly
|
||||
if: ${{ github.event_name == 'schedule' }}
|
||||
run: |
|
||||
git apply scripts/disable-safe-area-context.patch
|
||||
git apply scripts/android-nightly.patch
|
||||
npm run set-react-version -- nightly
|
||||
shell: bash
|
||||
|
|
|
@ -16,6 +16,7 @@ module.exports = {
|
|||
}
|
||||
|
||||
const fs = require("node:fs");
|
||||
const os = require("node:os");
|
||||
const path = require("node:path");
|
||||
|
||||
function normalize(p) {
|
||||
|
@ -37,7 +38,12 @@ module.exports = {
|
|||
const linkPath = path.join(nodeModulesPath, name);
|
||||
|
||||
fs.rmSync(linkPath, { force: true, maxRetries: 3, recursive: true });
|
||||
fs.symlinkSync(path.relative(nodeModulesPath, projectPath), linkPath);
|
||||
if (os.platform() === "win32") {
|
||||
fs.symlinkSync(projectPath, linkPath, "junction");
|
||||
} else {
|
||||
const target = path.relative(nodeModulesPath, projectPath);
|
||||
fs.symlinkSync(target, linkPath);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.5)
|
||||
CFPropertyList (3.0.6)
|
||||
rexml
|
||||
ast (2.4.2)
|
||||
atomos (0.1.3)
|
||||
|
@ -50,4 +50,4 @@ DEPENDENCIES
|
|||
xcodeproj
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.11
|
||||
2.4.10
|
||||
|
|
|
@ -10,6 +10,8 @@ plugins {
|
|||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
checkEnvironment()
|
||||
|
||||
def reactNativePath = file(findNodeModulesPath("react-native", rootDir))
|
||||
|
||||
if (autodetectReactNativeVersion || enableNewArchitecture) {
|
||||
|
|
|
@ -13,7 +13,12 @@ set(REACTTESTAPP_SOURCE_FILES
|
|||
)
|
||||
|
||||
# Suppress 'Manually-specified variables were not used by the project' warning
|
||||
set(UNUSED_VARIABLES ${REACT_COMMON_DIR} ${REACT_JNILIBS_DIR})
|
||||
set(UNUSED_VARIABLES
|
||||
${NODE_MODULES_DIR} # No longer used in 0.72
|
||||
${REACT_ANDROID_BUILD_DIR} # No longer used in 0.72
|
||||
${REACT_COMMON_DIR}
|
||||
${REACT_JNILIBS_DIR}
|
||||
)
|
||||
|
||||
if(DEFINED REACT_ANDROID_DIR)
|
||||
# New architecture
|
||||
|
|
|
@ -5,6 +5,8 @@ static String getKspVersion(String kotlinVersion) {
|
|||
return [
|
||||
// Run `scripts/update-ksp-versions.mjs` to update this list
|
||||
// update-ksp-versions start
|
||||
"1.8.21-1.0.11",
|
||||
"1.8.20-1.0.11",
|
||||
"1.8.10-1.0.9",
|
||||
"1.8.0-1.0.9",
|
||||
"1.7.22-1.0.8",
|
||||
|
|
|
@ -6,6 +6,33 @@ import java.security.MessageDigest
|
|||
|
||||
ext.manifest = null
|
||||
|
||||
ext.checkEnvironment = {
|
||||
def (major, minor, patch) = gradle.gradleVersion.findAll(/\d+/)
|
||||
def gradleVersion = (major as int) * 10000 + (minor as int) * 100 + (patch as int)
|
||||
if (reactNativeVersion > 0 && reactNativeVersion < 7200) {
|
||||
if (gradleVersion < 70501 || gradleVersion >= 80000) {
|
||||
logger.warn([
|
||||
"Latest Gradle 7.x is required for current React Native version. ",
|
||||
"Run the following command in the 'android' folder to install a supported version: ",
|
||||
"./gradlew wrapper --gradle-version=7.6.1",
|
||||
].join(""))
|
||||
}
|
||||
} else {
|
||||
// Gradle 7.5+ seems to be working with 0.72 so we will only recommend a
|
||||
// newer version if it's older.
|
||||
if (gradleVersion < 70501) {
|
||||
logger.warn([
|
||||
"Latest Gradle 8.0.x is recommended for React Native 0.72 and higher. ",
|
||||
"Run the following command in the 'android' folder to install a supported version: ",
|
||||
"./gradlew wrapper --gradle-version=8.0.2",
|
||||
"\n\n",
|
||||
"If you still need to work with older versions of React Native, ",
|
||||
"Gradle 7.5.1+ should still work."
|
||||
].join(""))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.findFile = { fileName ->
|
||||
def currentDirPath = rootDir == null ? null : rootDir.toString()
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ android.enableJetifier=true
|
|||
|
||||
# Version of Flipper to use with React Native. Default value is whatever React
|
||||
# Native defaults to. To disable Flipper, set it to `false`.
|
||||
#FLIPPER_VERSION=0.125.0
|
||||
#FLIPPER_VERSION=0.182.0
|
||||
|
||||
# Enable Fabric at runtime.
|
||||
#USE_FABRIC=1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"react": "~17.0.1 || ~18.0.0 || ~18.1.0 || ~18.2.0",
|
||||
"react-native": "^0.0.0-0 || 0.64 - 0.71 || 1000.0.0",
|
||||
"react-native": "^0.0.0-0 || 0.64 - 0.72 || 1000.0.0",
|
||||
"react-native-macos": "^0.0.0-0 || 0.64 || 0.66 || 0.68 || 0.71",
|
||||
"react-native-windows": "^0.0.0-0 || 0.64 - 0.71"
|
||||
"react-native-windows": "^0.0.0-0 || 0.64 - 0.72"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.1.6",
|
||||
|
|
|
@ -95,9 +95,9 @@
|
|||
"@react-native-community/cli-platform-ios": ">=5.0",
|
||||
"mustache": "^4.0.0",
|
||||
"react": "~17.0.1 || ~18.0.0 || ~18.1.0 || ~18.2.0",
|
||||
"react-native": "^0.0.0-0 || 0.64 - 0.71 || 1000.0.0",
|
||||
"react-native": "^0.0.0-0 || 0.64 - 0.72 || 1000.0.0",
|
||||
"react-native-macos": "^0.0.0-0 || 0.64 || 0.66 || 0.68 || 0.71",
|
||||
"react-native-windows": "^0.0.0-0 || 0.64 - 0.71"
|
||||
"react-native-windows": "^0.0.0-0 || 0.64 - 0.72"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@expo/config-plugins": {
|
||||
|
|
|
@ -1,39 +1,3 @@
|
|||
diff --git a/example/App.js b/example/App.js
|
||||
index c9cd14d..f63758d 100644
|
||||
--- a/example/App.js
|
||||
+++ b/example/App.js
|
||||
@@ -2,6 +2,7 @@
|
||||
import React, { useCallback, useMemo, useState } from "react";
|
||||
import {
|
||||
NativeModules,
|
||||
+ SafeAreaView,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
@@ -10,7 +11,6 @@ import {
|
||||
useColorScheme,
|
||||
View,
|
||||
} from "react-native";
|
||||
-import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
|
||||
// @ts-expect-error
|
||||
import { version as coreVersion } from "react-native/Libraries/Core/ReactNativeVersion";
|
||||
import { Colors, Header } from "react-native/Libraries/NewAppScreen";
|
||||
@@ -169,7 +169,6 @@ const App = ({ concurrentRoot }) => {
|
||||
);
|
||||
|
||||
return (
|
||||
- <SafeAreaProvider>
|
||||
<SafeAreaView style={styles.body}>
|
||||
<StatusBar barStyle={isDarkMode ? "light-content" : "dark-content"} />
|
||||
<ScrollView
|
||||
@@ -192,7 +191,6 @@ const App = ({ concurrentRoot }) => {
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
- </SafeAreaProvider>
|
||||
);
|
||||
};
|
||||
|
||||
diff --git a/example/package.json b/example/package.json
|
||||
index 9c2e1aa..94fb85e 100644
|
||||
--- a/example/package.json
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/example/App.js b/example/App.js
|
||||
index c9cd14d..f63758d 100644
|
||||
--- a/example/App.js
|
||||
+++ b/example/App.js
|
||||
@@ -2,6 +2,7 @@
|
||||
import React, { useCallback, useMemo, useState } from "react";
|
||||
import {
|
||||
NativeModules,
|
||||
+ SafeAreaView,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
StyleSheet,
|
||||
@@ -10,7 +11,6 @@ import {
|
||||
useColorScheme,
|
||||
View,
|
||||
} from "react-native";
|
||||
-import { SafeAreaProvider, SafeAreaView } from "react-native-safe-area-context";
|
||||
// @ts-expect-error
|
||||
import { version as coreVersion } from "react-native/Libraries/Core/ReactNativeVersion";
|
||||
import { Colors, Header } from "react-native/Libraries/NewAppScreen";
|
||||
@@ -169,7 +169,6 @@ const App = ({ concurrentRoot }) => {
|
||||
);
|
||||
|
||||
return (
|
||||
- <SafeAreaProvider>
|
||||
<SafeAreaView style={styles.body}>
|
||||
<StatusBar barStyle={isDarkMode ? "light-content" : "dark-content"} />
|
||||
<ScrollView
|
||||
@@ -192,7 +191,6 @@ const App = ({ concurrentRoot }) => {
|
||||
</View>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
- </SafeAreaProvider>
|
||||
);
|
||||
};
|
||||
|
|
@ -93,6 +93,7 @@ echo
|
|||
popd 1> /dev/null
|
||||
prepare
|
||||
# `react-native-safe-area-context` doesn't support latest New Arch changes
|
||||
git apply ../scripts/disable-safe-area-context.patch
|
||||
sed -i '' 's/"react-native-safe-area-context": ".[.0-9]*",//' package.json
|
||||
|
||||
echo
|
||||
|
@ -137,4 +138,4 @@ echo "│ Initialize new app │"
|
|||
echo "└─────────────────────┘"
|
||||
echo
|
||||
|
||||
yarn react-native init-test-app --destination template-example --name TemplateExample --platform android,ios
|
||||
GIT_IGNORE_FILE=".gitignore" yarn react-native init-test-app --destination template-example --name TemplateExample --platform android,ios
|
||||
|
|
|
@ -10,6 +10,10 @@ const artifactId = "com.google.devtools.ksp.gradle.plugin";
|
|||
const rows = 50;
|
||||
const searchUrl = `https://search.maven.org/solrsearch/select?q=g:%22${groupId}%22+AND+a:%22${artifactId}%22&core=gav&rows=${rows}&wt=json`;
|
||||
|
||||
/**
|
||||
* @param {{ docs?: { id: string; g: string; a: string; v: string; }[]; }} response
|
||||
* @returns {string[]}
|
||||
*/
|
||||
function extractVersions(response) {
|
||||
if (!Array.isArray(response.docs)) {
|
||||
return [];
|
||||
|
@ -25,6 +29,10 @@ function extractVersions(response) {
|
|||
return Object.values(versionMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} output
|
||||
* @param {string[]} versions
|
||||
*/
|
||||
function update(output, versions) {
|
||||
const startMarker = "// update-ksp-versions start";
|
||||
const endMarker = "// update-ksp-versions end";
|
||||
|
@ -35,7 +43,11 @@ function update(output, versions) {
|
|||
new RegExp(`${startMarker}.*${endMarker}`, "s"),
|
||||
[startMarker, ...versions.map((v) => `"${v}",`), endMarker].join(separator)
|
||||
);
|
||||
fs.writeFileSync(output, updated);
|
||||
|
||||
if (updated !== src) {
|
||||
fs.writeFileSync(output, updated);
|
||||
console.log(`Updated '${dependenciesGradle}'`);
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
|
|
@ -5470,9 +5470,9 @@ __metadata:
|
|||
react-native-windows: ^0.71.4
|
||||
peerDependencies:
|
||||
react: ~17.0.1 || ~18.0.0 || ~18.1.0 || ~18.2.0
|
||||
react-native: ^0.0.0-0 || 0.64 - 0.71 || 1000.0.0
|
||||
react-native: ^0.0.0-0 || 0.64 - 0.72 || 1000.0.0
|
||||
react-native-macos: ^0.0.0-0 || 0.64 || 0.66 || 0.68 || 0.71
|
||||
react-native-windows: ^0.0.0-0 || 0.64 - 0.71
|
||||
react-native-windows: ^0.0.0-0 || 0.64 - 0.72
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
|
@ -9915,9 +9915,9 @@ fsevents@^2.3.2:
|
|||
"@react-native-community/cli-platform-ios": ">=5.0"
|
||||
mustache: ^4.0.0
|
||||
react: ~17.0.1 || ~18.0.0 || ~18.1.0 || ~18.2.0
|
||||
react-native: ^0.0.0-0 || 0.64 - 0.71 || 1000.0.0
|
||||
react-native: ^0.0.0-0 || 0.64 - 0.72 || 1000.0.0
|
||||
react-native-macos: ^0.0.0-0 || 0.64 || 0.66 || 0.68 || 0.71
|
||||
react-native-windows: ^0.0.0-0 || 0.64 - 0.71
|
||||
react-native-windows: ^0.0.0-0 || 0.64 - 0.72
|
||||
peerDependenciesMeta:
|
||||
"@expo/config-plugins":
|
||||
optional: true
|
||||
|
|
Загрузка…
Ссылка в новой задаче