From 45d453000429462e30d79e58811838359431ce32 Mon Sep 17 00:00:00 2001 From: Mason Le <43195241+MasonLe2497@users.noreply.github.com> Date: Wed, 23 Aug 2023 21:25:58 +0700 Subject: [PATCH] =?UTF-8?q?feat(android):=C2=A0=F0=9F=8C=9F=C2=A0add=20sup?= =?UTF-8?q?port=20for=20React=20Native=200.73=20(#736)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(android): 🌟 add support for React Native 0.73 * Rollback AndroidManifest.xml to support RN <0.71 * feat(all): add namespace when ANDROID_GRADLE_PLUGIN_VERSION >=7 * Add support RN < 0.71 * Update android/build.gradle Co-authored-by: Burak Güner --------- Co-authored-by: troZee <12766071+troZee@users.noreply.github.com> Co-authored-by: Burak Güner --- android/build.gradle | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index c17d3fa1..e5f36a31 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -33,10 +33,32 @@ def getExtOrDefault(name) { def getExtOrIntegerDefault(name) { return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['PagerView_' + name]).toInteger() } +def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger() +def shouldUseNameSpace = agpVersion >= 8 +def PACKAGE_PROP = "package=\"com.reactnativepagerview\"" +def manifestOutFile = file("${projectDir}/src/main/AndroidManifest.xml") +def manifestContent = manifestOutFile.getText() +if(shouldUseNameSpace){ + manifestContent = manifestContent.replaceAll( + PACKAGE_PROP, + '' + ) +} else { + if(!manifestContent.contains("$PACKAGE_PROP")){ + manifestContent = manifestContent.replace( + '