title: How to use custom alert in React Native?
body: <p>I've created a custom alert as a component in React Native. I used <code>Modal</code> to create this custom alert. My problem is, how to use it? Instead of using <code>Alert.alert</code> in React Native, I want to display my own alert.</p>
  
  <p>Here is my <code>Custom Alert Modal</code>.</p>
  
  <pre><code>import React, { Component } from 'react';
  import { Text, View } from 'react-native';
  import Modal from 'react-native-modal';
  
  import styles from './style';
  import Button from '../../components/Button';
  
  export default class CustomAlert extends Component {
  
    renderModalContent = () =&gt; (
      &lt;View style={styles.content}&gt;
        &lt;Text style={styles.contentTitle}&gt;{this.props.title}&lt;/Text&gt;
        &lt;Text style={styles.contentInfo}&gt;{this.props.content}&lt;/Text&gt;
        &lt;View style={styles.buttonContainer}&gt;
          &lt;Button
            color={this.props.buttonColor}
            text={this.props.buttonText}
            onPress={this.props.buttonOnPress}
          /&gt;
        &lt;/View&gt;
      &lt;/View&gt;
    );
  
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Modal
            isVisible={this.props.isVisible}
            backdropColor="#000000"
            backdropOpacity={0.9}
            animationIn="zoomInDown"
            animationOut="zoomOutUp"
            animationInTiming={600}
            animationOutTiming={600}
            backdropTransitionInTiming={600}
            backdropTransitionOutTiming={600}
          &gt;
            {this.renderModalContent()}
          &lt;/Modal&gt;
        &lt;/View&gt;
      );
    }
  }
  </code></pre>
  
  <p>This is how I want to use it. I want to display this alert through a function. That means when function catches up with an error, I want to show my custom alert.</p>
  
  <pre><code>myFunction()
    .then(() =&gt; // do something)
    .catch(() =&gt; // show my custom alert);
  </code></pre>
  
  <p>Can you help me please to solve this problem?</p>