How to add extra item at the bottom of the drawer navigation manually (like logout button)?

前端 未结 4 1378
一生所求
一生所求 2021-01-02 07:51

I want to add logout button to the bottom of the drawer navigation in my RN app.

I am trying to use contentComponent the following way:

4条回答
  •  伪装坚强ぢ
    2021-01-02 08:15

    I was able to align Logout at the bottom of the drawer menu with adding justifyContent: 'space-between' to the ScrollView container. You can see the result in the picture

    The result source code looks the following way:

    const DrawerWithLogoutButton = (props) => (
      
        
          
        
        
          
            
              
            
            Logout
          
        
      
    );
    
    const styles = StyleSheet.create({
      item: {
        flexDirection: 'row',
        alignItems: 'center',
      },
      label: {
        margin: 16,
        fontWeight: 'bold',
        color: 'rgba(0, 0, 0, .87)',
      },
      iconContainer: {
        marginHorizontal: 16,
        width: 24,
        alignItems: 'center',
      },
      icon: {
        width: 24,
        height: 24,
      }
    });
    

提交回复
热议问题