Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions local-cli/link/android/patches/makeNamePatch.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
/*
* Fix gradle sync failure in Android Studio 3.0 when
* module name has a scope (e.g `@username/project-name`)
* https://github.com/facebook/react-native/issues/17029
*/
module.exports = function makeNamePatch(name) {
return name.replace(/\//g, ':');
};
3 changes: 3 additions & 0 deletions local-cli/link/android/registerNativeModule.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,13 +4,16 @@ const makeSettingsPatch = require('./patches/makeSettingsPatch');
const makeBuildPatch = require('./patches/makeBuildPatch');
const makeImportPatch = require('./patches/makeImportPatch');
const makePackagePatch = require('./patches/makePackagePatch');
const makeNamePatch = require('./patches/makeNamePatch');

module.exports = function registerNativeAndroidModule(
name,
androidConfig,
params,
projectConfig
) {
name = makeNamePatch(name);

const buildPatch = makeBuildPatch(name);

applyPatch(
Expand Down
3 changes: 3 additions & 0 deletions local-cli/link/android/unregisterNativeModule.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,12 +7,15 @@ const makeBuildPatch = require('./patches/makeBuildPatch');
const makeStringsPatch = require('./patches/makeStringsPatch');
const makeImportPatch = require('./patches/makeImportPatch');
const makePackagePatch = require('./patches/makePackagePatch');
const makeNamePatch = require('./patches/makeNamePatch');

module.exports = function unregisterNativeAndroidModule(
name,
androidConfig,
projectConfig
) {
name = makeNamePatch(name);

const buildPatch = makeBuildPatch(name);
const strings = fs.readFileSync(projectConfig.stringsPath, 'utf8');
var params = {};
Expand Down