33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
const { withAndroidManifest } = require('@expo/config-plugins');
|
|
|
|
module.exports = function withOrientationFix(config) {
|
|
return withAndroidManifest(config, (config) => {
|
|
const androidManifest = config.modResults;
|
|
const manifest = androidManifest.manifest;
|
|
|
|
// Add xmlns:tools if missing
|
|
if (!manifest.$['xmlns:tools']) {
|
|
manifest.$['xmlns:tools'] = 'http://schemas.android.com/tools';
|
|
}
|
|
|
|
if (!manifest.application) return config;
|
|
|
|
const app = manifest.application[0];
|
|
|
|
// Add node replacement for ML Kit Barcode Scanner activity
|
|
if (!app.activity) app.activity = [];
|
|
|
|
if (!app.activity.some((a) => a.$['android:name'] === 'com.google.mlkit.vision.codescanner.internal.GmsBarcodeScanningDelegateActivity')) {
|
|
app.activity.push({
|
|
$: {
|
|
'android:name': 'com.google.mlkit.vision.codescanner.internal.GmsBarcodeScanningDelegateActivity',
|
|
'android:screenOrientation': 'unspecified',
|
|
'tools:replace': 'android:screenOrientation',
|
|
},
|
|
});
|
|
}
|
|
|
|
return config;
|
|
});
|
|
};
|