Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): align built-in theme colors with desktop #12534

Mergedjuliusmarmingemerged 10 commits intomain fromrefs/pull/12534/headmerged by juliusmarminge View on GitHub

Showing 84 changed files with 70 additions and 61 deletions (loading 81).

x
0 of 84 viewed, 84 left
9 additions and 1 deletionapps/mobile/modules/t3-markdown-text/android/src/main/java/expo/modules/t3markdowntext/T3ContextChip.ktModified
View file
@@ -114,7 +114,15 @@
fun color(
value: String,
fallback: Int
- ): Int = runCatching { Color.parseColor(value) }.getOrDefault(fallback)
+ ): Int = runCatching {
+ // React Native hex colors put alpha last; Android's parser puts it first.
+ val androidColor = if (value.length == 9 && value.startsWith("#")) {
+ "#${value.takeLast(2)}${value.substring(1, 7)}"
+ } else {
+ value
+ }
+ Color.parseColor(androidColor)
+ }.getOrDefault(fallback)
​
private fun blend(accent: Int, base: Int, weight: Float): Int = Color.rgb(
(Color.red(accent) * weight + Color.red(base) * (1 - weight)).toInt(),
15 additions and 16 deletionsapps/mobile/plugins/withAndroidModernAlertDialog.cjsModified
View file
@@ -1,5 +1,6 @@
const fs = require("node:fs");
const path = require("node:path");
+const themeVariables = require("../generated-uniwind-default-theme-variables.json");
const {
AndroidConfig,
withAndroidColors,
@@ -11,9 +12,10 @@
// React Native's Alert renders an AppCompat AlertDialog on Android, which