-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwithAndroidIconFix.js
More file actions
31 lines (23 loc) · 1013 Bytes
/
Copy pathwithAndroidIconFix.js
File metadata and controls
31 lines (23 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const { withAndroidManifest } = require('@expo/config-plugins');
const withAndroidFixes = (config) => {
return withAndroidManifest(config, (config) => {
const androidManifest = config.modResults.manifest;
const mainApplication = androidManifest.application[0];
// Ensure tools namespace exists
if (!androidManifest.$['xmlns:tools']) {
androidManifest.$['xmlns:tools'] = 'http://schemas.android.com/tools';
}
// Attributes to replace to avoid manifest merger conflicts
const replaces = ['android:icon', 'android:roundIcon', 'android:allowBackup', 'android:supportsRtl'];
let currentReplace = mainApplication.$['tools:replace'] || '';
let replaceArray = currentReplace ? currentReplace.split(',').map(s => s.trim()) : [];
replaces.forEach(r => {
if (!replaceArray.includes(r)) {
replaceArray.push(r);
}
});
mainApplication.$['tools:replace'] = replaceArray.join(',');
return config;
});
};
module.exports = withAndroidFixes;