-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Change Dialogs Buttons Color #223
Comments
For now you can only have the same color for all buttons: https://github.com/nativescript-community/ui-material-components/blob/master/src/dialogs/dialogs.android.ts#L124 |
In iOS the color of the buttons doesn't change @farfromrefug
|
@AgustinV08 can you give your Material pod version? (podfile lock in platforms/ios folder) |
119.3.0 |
@AgustinV08 ok not sure what s happening wont have a simple solution. If you want to change your global theme you can use the themer |
Okay thanks, hope there is a fix later |
I seem to have a related problem: all my dialog button appear greyed out (but work). |
@ray007 no idea without sample code. please first look at the demos to see correct behavior, then go from there. |
I'm experiencing the same issue with v5.2.8 |
do you have a CSS section for button or mdbutton? do you set a color there? |
Same here @farfromrefug. Fresh NS6 Angular project (using v3.3.2). Bottom navigation bar works great but dialogs have multiple issues (on Android, couldn't test iOS):
I made a repo: https://github.com/agonper/ns-material-test. If you run the Android demo you'll find 4 buttons to show 4 different dialogs:
Any guidance will be appreciated. Many thanks in advance.
|
Identical behaviour in NS7 with latest version of the plugin. Check the same project migrated to NS7 in a new branch: https://github.com/agonper/ns-material-test/tree/ns7 I have the feeling like it has something to do with native packages. Based on build output, it doesn't seems to me that the needed aar files are being included (perhaps they're transitive dependencies, I don't know), more concretely, these ones: https://github.com/nativescript-community/ui-material-components/blob/master/packages/core/platforms/android/include.gradle Any help will be appreciated. I've checked all the demos and I cannot spot any other differences with my project. It is kind of difficult to debug because demos do not even compile / run 😢 neither on Windows or macOS (i can open a separate issue if needed).
|
almost surely your issue is because setIcon is not called with the right parameter. you need to debut to see what parameter is passed to setIcon |
Hi @farfromrefug, thanks for your response. Indeed, I dived into the code and the method is there but the JNI doesn't seems to be able to find the appropriate override based on the icon resource passed by parameter. I dug into Android docs and it seems to be because setIcon expects a Drawable (among other options) to be passed by parameter whereas ImageSource.android contains a Bitmap type. Bitmaps can be interpreted as Drawables by wrapping them inside a BitmapDrawable type. However, this didn't work either. Anyway, it should be possible to mimic a similar behaviour with a custom title view (hadn't tested yet). To the major issue here (see screenshots attached). I've tried configuring the themer (in main app component, because in main.ts I couldn't due to Android bindings not being ready yet) but this doesn't seems to take effect. I also migrated to MatherialTheme in styles.xml file and even tried overriding the colors via the alert API but none of this methods worked to change the color of the material controls. The later, I asume could be somehow related to #156. Eventhough this does not work, I should be able to change the colors of the controls for all the application and I supposed I had to do this using the themer (although I would prefer to do it by CSS, but I don't see how). What I'm missing here? Please, I would like to help fixing this issues but I'm lacking context to understand better how this works in overall. Sadly demos don't help a lot on this matter, because each one is configured differently and with the last CLI they don't seem to be operational due to runtime and compilation errors. Find attached some screenshots about the problem I'm highlighting (Android). See that all the controls are in grey and with very little contrast. Thanks in advance. |
@agonper the themer is only for iOS. On android you need to to do it the android way and theme material colors through style files in android res. As for the |
My bad, changing the hex codes in the colors.xml was what I was missing. It is very easy to unsee it when you're comparing your code with the demo code. Also about the themer, didn't see anywhere explicitly saying it is iOS only (aside from an isIOS if guard inside the Vue demo 😶). Could be good to have this "overall" setup tips in the main readme for everybody to know how to configure the core library. Btw, I've applied the changes of #156 inside my node_modules and they still apply, and indeed allow to change the text color of the buttons dynamically (in case someone wants to give a "danger" style to a specific dialog). Regarding this, could be good to be able to specify the color of each button (or its emphasis) individually to allow highlighting certain actions. I see the color change feature easy to implement in Android but I don't see how it can be done in iOS (or if it is even possible). Individually, I mean. Conversely, emphasis seems a thing easy to implement in iOS but I don't see how it can be done in Android. They're just some ideas though. Nice job porting this to NS, I'll pending to see when the |
@agonper good ideas. tbh it is more a question of free time to worm on all this. if you want to make a PR you are welcome |
Thanks @farfromrefug, indeed I agree with you in the question of time availability 😉. From here I see some things to do in order to improve the plugins:
I can work on the first three things, I cannot commit to an ETA but I can promise I'll do something from time to time (perhaps during the weekends 😛). I would appreciate if you could work on the last two (if possible) and to have a look to see why demos don't work following setup instructions (I can open an issue with the details of the issues I'm encountering). I think this later aspect is crucial to lower the barrier for others to contribute and use these fantastic plugins we have right here 😉 |
good with me ! thanks |
Many thanks @farfromrefug, for adding the docs about styling. I have the other things in my queue, I'll ping you via Slack if I start working on any of the points in order to avoid duplicating efforts. I think that (updating the docs) solves this issue which could be closed now. |
I am using nativescript version 8 and developing an android application. (nativescript with svelte) |
@dvlpr91 should be fixed in 6.2.5 |
Is there a way to change the dialogs button color? Have tried different things and nothing has worked
The text was updated successfully, but these errors were encountered: