diff --git a/react-native.config.js b/react-native.config.js index 969928780a..f519564c97 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -1,7 +1,17 @@ +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: { + android: supportsCodegenConfig ? { componentDescriptors: [ "RNSFullWindowOverlayComponentDescriptor", "RNSScreenContainerComponentDescriptor", @@ -13,7 +23,7 @@ module.exports = { 'RNSScreenComponentDescriptor' ], cmakeListsPath: "../android/src/main/jni/CMakeLists.txt" - }, + } : {}, }, }, }