Talor-A / react-native-message-bar

A notification bar alert displayed at the top of the screen for react-native
MIT License
55 stars 27 forks source link

delay before message bar appears #8

Closed Talor-A closed 6 years ago

Talor-A commented 7 years ago

Original Issue here.

gyfis commented 7 years ago

It would seem that the delay is caused by the alert hiding system which does not properly recognize if there is an alert shown or not. Plus there's an additional 100ms delay.

rochapablo commented 6 years ago

The delay still on 2.0.6

raghudevan commented 6 years ago

I'm seeing a lot of delay on android; 20+ seconds for the alert to show up (This is on Android)

Talor-A commented 6 years ago

I'm not able to reproduce this @rochapablo @raghudevan , please post sample code or send a PR.

malonguwa commented 6 years ago

UPDATED: I just deleted all my existed emulator and add it into the Android Studio again, now everything is working well... I guess something wrong with my emulator. If anybody is using the the Android Studio Emulator (AVD Manager) you can try delete and add again. It solves my issues, and Android Studio Emulator is not really stable, I also experience some Tab bar switch delay issue as well, and after I re-add it, the issue is gone.

@Talor-A Thanks for maintain this lovely message bar, I try to use it in my project, but it is seems not work (a lot of delay) for my Android Emulator Pixel_API_26:5554 which comes with the Android Studio. But it is perfectly working in iOS Simulator. I do not have any Android phone at the moment, so I can not test it on real phone.

my implementation code is really simple (Not using redux in my project).

let MessageBarAlert = require('react-native-message-bar').MessageBar;
let MessageBarManager = require('react-native-message-bar').MessageBarManager;

    componentDidMount() {
        MessageBarManager.registerMessageBar(this.refs.alert);
    }

    componentWillUnmount() {
        MessageBarManager.unregisterMessageBar();
    }

    _navigateToMainTabScreen = () => {
        this.dismissSystemKeyboard();
        if (this.fieldsValidator() === true) {
           // switch to mainTab screen
        } else {
            MessageBarManager.showAlert({
                title: 'Missing field',
                message: 'Please fill in both fields in order to login',
                alertType: 'error',
                viewTopInset: 8,
            })
        }
    };
    render() {
        return (
            <View>
             ..........
                           <MessageBarAlert ref="alert" />
            </View>
     }
Talor-A commented 6 years ago

hm, strange that it wasn't working on the android emulator. there's no native code, so everything should be the same. glad to see it's alright now. going to close this, I'll reopen if someone else has the same issue.