React Navigation - Gradient color for Header

后端 未结 4 959
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 08:49

I am using React Navigation in React Native app and I want to change the backgroundColor for the header to be gradient and I found out there is a node module :

4条回答
  •  梦毁少年i
    2020-12-29 09:26

    The solution of Mark P was right but now you need to define headerStyle and do the absolute positioning there:

    navigationOptions: {
      header: props => ,
      headerStyle: {
        backgroundColor: 'transparent',
        position: 'absolute',
        top: 0,
        left: 0,
        right: 0,
        bottom: 0,
      },
    },
    

    and the GradientHeader:

    const GradientHeader = props => (
    
        
          
    )

提交回复
热议问题