Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change React Native Android's default text color to black?

Currently it's light grey, but I'd like to change it to black, I've tried multiple attempts as found online but it still doesn't work. Please help if you can, thanks!

Version: 0.43.1 (Cannot change for now due to commercial reason)

I've tried several syntax combinations, deleting the build folder and running react-native run-android and nothing is changing.

I would not prefer using any global styling library, because I'd like to minimize overheads to an already bulk codebase.

Here's my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="com.xxxxxxx"
	android:versionCode="1"
	android:versionName="1.0"
	android:installLocation="internalOnly">

	<application android:icon="@mipmap/app_icon"
	    android:label="@string/app_name"
		android:name=".MainApplication"
		android:manageSpaceActivity="com.salesforce.androidsdk.ui.ManageSpaceActivity"
        android:theme="@style/AppTheme"
	>

		<!-- Launcher screen -->
		<activity android:name=".MainActivity"
				  android:label="@string/app_name"
				  android:screenOrientation="landscape"
				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>

        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"
				  android:screenOrientation="landscape" />

	</application>

    <uses-sdk android:minSdkVersion="19"
        android:targetSdkVersion="25" />

    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

	<uses-permission android:name="android.permission.RECORD_AUDIO"/>
	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

	<uses-permission android:name="android.permission.BLUETOOTH"/>         <!-- for Device Name -->
	<uses-permission android:name="android.permission.READ_PHONE_STATE"/>  <!-- for Phone Number -->

</manifest>

Here's my folder structure: enter image description here

And here's my styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:textColor">#000</item>
    </style>

</resources>
like image 869
kdenz Avatar asked Dec 12 '17 11:12

kdenz


People also ask

How do I change the default text color in react native?

There is no way to change all existing Text components unless you create a branch of the react-native library and modify the source code for Text .

How can I change the font color of my Android app name?

Search for and select Open App, and then, on the New Shortcut page, tap Choose. Locate the app whose appearance you want to change. Back on the New Shortcut page, you'll see the app name; tap More (three dots), change the app's name, tap its icon, select Color, and choose a new color.


1 Answers

Create the theme in styles.xml, and apply it in the manifest. Here's what ours looks like:

android/app/src/main/res/values/styles.xml:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="android:textColor">#000000</item>
</style>

AndroidManifest.xml:

<application
  ...
  android:theme="@style/AppTheme">

(Based on this answer.)

like image 152
Freewalker Avatar answered Sep 20 '22 23:09

Freewalker