首页 > 解决方案 > 更改场景标题元素的文本颜色

问题描述

我正在使用 React Native 和 react-native-router-flux 创建一个小型 Android 移动应用程序。

除了主屏幕的leftTitleand属性之外,我已经自定义了所有内容。rightTitle我可以命名它们,但我无法设置它们的样式。它们保持这种蓝色,如下图所示。

在此处输入图像描述

这是该场景的代码:

<Scene
  rightTitle="Add"
  onRight = { () => Actions.employeeCreate() }
  key="employeeList"
  component={EmployeeList}
  title="Employees"
  leftTitle="Log Out"
  onLeft={ () => logUserOut() }
  initial
/>

有谁知道如何更改标题文本的颜色?

谢谢!

标签: react-nativereact-native-router-flux

解决方案


  1. 在中查找react-native-router-flux文件夹node modules
  2. 导航到react-native-router-flux > src > NavBar.js
  3. 像这样编辑颜色样式barRightButtonText和样式表barLeftButtonText

对于右键文本:

 barRightButtonText: {
    color: 'rgb(0, 122, 255)',    //Your rgb color code here
    textAlign: 'right',
    fontSize: 17,
  },

对于左键文本

 barLeftButtonText: {
    color: 'rgb(0, 122, 255)',  //Your rgb color code here
    textAlign: 'left',
    fontSize: 17,
  },

推荐阅读