【问题标题】:Styling drawer in react nativeReact Native 中的样式抽屉
【发布时间】:2025-12-31 11:05:08
【问题描述】:

这是我的抽屉 SS drawer

我想在抽屉中选择屏幕时更改文本颜色和文本背景。我已经尝试过 activeTintColor 和 activeBackgroundColor 但它们不起作用。我想用两种不同的颜色更改抽屉背景颜色。该怎么做?

【问题讨论】:

    标签: android react-native react-navigation


    【解决方案1】:

    我猜你正在使用 React Navigation。我建议您改用自定义组件。查看相关文档:

    drawerContent

    【讨论】:

      【解决方案2】:

      对于React-NavigationV6:

      <MyDrawers.Navigator 
        screenOptions={{ 
          drawerActiveTintColor: "red",
          drawerActiveBackgroundColor: "yellow", 
        }}
      >
         <MyDrawers.Screen name="TestingStack" component={TestingStack}/>
      </MyDrawers.Navigator>
      

      【讨论】: