Skip to content

Commit

Permalink
chore: Remove legacy version check in react-native.config.js (#2432)
Browse files Browse the repository at this point in the history
## Description

Removes legacy version check from `react-native.config.js`. 

## Changes

The community CLI is no longer a dependency for React Native, meaning it
may not be installed in every project. For example, projects that use
Expo won't include the `@react-native-community/cli-*` packages.
Consequently, this check will fail, leading to issues with autolinking
components.

This version check can be removed safely, as the 9th version of the CLI
was released two years ago.

## Test code and steps to reproduce

This change was tested using `expo` project on react native `0.76`.
  • Loading branch information
lukmccall authored Nov 4, 2024
1 parent 414b5ed commit 81f6029
Showing 1 changed file with 16 additions and 28 deletions.
44 changes: 16 additions & 28 deletions react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
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
}

module.exports = {
dependency: {
platforms: {
android: supportsCodegenConfig
? {
componentDescriptors: [
"RNSFullWindowOverlayComponentDescriptor",
"RNSScreenContainerComponentDescriptor",
"RNSScreenNavigationContainerComponentDescriptor",
"RNSScreenStackHeaderConfigComponentDescriptor",
"RNSScreenStackHeaderSubviewComponentDescriptor",
"RNSScreenStackComponentDescriptor",
"RNSSearchBarComponentDescriptor",
'RNSScreenComponentDescriptor',
"RNSScreenFooterComponentDescriptor",
"RNSScreenContentWrapperComponentDescriptor",
'RNSModalScreenComponentDescriptor'
],
cmakeListsPath: "../android/src/main/jni/CMakeLists.txt"
}
: {},
android: {
componentDescriptors: [
"RNSFullWindowOverlayComponentDescriptor",
"RNSScreenContainerComponentDescriptor",
"RNSScreenNavigationContainerComponentDescriptor",
"RNSScreenStackHeaderConfigComponentDescriptor",
"RNSScreenStackHeaderSubviewComponentDescriptor",
"RNSScreenStackComponentDescriptor",
"RNSSearchBarComponentDescriptor",
'RNSScreenComponentDescriptor',
"RNSScreenFooterComponentDescriptor",
"RNSScreenContentWrapperComponentDescriptor",
'RNSModalScreenComponentDescriptor'
],
cmakeListsPath: "../android/src/main/jni/CMakeLists.txt"
},
},
},
};

0 comments on commit 81f6029

Please sign in to comment.