0.0.6 • Published 6 years ago

react-native-alert-prompt v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-native-alert-prompt

Changes in 0.0.6

  • No breaking changes.
  • Now able to show just an alert to the user, and not include the prompt input.
  • Fixes checkPrompt()

Install

Install via npm:

 npm install react-native-alert-prompt --save

Usage

 import { AlertPrompt } from 'react-native-alert-prompt';
 <AlertPrompt
   alertOnly={false}
   animation={"fade"}
   androidColor={'rgba(0, 150, 136,1)'}
   checkDelay={20}
   autoFocus={true}
   cancelButtonText={'Cancel'}
   confirmButtonText={'Confirm'}
   placeHolderText={'Enter here'}
   validationCaseSensitive={false}
   validationText={'DELETE'}
   visible={this.state.alertVisible}
   alertSubject={"Are you sure?"}
   promptText={<Text>Are you sure you want to delete this account?  Enter exactly DELETE to delete it.</Text>}
   rePromptText={this.rePromptText}
   successfulAnswer={() => this.setState({ alertVisible: false, deleted: this.state.deleted+1 })}
   closePrompt={() => this.setState({ alertVisible: false})}
 />

Props

PropTypeOptionalDefaultDescription
validationCaseSensitivebooleanNotrueWhether the validation on the text input is case sensitive or not.
validationTextstringNo'DELETE'The text to compare with the user's inputted text to determine a sucessful answer or not.
visiblebooleanNo-Whether the alert is visible or not. Typically triggered by an action.
alertSubjectstringNo-The title of the alert.
promptTextstringNo-The initial text prompting the user.
rePromptTextstringNo-The text prompting the user if they get the answer wrong.
successfulAnswercallback functionNo-On a successful answer, what would you like to do?
closePromptcallback functionNo-If the alert wants to close itself. Typically setting root component visible state to false.
animationstringYesfadeMatches RN's animationType on modal. (fade, slide, none)
androidColorcolor valueYes'rgba(0, 150, 136,1)'The color of the cursor and text input box on Android.
checkDelayinteger (milliseconds)Yes250The delay between the initial prompt, and the reprompt if the user submits the wrong text.
autoFocusbooleanYestrueWhether the text input auto focuses on alert show.
cancelButtonTextstringYes'Cancel'The text shown for the cancel option.
confirmButtonTextstringYes'Confirm'The text shown for the confirm option.
placeHolderTextstringYes'Enter here'The placeholder text shown in the text input.
alertOnlybooleanYesfalseWhether the prompt should include a prompt (set this to false, or just don't include it), or just be an alert (set as true).

Contributions/Suggestions

Feel free to add issues and PRs. As with any project, there are things to improve!

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago