android - Different Headers in StackNavigator -
i have implemented stacknavigator in removed header styles purpose.
now have component inside stacknavigator i'd header back. how reckon ?
here stacknavigator :
const nav = stacknavigator( { splashscreen: {screen: splashscreen}, login: {screen: login}, register: {screen: register}, main: {screen: mainnav}, }, { headermode: 'none', });
but register screen, have header (to let user know can go back).
i tried doing :
static navigationoptions = { title: 'register', header: { } }
but don't quite know put inside header part.
personally did: had set height of header 0 when didnt want show , n show somenthing height: condition ? 0 : 10
otherwise answered here
you can programmatically following code:
static navigationoptions = ({ navigation }) => ({ header: > (navigation.state.params.thanks) => <headerview > content={navigation.state.params.thanks} /> : null, })
and can set state params this:
componentwillmount() { this.props.navigation.setparams({ thanks:"something" }); }
although haven't tried code myself , i'm not sure if headerview accessible public api in react-navigation , if there content property on that. think in abstract way, how set programmatically.
i didn't try either might work
edit: answer given in github better, can import headerview react-navigation , header: condition ? headerview : null
show , hide
Comments
Post a Comment