From 21fbe1adaecfb9191ec529a1c4e9120a6da0b88c Mon Sep 17 00:00:00 2001 From: Alex Kim Date: Mon, 18 Nov 2024 18:00:30 +1100 Subject: [PATCH] Try fix android issue for player seelct --- app.json | 3 +- plugins/withChangeNativeAndroidTextToWhite.js | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 plugins/withChangeNativeAndroidTextToWhite.js diff --git a/app.json b/app.json index 3f3baa81..86ebe7d9 100644 --- a/app.json +++ b/app.json @@ -105,7 +105,8 @@ "react-native-edge-to-edge", { "android": { "parentTheme": "Material3" } } ], - ["react-native-bottom-tabs"] + ["react-native-bottom-tabs"], + ["plugins/withChangeNativeAndroidTextToWhite.js"] ], "experiments": { "typedRoutes": true diff --git a/plugins/withChangeNativeAndroidTextToWhite.js b/plugins/withChangeNativeAndroidTextToWhite.js new file mode 100644 index 00000000..95c2165a --- /dev/null +++ b/plugins/withChangeNativeAndroidTextToWhite.js @@ -0,0 +1,30 @@ +const { readFileSync, writeFileSync } = require("fs"); +const { join } = require("path"); +const { withDangerousMod } = require("@expo/config-plugins"); + +const withChangeNativeAndroidTextToWhite = (expoConfig) => + withDangerousMod(expoConfig, [ + "android", + (modConfig) => { + if (modConfig.modRequest.platform === "android") { + const stylesXmlPath = join( + modConfig.modRequest.platformProjectRoot, + "app", + "src", + "main", + "res", + "values", + "styles.xml" + ); + + let stylesXml = readFileSync(stylesXmlPath, "utf8"); + + stylesXml = stylesXml.replace(/@android:color\/black/g, "@android:color/white"); + + writeFileSync(stylesXmlPath, stylesXml, { encoding: "utf8" }); + } + return modConfig; + }, + ]); + +module.exports = withChangeNativeAndroidTextToWhite; \ No newline at end of file