1.0.1 • Published 5 years ago

react-native-irvs-modal v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

npm.io

react-native-custom-modal

A simple and fully customizable React Native component that implements a modal.

SuccessErrorWarning
npm.ionpm.ionpm.io

Installation

If using yarn:

yarn add react-native-irvs-modal

If using npm:

npm i react-native-irvs-modal

Usage

import React, { Component } from 'react';
import { Modal } from 'react-native-irvs-modal';

class ExampleScreen extends Component {
    
    constructor(props) {
        super(props);
        this.state = {
            isVisible: true
        }
    }

    render() {
        return (
            <Modal
                visible={this.state.isVisible} 
                type="success"
                title="Success!"
                message="Modal was rendered."
                confirmButtonAction={() => { this.setState({isVisible:false}) }}
            />
        )
    }
}

export default ExampleScreen;

Documentation

Modal Component

NameDescriptionDefaultType
typeModal type to rendernullString
animationAnimated effect for modalnoneString
visibleSets the display status of the componentfalseBoolean
titleComponent header titlenullString
messageText displayed in modal contentnullString
showConfirmButtonDisplay or not confirm buttontrueBoolean
confirmButtonTextText displayed on confirmation button"OK"String
confirmButtonColorConfirmation Button Color#3085d6String
confirmButtonActionFunction by clicking the confirm buttonnullFunc
showCancelButtonDisplay or not cancel buttonfalseBoolean
cancelButtonTextText displayed on cancel button"Cancel"String
cancelButtonColorCancel Button Color#aaaString
cancelButtonActionFunction by clicking the cancel buttonnullFunc
imageCustom image in modal headernullObject
imageWidthImage width60pxNumber
imageHeightImage height60pxNumber

Contributing

Pull requests are always welcome! Feel free to open a new GitHub issue for any changes that can be made.

Author

Iago Ronan

License

MIT