Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

reactjs - Dynamically hide/transparent header in react navigation 4x?

I have a loader in place but in loads under the header. What i need is too hide or make the header transparent when the loader is loading and again reshow or unhide the header when the loader is ended !

How to implement that ?

As of now am using this,

static navigationOptions = ({ navigation }) => {
        return {
            title: navigation.getParam('from'),
            headerStyle: {
                backgroundColor: '#673AB7',
            },
            headerTitleStyle: {
                color: '#fff'
            },
            headerTitleAlign: 'center',
            headerTintColor: '#fff'
        }
    };

Can this be changed dynamically ? if so how is it ? please guide !

Am using react navigation 4x

question from:https://stackoverflow.com/questions/65871170/dynamically-hide-transparent-header-in-react-navigation-4x

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use:

const loading = <Some state to be received as a prop whether the loader is loading>

stackName: {
  screen:ComponentScreenName,
  navigationOptions: {
    headerShown: !loading
  }
 }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...