This commit is contained in:
jjbrunton committed 2026-02-01 17:01:09 +00:00
1 parent 4c18afaeae
commit 785e73d6c0
19 files changed
+3808 -4748

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
const { withAndroidManifest } = require('expo/config-plugins');
/**
* Fixes react-native-android-widget setting android:exported="false" on widget receivers.
* Widget receivers MUST be exported so the launcher can send APPWIDGET_UPDATE broadcasts.
*
* Uses withAndroidManifest's dangerous modifier priority to run after all other plugins.
*/
module.exports = function withWidgetExported(config) {
return withAndroidManifest(config, (config) => {
const mainApplication =
config.modResults.manifest.application?.[0];
if (!mainApplication?.receiver) return config;
for (const receiver of mainApplication.receiver) {
const intentFilters = receiver['intent-filter'] ?? [];
const isWidget = intentFilters.some((filter) =>
filter.action?.some(
(a) =>
a.$?.['android:name'] ===
'android.appwidget.action.APPWIDGET_UPDATE'
)
);
if (isWidget) {
receiver.$['android:exported'] = 'true';
}
}
return config;
});
};