Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change menu theme on android #78

Open
Cleover opened this issue Feb 25, 2024 · 7 comments
Open

Ability to change menu theme on android #78

Cleover opened this issue Feb 25, 2024 · 7 comments

Comments

@Cleover
Copy link

Cleover commented Feb 25, 2024

  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
Copy link
Owner

All depends on what the upstream menu library allows

@Elue-dev
Copy link

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

@nandorojo
Copy link
Owner

i would really like to switch menu components for android…

@Cleover
Copy link
Author

Cleover commented Aug 29, 2024

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
Copy link

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
Copy link
Author

Cleover commented Aug 29, 2024

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants