Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide navBar pragmatically #2441

Closed
pgonzalez-santiago opened this issue Sep 27, 2017 · 12 comments
Closed

How to hide navBar pragmatically #2441

pgonzalez-santiago opened this issue Sep 27, 2017 · 12 comments

Comments

@pgonzalez-santiago
Copy link

Version

  • react-native-router-flux v4.0.0-beta.21 (v3 is not supported)
  • react-native v0.48.3,

I need to hide the navBar inside the component. I have tried to run:

Actions.refresh({ hideNavBar: true })

but it doesn't work. Any ideas of how can I hide the navBar programmatically?

@mcabs3 mcabs3 changed the title How to hide navBar inside the component/scene? How to hide navBar pragmatically Sep 27, 2017
@MichaelPintos
Copy link

<Scene key="myView" component={myView} hideNavBar={true}/>

in myView you will need to create your own navigation bar.

<View style={styles.container}>
        {this.state.renderNav && (
          <View>
            <Text>NavBar</Text>
          </View>
        )}
        <Text>MyView</Text>
        <TouchableHighlight onPress={() => this.setState({ renderNav: !this.state.renderNav })}>
          <Text>Toggle Nav</Text>
        </TouchableHighlight>
 </View>

@onrige
Copy link
Collaborator

onrige commented Sep 28, 2017

@pgonzalez-santiago This feature was able about two weeks ago by my PR but it's broke drawer in some cases it seems.
So you can have a look at commit: 2909046

@pgonzalez-santiago
Copy link
Author

So what do we do now? I am doing feature that needs fullscreen so I have to hide the navbar.

@onrige
Copy link
Collaborator

onrige commented Sep 29, 2017

@pgonzalez-santiago Fine, I will try to reproduce this bug in commit and resolve it. But you must admit that there is no accepted PRs since @aksonov went on vacation (till 8 october).

@ihor
Copy link

ihor commented Oct 4, 2017

I'm having the same issue but I want to display navBar on scroll.

@thiemo--bleeken
Copy link

have the same issue. how can we hide the navbar?

@alexhoo
Copy link

alexhoo commented Oct 10, 2017

Same issue here :(

@johanmic
Copy link

johanmic commented Oct 10, 2017

This can be solved using a custom nav bar

<Router 
navBar={NavBar} >
....
</Router>

export default class CustomNavBar extends Component {
    render() {
        const { title, hideNavBar } = this.props;
        if(hideNavBar === true) return <View />
        return (
            <View>
                <Text>{title}</Text>
            </View>
        );
    }
}

then whenever you can set

Actions.refresh({hideNavBar:true})

@onrige
Copy link
Collaborator

onrige commented Oct 10, 2017

@pgonzalez-santiago @ihor @thiemo--bleeken @alexhoo now you can monitor any updates on this here #2492.

@pgonzalez-santiago
Copy link
Author

Thank you @onrige

@hatemjaber
Copy link

Is it possible to use the LeftButton, RightButton, etc... in the NavBar.js file and pass properties to it? I was hoping there is a way to access it so that I can pass it along to the renderRightButton property or right property in order to use it rather than creating one from scratch. Please advise how I can go about doing that.

@aksonov
Copy link
Owner

aksonov commented Nov 10, 2017

Please check latest master.

@aksonov aksonov closed this as completed Jan 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants