From a1705f13bc016ff6b2a701546a02372026aecb18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Kosmaty?= Date: Fri, 25 Oct 2024 11:28:22 +0200 Subject: [PATCH] chore: Remove legacy version check in `react-native.config.js` (#2503) ## 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. ## Tests This change was tested using `expo` project on react native `0.76`. Co-authored-by: Jakub Grzywacz --- react-native.config.js | 80 ++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 46 deletions(-) diff --git a/react-native.config.js b/react-native.config.js index 7709799f..96657a69 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -1,52 +1,40 @@ -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: [ - 'RNSVGCircleComponentDescriptor', - 'RNSVGClipPathComponentDescriptor', - 'RNSVGDefsComponentDescriptor', - 'RNSVGFeBlendComponentDescriptor', - 'RNSVGFeColorMatrixComponentDescriptor', - 'RNSVGFeCompositeComponentDescriptor', - 'RNSVGFeFloodComponentDescriptor', - 'RNSVGFeGaussianBlurComponentDescriptor', - 'RNSVGFeMergeComponentDescriptor', - 'RNSVGFeOffsetComponentDescriptor', - 'RNSVGFilterComponentDescriptor', - 'RNSVGEllipseComponentDescriptor', - 'RNSVGForeignObjectComponentDescriptor', - 'RNSVGGroupComponentDescriptor', - 'RNSVGImageComponentDescriptor', - 'RNSVGLinearGradientComponentDescriptor', - 'RNSVGLineComponentDescriptor', - 'RNSVGMarkerComponentDescriptor', - 'RNSVGMaskComponentDescriptor', - 'RNSVGPathComponentDescriptor', - 'RNSVGPatternComponentDescriptor', - 'RNSVGRadialGradientComponentDescriptor', - 'RNSVGRectComponentDescriptor', - 'RNSVGSvgViewAndroidComponentDescriptor', - 'RNSVGSymbolComponentDescriptor', - 'RNSVGTextComponentDescriptor', - 'RNSVGTextPathComponentDescriptor', - 'RNSVGTSpanComponentDescriptor', - 'RNSVGUseComponentDescriptor', - ], - cmakeListsPath: '../android/src/main/jni/CMakeLists.txt', - } - : {}, + android: { + componentDescriptors: [ + 'RNSVGCircleComponentDescriptor', + 'RNSVGClipPathComponentDescriptor', + 'RNSVGDefsComponentDescriptor', + 'RNSVGFeBlendComponentDescriptor', + 'RNSVGFeColorMatrixComponentDescriptor', + 'RNSVGFeCompositeComponentDescriptor', + 'RNSVGFeFloodComponentDescriptor', + 'RNSVGFeGaussianBlurComponentDescriptor', + 'RNSVGFeMergeComponentDescriptor', + 'RNSVGFeOffsetComponentDescriptor', + 'RNSVGFilterComponentDescriptor', + 'RNSVGEllipseComponentDescriptor', + 'RNSVGForeignObjectComponentDescriptor', + 'RNSVGGroupComponentDescriptor', + 'RNSVGImageComponentDescriptor', + 'RNSVGLinearGradientComponentDescriptor', + 'RNSVGLineComponentDescriptor', + 'RNSVGMarkerComponentDescriptor', + 'RNSVGMaskComponentDescriptor', + 'RNSVGPathComponentDescriptor', + 'RNSVGPatternComponentDescriptor', + 'RNSVGRadialGradientComponentDescriptor', + 'RNSVGRectComponentDescriptor', + 'RNSVGSvgViewAndroidComponentDescriptor', + 'RNSVGSymbolComponentDescriptor', + 'RNSVGTextComponentDescriptor', + 'RNSVGTextPathComponentDescriptor', + 'RNSVGTSpanComponentDescriptor', + 'RNSVGUseComponentDescriptor', + ], + cmakeListsPath: '../android/src/main/jni/CMakeLists.txt', + }, }, }, };