1.2.2 • Published 5 years ago

react-native-cross-prompt v1.2.2

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

react-native-cross-prompt

A cross-platform, Google/Android & iOS style, Component for React-Native apps to prompt for user input.

NPM

https://www.npmjs.com/package/react-native-cross-prompt

Installation

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

Demo

Android

iOS

Pending..

Usage

import Prompt from 'react-native-cross-prompt'

constructor(props) {
  super(props);
  this.state = {
    promptVisible: false,
  }
}

_handlePrompt = (value) => {
  alert(value)
}

<View>
  <Text>Tap the button to show the prompt!</Text>
  <Button
    title="Press me!"
    onPress={() => this.setState({ promptVisible: true })}
  />
  <Prompt
    visible={this.state.promptVisible}
    title="Title"
    description="This is the prompt description."
    placeholder="placeholder"
    onCancel={(visible) => this.setState({ promptVisible: visible })}
    onSubmit={(value) => this._handlePrompt(value)}
  />
</View>

API

props:

  • visible (boolean) -- Prompt is visible when true
  • title (string, required) -- Set the title of the prompt
  • description (string, required) -- Set the description of the prompt
  • placeholder (string, required) -- Set the placeholder of the input field in the prompt
  • value (string) -- Set the initial value of the input field in the prompt
  • onCancel (function, required) -- Function that is called when "CANCEL" was fired
  • onSubmit (function, required) -- Function that is called when "OK" was fired

Testing

Install node modules

npm install

Run

npm test

1.2.2

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.12

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago