Skip to content
Open
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
31 changes: 4 additions & 27 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
let supportsCodegenConfig = false;

try {
const rnCliAndroidVersion = require('@react-native-community/cli-platform-android/package.json')
.version;
const [major] = rnCliAndroidVersion.split('.');
supportsCodegenConfig = major >= 9;
} catch (e) {
// ignore
}

// this is a quick workaround for enabling custom codegen config in the fabric example app
// the require above picks up the version of the cli-platform-android package from the root node_modules
// instead of the one from the example app and doesn't correctly set the flag
// this, along with the patch to the rncli allows to run the fabric example properly
const codegenSwitch = '--enable-rnandroidprogressbar-codegen';
if (process.argv.includes(codegenSwitch)) {
process.argv = process.argv.filter((arg) => arg !== codegenSwitch);
supportsCodegenConfig = true;
}

module.exports = {
project: {
android: {sourceDir: './example/android'},
ios: {project: './example/ios/example.xcworkspace'},
},
dependency: {
platforms: {
android: supportsCodegenConfig
? {
componentDescriptors: ['RNCProgressBarComponentDescriptor'],
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
}
: {},
android: {
componentDescriptors: ['RNCProgressBarComponentDescriptor'],
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
},
},
},
};