rebreak-monorepo/apps/rebreak-native/plugins/with-material-theme-android.js
chahinebrini 4124463097 chore(release): bump to v0.2.1 / versionCode 9 — theme-crash, double-splash, dm-reopen fixes
- Android Theme parent → Theme.MaterialComponents.DayNight.NoActionBar.Bridge
  (fix BadgeDrawable crash in react-native-bottom-tabs after AccessibilityService toggle)
- Plugin with-material-theme-android keeps theme idempotent across prebuilds
- Plugin with-release-signing-android wires release signingConfig from key.properties
- Splash: align native splash image with JS BrandSplash (icon.png) to eliminate
  double-splash flicker on app start
- DM: reset partner/messages/replyTo state on userId change, disable cache for
  history query, switch spinner condition to isLoading||isFetching so reopens
  always load fresh and never show empty-state with stale partner

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 09:32:28 +02:00

39 lines
1.3 KiB
JavaScript

/* eslint-disable @typescript-eslint/no-var-requires */
/**
* Expo Config-Plugin — setzt den AppTheme-Parent auf
* Theme.MaterialComponents.DayNight.NoActionBar.Bridge damit react-native-bottom-tabs'
* BadgeDrawable nicht mit IllegalArgumentException crasht.
*
* Warum Bridge-Variante: bridged MaterialComponents ist ein Superset von AppCompat —
* alle AppCompat-Abhängigkeiten im RN-Stack bleiben kompatibel, aber Material-APIs
* (BadgeDrawable, NavigationBarMenuView etc.) funktionieren.
*
* Warum Plugin statt Hand-Edit: `prebuild --clean` regeneriert styles.xml aus dem
* Expo-AppCompat-Default. Dieses Plugin patcht den Parent-Wert nach jedem prebuild
* idempotent per withAndroidStyles (offizielles Config-Plugins-API).
*/
const { withAndroidStyles } = require('@expo/config-plugins');
const MATERIAL_THEME = 'Theme.MaterialComponents.DayNight.NoActionBar.Bridge';
function withMaterialThemeAndroid(config) {
return withAndroidStyles(config, (cfg) => {
const styles = cfg.modResults.resources.style;
if (!Array.isArray(styles)) return cfg;
const appTheme = styles.find(
(s) => s.$ && s.$['name'] === 'AppTheme',
);
if (appTheme) {
appTheme.$['parent'] = MATERIAL_THEME;
}
return cfg;
});
}
module.exports = withMaterialThemeAndroid;