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

Set "replaceEnabled" to false, alert won't show up #94

Closed
wellyshen opened this issue Oct 1, 2017 · 6 comments
Closed

Set "replaceEnabled" to false, alert won't show up #94

wellyshen opened this issue Oct 1, 2017 · 6 comments

Comments

@wellyshen
Copy link

wellyshen commented Oct 1, 2017

Issue Description

Thank you for this great library. When I set the replaceEnabled to false. The alert component won't show up. But it works fine when the replaceEnabled set to true.

Steps to Reproduce / Code Snippets

import React from 'react';
import type { Element } from 'react';
import DropdownAlert from 'react-native-dropdownalert';

import styles from './Toast.styles';

type Props = { setRef: (ref: any) => void };

export default ({ setRef }: Props): Element<any> => (
  <DropdownAlert
    containerStyle={styles.container}
    messageStyle={styles.message}
    closeInterval={3500}
    updateStatusBar={false}
    replaceEnabled={false}  // <== The alert will show up when it set to "true"
    ref={ref => setRef(ref)}
  />
);

Expected Results

Alert show up and animation won't dismiss while message changed.

Additional Information

  • React Native version: 0.48.4
  • react-native-dropdownalert version: 3.1.0
  • Platform(s) (iOS, Android, or both?): iOS
  • xCode version: 9
  • iOS version: 11.0.1
@testshallpass
Copy link
Owner

It looks like the animation routine is not invoked when false. I'll fix it up.

      if (this.state.isOpen == false) {
        this.animate(1);
      }

@wellyshen
Copy link
Author

Hi @testshallpass Any update for this issue?

@testshallpass
Copy link
Owner

Sorry for the delay. I must have initially interpreted the issue wrong. I am not able to reproduce it.

@wellyshen
Copy link
Author

@testshallpass

Here's my steps:

  1. Set replaceEnabled={false} at beginning
  2. Use method alertWithType() to display toast
  3. Toast won't be show <= If this behavior meet expectation?

gaodeng added a commit to gaodeng/react-native-dropdownalert that referenced this issue Apr 19, 2018
@gaodeng
Copy link

gaodeng commented Apr 19, 2018

@testshallpass @wellyshen if alertWithType is not called from user interaction,message bar will not animate in.
It can reproduced by the following steps.
1.Set replaceEnabled={false}
2.call alertWithType() from a network callback or setTimeout 。

the fix is easy.I will send a PR

@testshallpass
Copy link
Owner

I was able to reproduce with a timeout as suggested. I have pinpointed the issue to it being the isOpen state variable being true when the alert is invoked from the timeout.

@testshallpass testshallpass moved this from backlog to In progress in react-native-dropdownalert Oct 1, 2018
react-native-dropdownalert automation moved this from In progress to Done Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants