1.6.1 • Published 7 years ago

react-native-prompt-crossplatform v1.6.1

Weekly downloads
19
License
MIT
Repository
github
Last release
7 years ago

react-native-prompt-crossplatform

A prompt component for React Native that works well on both Android and iOS

Installation

$ npm install react-native-prompt-crossplatform --save

or

$ yarn add react-native-prompt-crossplatform

Demo

iOSAndroid
npm.ionpm.io

Basic Usage

import Prompt from 'react-native-prompt-crossplatform';

 // Inside render()

  <Prompt
     title="Say something"
     placeholder="Enter Some Text"
     isVisible={this.state.visiblePrompt}
     onChangeText={(text) => {
       this.setState({ promptValue: text });
     }}
     onCancel={() => {
       this.setState({
         promptValue: '',
         visiblePrompt: false,
       });
     }}
     onSubmit={() => {
       this.setState({
         visiblePrompt: false,
       });
     }}
  />

Available props

NameDescriptionTypeDefault
isVisible            This decides to show the prompt or not     Booleanfalse
promptAnimationThe Prompt animation style (null,fade,slide)Stringfade
titleTitle of the PromptString-
inputPlaceholder    placeholder for the input field      String-
defaultValueDefault value of the input fieldstring-
onChangeTextFunction to be called when a text is changedFunction-
submitButtonTextText for the Submit ButtonStringsubmit
cancelButtonTextText for the cancel ButtonStringcancel
onSubmitFunction to be called when the Submit button is pressedFunction-
onCancelFunction to be called when the Cancel button is pressedFunction-
errorTextAny Error messages to be shownString-
onBackButtonPressFunction to be called when the Back button is pressed (Android Only)Function-
primaryColorprimary Theme colourString#f13a59
promptBoxStylestyle Object to for the main Prompt-BoxObject-
headingStylestyle Object to for the prompt-HeadingObject-
inputStylestyle Object to for the prompt-input-fieldObject-
btnStylestyle Object to for the prompt-buttonsObject-
btnTextStylestyle Object to for the prompt-button-textObject-

Copyright and License

MIT License

Copyright 2018 Ramiah Viknesh. All rights reserved.