Skip to content

Commit b9434af

Browse files
committed
cr: Reverted and simplified change after code review
Removed previous change and made the `supportsCodegenConfig` variable true initially
1 parent 2116a0e commit b9434af

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

react-native.config.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
let supportsCodegenConfig = true;
2+
try {
3+
const rnCliAndroidVersion = require.main.require(
4+
'@react-native-community/cli-platform-android/package.json',
5+
).version;
6+
const [major] = rnCliAndroidVersion.split('.');
7+
supportsCodegenConfig = major >= 9;
8+
} catch (e) {
9+
// ignore
10+
}
11+
112
module.exports = {
213
dependency: {
314
platforms: {
4-
android: {
5-
libraryName: 'safeareacontext',
6-
componentDescriptors: [
7-
'RNCSafeAreaProviderComponentDescriptor',
8-
'RNCSafeAreaViewComponentDescriptor',
9-
],
10-
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
11-
},
15+
android: supportsCodegenConfig
16+
? {
17+
libraryName: 'safeareacontext',
18+
componentDescriptors: [
19+
'RNCSafeAreaProviderComponentDescriptor',
20+
'RNCSafeAreaViewComponentDescriptor',
21+
],
22+
cmakeListsPath: 'src/main/jni/CMakeLists.txt',
23+
}
24+
: {},
1225
macos: null,
1326
windows: null,
1427
},
1528
},
16-
};
29+
};

0 commit comments

Comments
 (0)