【问题标题】:Drawer item background changing to grey when clicking/long click - React Native Navigation - Drawer Navigator Options单击/长按时抽屉项目背景变为灰色 - React Native Navigation - Drawer Navigator Options
【发布时间】:2023-02-07 04:50:48
【问题描述】:

我正在使用 react-navigation 用于导航目的的 react-native 中的应用程序。 当我在这里偶然发现一个问题时,我正在学习使用 react-navigation 中的导航抽屉。 每当我点击/长按抽屉项目时,项目的背景首先变为灰色,然后变为 activeColor(我已经在选项中定义)。 灰色看起来很糟糕。 如何删除或更改它?

这是我尝试通过单击“通知”项从“主页”切换到“通知”的时候。

我正在分享以下代码:

<Drawer.Navigator
  screenOptions={{
    headerPressColor: Colors['blue'],
    headerShadowVisible: true,
    drawerActiveBackgroundColor: Colors['primary'],
    drawerActiveTintColor: '#fff',
    drawerInactiveTintColor: '#333',
    drawerLabelStyle: {
      marginLeft: -20,
      fontFamily: 'Poppins-Regular',
      fontSize: 15,
    },
    itemStyle: { flex: 1, marginVertical: 5 },
  }}
  // Here we are setting our custom sidebar menu
  drawerContent={(props) => <CustomSidebarMenu {...props} />}
>

【问题讨论】:

    标签: android react-native react-navigation react-navigation-drawer


    【解决方案1】:

    我从来没有使用过基本的抽屉项目,我一直在制作自定义抽屉组件,在那里你可以随心所欲地处理一切和风格。 在你的代码中:

    drawerContent={(props) => <CustomSidebarMenu {...props} />}
    

    例如,如果您想更改项目的 onClick:

    <TouchableHighlight
      underlayColor="your on focus color"
      activeOpacity={specify opacity in number}>
      <View>
       <Text>Text</Text>
      </View>
    </TouchableHighlight>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-01
      • 2020-06-09
      • 1970-01-01
      • 1970-01-01
      • 2022-06-30
      • 1970-01-01
      相关资源
      最近更新 更多