Skip to content

A pure JavaScript React Native component for Custom Alerts view. This component will generate same UI for both Android and iOS.

License

Notifications You must be signed in to change notification settings

weblineindia/React-Native-Custom-Alert-View

Repository files navigation

React Native Custom Alert View Component

A pure JavaScript React Native component for Custom Alerts view. This component will generate same UI for both Android and iOS.

Getting Started

Installation

$ npm install rn-weblineindia-custom-alert-view --save

Supported versions

ReactNative 0.60 - 0.62.5 is supported for v1.0.0 of this component.

Usage

showAlertView() {
    let object = {
      // Options put here...     
      title: 'Custom Dailog',
      message: 'This is Custom Alert Dialog.',
      arrAlertItems: ['OK'],
      buttonFlow: 'row'
    }
    this.props.showAlertView(object, (index) => {
      if (index === 0) {
        // callback actions here...
      } 
    })
  }
<TouchableOpacity onPress={() => this.showAlertView()}>
  <Text>Try me</Text>
</TouchableOpacity>
}

Using Higher-Order Components

Enabling any component for custom alert is very easy. Take a look at the code:

/* @flow */

import CustomAlerts from 'rn-weblineindia-custom-alert-view';

class App extends Component{
        // code here...
}

export default CustomAlerts(App)

Method

Use this.props.showAlertView to access this method.

Method Parameter
showAlertView (Object,Callback)

Options of Object

Options Type Description
title string Title to be displayed in the alert
message string Message to be displayed
arrAlertItems array Array of the string to be displayed in the button label
arrDestructiveItems array Array of the string to be displayed in the destructive button label
buttonFlow string There are two options to be displayed buttons 'column' and 'row'

Callback

this.props.showAlertView(object, (index) => {
      if (index === 0) {
        // callback actions here...
      } 
    })

Want to Contribute?

  • Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part).
  • Fork it.
  • Create new branch to contribute your changes.
  • Commit all your changes to your branch.
  • Submit a pull request.

Need Help?

We also provide a free, basic support for all users who want to use this React Native Custom Alert View component in their software project. In case you want to customize this Custom Alert View component to suit your development needs, then feel free to contact our ReactNative developers.


Collection of Components

We have built many other components and free resources for software development in various programming languages. Kindly click here to view our Free Resources for Software Development.


Changelog

Detailed changes for each release are documented in CHANGELOG.md.

License

MIT

Keywords

rn-weblineindia-custom-alert-view, react-native-custom-alert-view, custom-alert-view, react-native