feat(android): Add theme variant and UI kit support for Android menus #1136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive theming support for Android menus by introducing two new props:
themeVariantanduiKit. This enhancement allows developers to control both the theme (light/dark/system) and UI framework (Material 3/AppCompat) of popup menus on Android, providing better visual consistency with the app's design system.✨ Features Added
themeVariantprop: Control menu theme with'light','dark', or'system'optionsuiKitprop: Choose between'auto','material3', or'appcompat'UI frameworks🔧 Technical Implementation
New Components
ThemeHelper.kt: Utility class for theme detection and style resolution using reflectionMenuView.kt: Added theme and UI kit state management with dynamic PopupMenu recreationMenuViewManagerBase.kt: Added React props forthemeVariantanduiKitKey Implementation Details
Configuration.UI_MODE_NIGHT_MASKfor automatic dark/light detectionMenuThemeVariant,MenuUiKit) with exports📱 Platform Support
themeVariantalready supported,uiKitis Android-only🔄 Breaking Changes
None - This is a fully backward-compatible addition. All new props are optional with sensible defaults.
📚 Documentation Updates
🧪 Testing Instructions
Basic Usage
Test Scenarios
Theme Variants:
themeVariant="light"- should show light themed menuthemeVariant="dark"- should show dark themed menuthemeVariant="system"- should follow system themeUI Kits:
uiKit="material3"- should use Material 3 styling if availableuiKit="appcompat"- should use AppCompat stylinguiKit="auto"- should prefer Material 3, fallback to AppCompatEdge Cases:
Expected Behavior
🔍 Code Quality
📋 Checklist
themeVariantprop support for AndroiduiKitprop for Android UI framework selectionThemeHelper.ktutility classMenuView.ktwith theme managementMenuViewManagerBase.kt🎯 Related Issues
This PR addresses the need for better Android theming support and provides developers with fine-grained control over menu appearance to match their app's design system.
Ready for review! 🚀 This enhancement significantly improves the Android user experience by providing native theming capabilities while maintaining full backward compatibility.