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

Sometimes a Blue Bar is displayed at top of the App #19

Open
BigPun86 opened this issue Aug 1, 2016 · 19 comments
Open

Sometimes a Blue Bar is displayed at top of the App #19

BigPun86 opened this issue Aug 1, 2016 · 19 comments

Comments

@BigPun86
Copy link

BigPun86 commented Aug 1, 2016

Hey there!
Like the Title says, sometimes it shows me a Blue Bar on top of the App. I really don´t know where this comes from, i noticed this after i integrated this module

screen shot 2016-08-01 at 13 10 36

Any ideas?

@KBLNY
Copy link
Owner

KBLNY commented Aug 3, 2016

Hey thanks for your feedback,
This is an old issue. Do you have the latest release?
Do you using redux/flux architecture ?
Please give me a piece of code on which I can investigate deeper.
Thanks

@remstos
Copy link

remstos commented Aug 8, 2016

Same issue when starting the app on iPad Landscape and rotating to Portrait.
Seems like the messageBar is not well initialised until the first show, I managed to fix it by adding this in my componentDidMount:

InteractionManager.runAfterInteractions(() => {
      MessageBarManager.showAlert({ duration: 10 });
});

@BigPun86
Copy link
Author

BigPun86 commented Aug 8, 2016

@KBLNY Thanks for your fast reply. I am running on RN 29.2 and i am using the latest message-bar (v1.6.0)

It is like @kemcake has mentioned. It must be caused by wrong? initialisation? Not sure how to solve this, i tried it with InteractionManager, but dind´t work. Where did u put this @kemcake

@perkola
Copy link

perkola commented Aug 17, 2016

I have the same problem too. RN 0.30.0 and message-bar 1.6.0. No redux/flux.

@holyxiaoxin
Copy link

RN 0.33.0, message-bar 1.6.0

@maluramichael
Copy link

Whats the current issues state? I get this error too. Sometimes the default bar is visible when i create a custom alert.

@hugohow
Copy link

hugohow commented Dec 3, 2016

+1

brianjd added a commit to brianjd/react-native-message-bar that referenced this issue Dec 25, 2016
@brianjd
Copy link

brianjd commented Dec 25, 2016

Submitted a fix yesterday.

@holyxiaoxin
Copy link

@brianjd I tested it and it works. I'm forking from your branch for now.

@paduvi
Copy link

paduvi commented Jan 26, 2017

hi @brianjd I still have that bluebar popup then disappear immediately after...

This is my code:

toggleInfo() {
        const {infoMessage} = this.state;
        if (infoMessage) {
            MessageBarManager.hideAlert();
        } else {
            MessageBarManager.showAlert({
                title: 'abc...',
                message: 'xyz',
                duration: 5000,
                alertType: 'info',
                position: 'bottom',
                avatar: require('../images/dog_logo.jpg'),
            });
        }
        this.setState({infoMessage: !infoMessage});
    }

@holyxiaoxin
Copy link

@paduvi did you try using his forked version?

@paduvi
Copy link

paduvi commented Jan 26, 2017

@holyxiaoxin oh I haven't tried yet. I thought they have fixed this bug. I will have a look at @brianjd fork later. Thanks

@holyxiaoxin
Copy link

@paduvi the author didn't merge his fix. I've tried the forked version and it's working for me.

@paduvi
Copy link

paduvi commented Jan 26, 2017

It seems that blue bar still blink at top when I toggle off the message bar.
And message bar disappears immediately instead of sliding down (message bar's position is bottom)

@holyxiaoxin
Copy link

@paduvi try going to the newly installed node module and console log something. Make sure that it's installed and reloaded in your js bundle.

@paduvi
Copy link

paduvi commented Jan 26, 2017

@holyxiaoxin it works normally if I remove line this.setState({infoMessage: !infoMessage}) after hideAlert(). I have tried to use onHide callback, but it also has the same bug.

I just wanna toggle the MessageBar by using a TouchableOpacity's onPress, it's not hard to reproduce this bug.

@paduvi
Copy link

paduvi commented Jan 26, 2017

I found out why it has that bluebar... It seems that when I update state, application re-rendered the message bar. And because of something, it's not inherit old MessageBar props. A bluebar will appear at top position and slide up.

To prevent re-render, just check the state in shouldComponentUpdate:

    shouldComponentUpdate(nextProps, nextState) {
        if (nextState.infoMessage != this.state.infoMessage && !nextState.infoMessage)
            return false;
        return true;
    }

@trinadhkoya
Copy link

trinadhkoya commented Nov 9, 2017

Yeah ,i understand i.e it is automatically taking the below one,i just replaced that annoying blue color with #fff(white).You can change the colour how ever you want

                   stylesheetInfo={{ backgroundColor: '#fff', strokeColor: '#fff' }}

Duplicate of #29

@bilalsyed001
Copy link

MrSltun@226df65

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