Skip to content

chore: Remove legacy version check in react-native.config.js #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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',
},
},
},
};