ForceDarkAllowed for specific Compose component or how to fix weird text color in dark mode on some Xiaomi phones?

45 Views Asked by At

I have trouble with text color in dark mode on some Xiaomi devices with android 10. The component is clickable Box with text, if item selected - the text color is back and box is white and vise versa. The colors specified directly. Also I use custom color scheme and theme for my app (not a material theme).

Note: I have 5 Xiaomi devices with android 10+ and only one of them have issue with text color in the selected item. On this device the color is white (instead of black) on light background

I can't provide the code of this component

So I have few questions:

  • how to fix it without disabling ForceDarkAllowed for whole app theme and without creating additional themes? (I can't to do this cause this is very global solution)
  • can I set ForceDarkAllowed only for specific Compose component (not a android view)?
  • can I fix it in some other way?
  • if no options except of disabling ForceDarkAllowed, I want to know what the default value of ForceDarkAllowed for other, not Xiaomi, devices and which troubles I can encounter cause of this global theme value changing?

P.S. I almost fixed this issue by placing my component inside a Surface with shadowElevation, but this has effect only before user interactions with this component, after click on the other component like this - text is white again

0

There are 0 best solutions below