nandorojo / zeego

Menus for React (Native) done right.
https://zeego.dev
MIT License
1.68k stars 45 forks source link

Ability to change menu theme on android #78

Open Cleover opened 9 months ago

Cleover commented 9 months ago
  1. Is it possible to change the DropdownMenu's theme on android? Currently it renders as a white background regardless of the device theme, but as far as I can tell androids native menus supports themes. https://developer.android.com/develop/ui/views/components/menus https://developer.android.com/develop/ui/views/theming/themes

Unsure how extensive this is, but it would be nice to be able to change the background / text colour.

  1. I’m unsure if this is considered native but is it possible to round the edges of android menus? https://stackoverflow.com/questions/53964594/how-do-i-make-the-rounded-corners-of-the-menu-in-the-toolbar

  2. Is it possible to force a theme on iOS (for dark/light) rather than defaulting to the system?

  3. Should dividers be visible on android? As far as I can tell they do exist on android but the DropdownMenu’s item groups don’t seem to have the separator.

'Cheers

nandorojo commented 9 months ago

All depends on what the upstream menu library allows

Elue-dev commented 3 months ago

was asking this as well, did you find out how to implement this?

nandorojo commented 3 months ago

i would really like to switch menu components for android…

Cleover commented 2 months ago

was asking this as well, did you find out how to implement this?

Somewhat, I just created some plugins to edit the style via the android xml files when the project is built.

The two plugins I use are here, there is one for editing the style.xml file to change the text Color and also to point to the background style overwrite. Then there is a plug-in to add a drawable xml with the popup menus overwrited style.

It's not super easy to understand, but generally if you copy the plugins you should only need to edit the drawable one and change the values as needed.

(You'll also need to add the plugins to your app.json to make them run when it's built)

https://github.com/Cleover/Mebious/tree/main/plugins

Elue-dev commented 2 months ago

was asking this as well, did you find out how to implement this?

Somewhat, I just created some plugins to edit the style via the android xml files when the project is built.

The two plugins I use are here, there is one for editing the style.xml file to change the text Color and also to point to the background style overwrite. Then there is a plug-in to add a drawable xml with the popup menus overwrited style.

It's not super easy to understand, but generally if you copy the plugins you should only need to edit the drawable one and change the values as needed.

(You'll also need to add the plugins to your app.json to make them run when it's built)

https://github.com/Cleover/Mebious/tree/main/plugins

thanks for this, will try it out, does it work based on device theme?

Cleover commented 2 months ago

thanks for this, will try it out, does it work based on device theme?

The plugins I made only edits the light mode script, however it's possible to have separate light/dark colors by using another xml file.

I'm not 100% sure of the best way to do it but I'd check out this docs page: https://docs.expo.dev/config-plugins/plugins-and-mods/#create-a-plugin

I know you can make a styles.xml file inside of a dark mode directory in a similar place to where the other files are, and that file can have its own style for when in dark mode. However there are also mods.android.colors and mods.android.colorsNight which makes me think you may be able to have the app pull the Colors from there instead without needing to have a separate overriding menu theme applied depending on the device theme, but I'm not sure on how they work enough to say for sure which way is best.

brianGammon commented 2 months ago

I'm working on implementing Zeego for the first time and this Android color mode issue is my main blocker. @Cleover it's been a few weeks, how is your plugin approach working? My app follows the user's system color scheme, so I need the Android menu to follow this behavior too. Not sure I want to go down the rabbit hole with multiple plugin customizations.