From f6d720fd251cf2063257da4f217b0e4231a5c77d Mon Sep 17 00:00:00 2001 From: Elvinas Date: Tue, 3 Mar 2020 17:54:23 +0200 Subject: [PATCH 1/2] fix: scoped packages with `.` produces incorrect package name This fixes #1031 (a regression introduced with #910). It also makes sure that the package name contains only allowed chars. --- packages/platform-android/native_modules.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index 8f5dc4007..bcd786a8c 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -221,7 +221,7 @@ class ReactNativeModules { HashMap reactNativeModuleConfig = new HashMap() reactNativeModuleConfig.put("name", name) - reactNativeModuleConfig.put("nameCleansed", name.replaceAll('^@([\\w-]+)/', '$1_')) + reactNativeModuleConfig.put("nameCleansed", replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')) reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"]) reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"]) reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"]) From 80297a8d8e993286c725ab3fda09cb969799e555 Mon Sep 17 00:00:00 2001 From: Elvinas Date: Tue, 3 Mar 2020 17:57:13 +0200 Subject: [PATCH 2/2] Fix cleansed name creation --- packages/platform-android/native_modules.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platform-android/native_modules.gradle b/packages/platform-android/native_modules.gradle index bcd786a8c..0089255bc 100644 --- a/packages/platform-android/native_modules.gradle +++ b/packages/platform-android/native_modules.gradle @@ -221,7 +221,7 @@ class ReactNativeModules { HashMap reactNativeModuleConfig = new HashMap() reactNativeModuleConfig.put("name", name) - reactNativeModuleConfig.put("nameCleansed", replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')) + reactNativeModuleConfig.put("nameCleansed", name.replaceAll('[~*!\'()]+', '_').replaceAll('^@([\\w-.]+)/', '$1_')) reactNativeModuleConfig.put("androidSourceDir", androidConfig["sourceDir"]) reactNativeModuleConfig.put("packageInstance", androidConfig["packageInstance"]) reactNativeModuleConfig.put("packageImportPath", androidConfig["packageImportPath"])