question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with createSwitchNavigator when using react-navigation

See original GitHub issue

This library works flawlessly with createStackNavigator but doesn;t work with createSwitchNavigator.

I have a root layout all my components are wrapped with set like this.

This happens with react-navigation library

render(){

        {
            return this.state.fontLoaded ? 
                (
                    <View style={{flex: 1}}>
                        { this.props.children }
                        <FlashMessage position="top" titleStyle={{ fontFamily: 'maven-pro' }}/>
                    </View>
                ) : null
        }
    }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
lucasferreiracommented, Dec 4, 2018

Hi @paschaldev I will close this issue since the main “problem” about createSwitchNavigator are solved.

For your other trouble I’ve recommend you to use the FlashMessage option floating={true}:

<FlashMessage position="top" floating={true} />

This option will modify a little the layout of FlashMessage, but will help eliminating the extra paddingTop inside the message.

Other option it’s don’t use the “androidStatusBar” thing in app.json. I don’t like this “straight fixed bar” of android since the other devices like iPhone (principle iPhone X, XR and XS) it isn’t possible to do it cause “the notch” of device. If you really need to made some black bar in android, you could use the StatusBar module of REACT NATIVE https://facebook.github.io/react-native/docs/statusbar#setbackgroundcolor and not this “androidStatusBar.backgroundColor”.

You could try something like that:

import { StatusBar } from "react-native";

.....
.....

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <StatusBar backgroundColor="black" barStyle="light-content" />
        <AppContainer />
        <FlashMessage position="top" />
      </View>
    );
  }
}
0reactions
paschaldevcommented, Dec 4, 2018

Thanks very much for your help @lucasferreira I appreciate

Read more comments on GitHub >

github_iconTop Results From Across the Web

Header not working in createSwitchNavigator - Stack Overflow
A switch navigator can't have a header. That's react-navigation's rule. Why don't you use the stack navigator instead? It won't cause any ...
Read more >
createSwitchNavigator - React Navigation
The purpose of SwitchNavigator is to only ever show one screen at a time. By default, it does not handle back actions and...
Read more >
How to use the react-navigation.createSwitchNavigator ... - Snyk
Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues...
Read more >
How to Handle Navigation in React Native ... - freeCodeCamp
I always had issues with the old method (static) and it was really hard to change the navigation behavior dynamically. The old method...
Read more >
react-navigation - npm
Start using react-navigation in your project by running `npm i react-navigation`. There are 593 other projects in the npm registry using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found